how to use the samtools filtering expression ?

1

Hello everyone,

I'm currently trying to use the samtools filtering expression as follows :
samtools view exemple.bam --input-fmt -filter="mapq >= 60" > tested.sam

Unfortunately, this doesn't seem to work properly as my output sam still contains alignments with mapq < 60.
I think my use of this filtering option is wrong.
But I thought this could work according to the following documentation :
www.htslib.org/doc/samtools.html#FILTER_EXPRESSIONS
However I couldn't find any exemple of a proper use of this method.

My ultimate goal being to achieve something like this :
samtools view -h input.bam --input-fmt-option "filter=mapq >= 5 && [MM]/qlen > 0.3 && [NM]/[MM] > 0.3" > output.sam

Thanks for the help.


filtering


help


expression


samtools


custom

• 41 views

The easy and hard way of specifying this in view:

samtools view -c -e 'mapq >= 60'  in.bam

and

samtools view -c --input-fmt-option 'filter=mapq >= 60' in.bam

Note the quotes. Don't try to quote filter="expr" in the second option as that just evaluates whether "text" is true, which it will be due to being non-null.


Login
before adding your answer.

Traffic: 2341 users visited in the last hour



Source link