That works! Thank you! kind regards, Claudio On 27/01/2016 17:01, John Marshall wrote: > 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 >
-- Claudio Alberti ---------------------------------------------- http://gramm.epfl.ch EPFL SCI STI MM ELG 140 (ELG Building) Station 11 CH-1015 Lausanne - Switzerland Tel. +41 21 6936869 ---------------------------------------------- ------------------------------------------------------------------------------ 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
