Question: how to get low quality read from sam file
2
0
Entering edit mode
3.1 years ago

Hello, l am a starter.I used hisat2 to generate a sam file and have extracted unmapping reads. l want to extract reads with a mapping quality lower than 10.My instructor reminded me to think about how to get the mapping quality.but I don't know how to extract it. Thanks for your help.

RNA-Seq alignment • 956 views
ADD COMMENT
0
Entering edit mode

sam file is a text file and one of the columns codes for map qualities. Filter the data by map quality column and validate with standard tools such as samtools.

ADD REPLY
3
Entering edit mode
3.1 years ago
ATpoint 82k

For example use sambamba:

sambamba view -c -F "mapping_quality < 10" --sam-input -f sam -o filtered.sam in.sam

https://lomereiter.github.io/sambamba/docs/sambamba-view.html

ADD COMMENT
0
Entering edit mode

thank you for your replying!

ADD REPLY
2
Entering edit mode
3.1 years ago

samtools view is able to filter for "quality greater than". But for "lower than", you could use awk:

samtools view -h in.bam | awk -F '\t' '$0 ~ /^@/ || $5< 10'
ADD COMMENT
0
Entering edit mode

thank you for your replying!

ADD REPLY

Login before adding your answer.

Traffic: 2863 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6