This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools filtering

Hello everyone,

I mapped several reads to a reference genome with minimap2 and now I would like to filter the primary reads that have a certain % identity with the reference, is it possible to do this?

I found that samtools can filter the primary reads using the following command:

samtools view --F 0x100 -q 30 -b sorted.bam > primary_alignments.bam

However, I remain doubtful about the percentage of identity, can anybody help me?

The idea is to then run a bedtools to see if my reads cover the reference.

samtools

Thank you very much, I will see if I can install any of those options on my server. I was considering using this samtools command that filters out non-primary reads:

samtools view --F 0x100 -q 30 -b sorted.bam > primary_alignments.bam

Sorry, I got confused in the first question,

You can add -e '[NM]/qlen >= 0.1' into the view command, but the definition of what constitutes +1 on mismatch for NM and on identity may be subtly different.

0 answers

No answers yet.

Log in to answer this question.