Extract unmapped reads using RNAME
I know I can use samtools view -f 4 to get all unmapped reads, but is there anyway to use RNAME (column 3) to do this? I noticed in my data that if read is unmapped, the RNAME is usually "*" but this is not always the case, for example, the below read is unmapped, and column 3 shows a value of 919.
MN00234:25:000H2KF73:1:11101:1073:6553 101 919 6150 0 * = 6150 0 GATCGCTGCGGGGGGGGGGGGGGGG AFFFFFA/AFFFFFAFFAFFF/FAF YT:Z:UP
I would like to get all pairs where one or both mates are unmapped, using RNAME column. Any ideas?
Thanks!
• 1,896 views
•
link
1 answer
From the SAM specification:
Bit 0x4 is the only reliable place to tell whether the read is unmapped. If 0x4 is set, no assumptions can be made about RNAME, POS, CIGAR, MAPQ, and bits 0x2, 0x100, and 0x800.
I.e., no.
• 0 views
•
link
Log in to answer this question.