PoisonAlien / somatic_pipeline

2 stars 4 forks source link

how to get unmapped reads via your script ? #1

Open zeronot opened 7 years ago

zeronot commented 7 years ago

HI, it's my first time to use htslib ,I wanna know whether sam_read1 function can get unmapped reads in your https://gist.github.com/PoisonAlien/350677acc03b2fbf98aa ?

PoisonAlien commented 7 years ago

Hi, I am not a C coder, I wrote that just see how easy it's to manipulate bam files in C as a novice in C (turns out its not easy). Anyways there are no documentation for htslib, except the comments in header files. I figured out most of the functions based on those comments (see here https://github.com/samtools/htslib/blob/develop/htslib/sam.h)

I think sam_read1 reads anythings thats in bam file. To see if that read is unmapped you need to fetch mapping quality (https://github.com/samtools/htslib/blob/develop/htslib/sam.h#L141) qual field from bam1_core_t

hope this helps.

zeronot commented 7 years ago

HI , how to complie your readbam.c code ? I tried ,but errors reported .