On 27 Jan 2016, at 15:16, Claudio Alberti <[email protected]> wrote:
> I'm looking for a way to programmatically get the number of reads 
> contained in a BAM file which are mapped on one of the used references.
> I'm currently using htslib and I'm wondering if any API is available to 
> do that.

Look at hts_idx_get_stat(), which is what samtools idxstats uses to extract 
this information from an index.  If your file is not indexed, you'll have to 
write the usual loop to read through the whole file and count them.

   John

-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Samtools-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to