This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to get a list of aligned read and reference positions using samtools

I am trying to convert a python script that manipulates bam files, to C++. However, I couldn't find out how can I get a list of aligned query and reference positions using samtools. I want to get reads from a region and for that, I used this link: htslib C API: getting reads from region

But I cannot find a way in samtools to get the list of aligned query and reference positions. In pysam "get_aligned_pairs" returns this list. How can I extend the code in the link I mentioned to do this in samtools?

Thanks

samtools api htslib cpp c

samtools view in.bam “chr1:100-1000”

Can you please elaborate a bit more? I want to do it in c. In each read inside while loop ("sam_itr_next(in, iter, b)") I want to get the list of pairs.

0 answers

No answers yet.

Log in to answer this question.