SEQanswers (
-   Bioinformatics (
-   -   samtools c++ api (

wokai001 12-03-2010 01:59 PM

samtools c++ api
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:

// line 10: BGZF *fp;
        while ((len = knet_read(in->x.fpr, buf, BUF_SIZE)) > 0)
        while (!feof(in->file) && (len = fread(buf, 1, BUF_SIZE, in->file)) > 0)
                fwrite(buf, 1, len, fp->x.fpw);          // this is line 28

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:

        union {
                knetFile *fpr;
                FILE *fpw;
        } x;

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.

nilshomer 12-03-2010 11:02 PM

Try posting to the samtools help list:

wokai001 12-04-2010 01:01 AM

Sent a copy

Originally Posted by nilshomer (Post 30698)
Try posting to the samtools help list:

Yes, I Found the SourceForge support Site with your remark.
Sent a copy of the post.

Thank you

All times are GMT -8. The time now is 07:14 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.