Removing Unmapped Reads from SAM File (SAMTools)
1
0
Entering edit mode
4.5 years ago
gtasource ▴ 60

I know, this question is everywhere. But I have yet to see somebody use the same samotols command as myself, and I wanted to double-check.

samtools view -S -f 4 aligned.sam > unmapped.sam

Yay?

Samtools • 1.3k views
ADD COMMENT
0
Entering edit mode

Try it. If reads with a * in chromosome field are gone then you are all set.

ADD REPLY
0
Entering edit mode

Just to clarify, the * in the chromosome signifies unmapped reads? So, in the above command, since I am extracting unmapped reads into a separate file, that file should have mostly reads with * in the chr field.

ADD REPLY
1
Entering edit mode
4.5 years ago

Your way is fine. The -S is optional; the default behavior of samtools view is to output as sam, not bam.

ADD COMMENT

Login before adding your answer.

Traffic: 3404 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