This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Both mate pairs aligning to same contig counts

Hello all,

I have BAM files of reads mapping to contigs assembled from those reads. I would like to get information about the amount of properly paired reads aligned to each contig.

Using samtools coverage --rf 2 file.bam I can get these results. I was wondering though whether this means that the output number of reads refers to only those mapping to the same contig or does this only mean that that certain number of reads are properly paired but the mate can be aligned to some other contig (or not at all for that matter).

For example:

#rname  startpos  endpos  numreads

NODE_1_length_44838_cov_5.55007         1   44838      3193

NODE_1_length_44838_cov_5.55007         1   44838      2772

The first line is the total amount of reads mapped to NODE_1 and the second was by using the --rf 2 parameter. Does this mean that both mates of properly paired reads aligned to this contig resulting in 2772?

If not, then how could I get information about how many mate pairs both aligned to the same contig?

Thank you for your help

paired_reads samtools_coverage

1 answer

In a bam file you will have one entry for each place that a read maps and then a flag that tells you if its the primary or one of the secondary mappings, my guess is that if you don't specify to use primary mapped reads only then it will use everything. I think with the -q option you can set the mapping quality. multi mappers won't have a high mapping quality score

Thank you for your reply.

Log in to answer this question.