Extract unmapped reads using RNAME
1
0
Entering edit mode
5.3 years ago
max_19 ▴ 170

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!

bam sequence next-gen • 1.4k views
ADD COMMENT
2
Entering edit mode
5.3 years ago
cschu181 ★ 2.8k

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.

ADD COMMENT

Login before adding your answer.

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