I would like to read and write bam files within c++. For that I downloaded the source code files and tried to get the SAMtools Example c program running.
Upon compiling I get an Error message
../src/samtools/bam_reheader.c: In function ‘bam_reheader’:
../src/samtools/bam_reheader.c:28: error: ‘BGZF’ has no member named ‘x’
In "bam_reheader" I found:
where line 28 obviously is not affected by the definition of _USE_KNETFILE.
Upon looking up the definition of BGZF which is located in "bgzf.h", I found the following:
So, when _USE_KNETFILE is not declared, the member x is not included in the declaration of BGZF but expected to exist later on. At first sight, this seems to be an error in the source code.
Did anyone else encounter this problem or does anyone know a solution?
Thanks very much.
Wolfgang
Upon compiling I get an Error message
../src/samtools/bam_reheader.c: In function ‘bam_reheader’:
../src/samtools/bam_reheader.c:28: error: ‘BGZF’ has no member named ‘x’
In "bam_reheader" I found:
Code:
// line 10: BGZF *fp; #ifdef _USE_KNETFILE while ((len = knet_read(in->x.fpr, buf, BUF_SIZE)) > 0) #else while (!feof(in->file) && (len = fread(buf, 1, BUF_SIZE, in->file)) > 0) #endif fwrite(buf, 1, len, fp->x.fpw); // this is line 28
Upon looking up the definition of BGZF which is located in "bgzf.h", I found the following:
Code:
#ifdef _USE_KNETFILE union { knetFile *fpr; FILE *fpw; } x;
Did anyone else encounter this problem or does anyone know a solution?
Thanks very much.
Wolfgang
Comment