This is a test version of Biostars. For the public version, visit https://www.biostars.org.
first and second mate reports by samtools 0x40 and 0x60 FLAGs

Hi I would like to separate 1/2 mates of a paired-end bam file.

To see first mate:

samtools view -F 0x40 in.bam

To see second mate:

samtools view -F 0x80 in.bam

but it returns the following as first mate (0x40):

H0544AFXX:1:11101:8739:1038 163 chr3 17908775 3 1S74M = 17909029 330 ...

and for example this one as second (0x80):

NS500173:56:H0544AFXX:1:11101:8739:1038 **`83`** chr3 17909029 3 75M = 17908775 -330

while Flag 163 means:

read paired
read mapped in proper pair
mate reverse strand
second in pair

and 83:

read paired
read mapped in proper pair
read reverse strand
first in pair

It would be great if somebody could clarify this issue. Thanks

rna-seq sequencing alignment

1 answer

From the definition of the parameter, -F will filter the reads with the flag, while -f will give your required flag. So you have misunderstand the parameters.

-f INT   required flag, 0 for unset [0]
-F INT   filtering flag, 0 for unset [0]

Log in to answer this question.