Entering edit mode
7 months ago
sansan96
▴
130
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.
see filter reads with >90% match
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:
this is not the filter you asked for
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.