Isn't this what 'samtools idxstats <file>' does ?  Can't remember, exactly.

                                                -  tom blackwell  -

On Wed, 27 Jan 2016, Claudio Alberti wrote:

> Hello,
> 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.
> Something like the output of
>
> samtools view chr1 | wc
>
> where I would pick the number of lines.
>
> Thank you!
> regards,
> Claudio
>
> -- 
> 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
>

------------------------------------------------------------------------------
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