This is a test version of Biostars. For the public version, visit https://www.biostars.org.
extract unmapped reads from WGS data - which samtools parameters to choose

I have seen at least two methods for extracting the unmapped reads from a paired end WGS dataset. Does it make any difference which one I choose. Whats the advantage with the first?

methods 1: samtools view -f 1 -F 3842 | samtools view -f 12 -F 3328 -

methods 2: samtools view -f 4

wgs sequencing

F = Filter out

f = Keep

Explanation of SAM flags (LINK for lookup)

1 = read paired

3842 =  read mapped in proper pair (0x2)*
    not primary alignment (0x100)
    read fails platform/vendor quality checks (0x200) 
    read is PCR or optical duplicate (0x400) 
    supplementary alignment (0x800)

12 =   read unmapped (0x4)
    mate unmapped (0x8)*

3328 = not primary alignment (0x100)
    read is PCR or optical duplicate (0x400)
    supplementary alignment (0x800)

For second operation:

4 = read unmapped (0x4)

Thanks for showing this. But my question is really if there is any biological justification for choosing the simple approach (method 2) versus the more comprehensive filtering (method 1)

Perhaps not for simple whole genome sequencing but if you were going to call variants then you will want to take all the other filters into account that are in method 1.

Just to add to this: If you are using Bowtie2, you could filter unmapping reads upon alignment.

For this, you could add the option --al-conc as per the manual.

0 answers

No answers yet.

Log in to answer this question.