This is a test version of Biostars. For the public version, visit https://www.biostars.org.
count reads (.sam) mapped to scaffolds with non-standard headers

Hi!

I have .sam files generated by bbmap. I was mapping paired reads to a set of scaffolds that have non-standard names (I have these names, they are a bundle of assembly generated names and spike-in names). Now I need to extract the number of reads that were mapped to each of the scaffolds. BBmap gives me only coverage information per scaffold. But I also want to try working with a number of reads mapped to each scaffold. How can I extract this information?

sam samtools counts bbmap

Remember to use

covstats=<file>         Per-scaffold coverage info.

to get that information when you are mapping with BBMap next.

I actually have these files (covstats) but they contain scaffold coverage information, not the number of reads per scaffold. Or am I mistaking something? (I need both, I'm testing different normalization strategies and need coverage info, the total number of reads mapped per sample, and number of reads mapped per scaffold)

1 answer

samtools sort -o out.bam in.bam
samtools index out.bam
samtools idxstats out.bam

cool! that worked! thank you very much!

Log in to answer this question.