Bowtie2 Paired-Data How To Write Unmapped "Singles"
1
1
Entering edit mode
12.4 years ago
Gregor Rot ▴ 540

I am mapping pairs of reads and output not mapped pairs with:

-un-conc-gz filename

But i see only if both reads of the pair are not mapped they are written to the 2 generated files (at least i think so).

Is it possible to write single reads that don't map (when only one of the read of the pair is not mapped) to a separate file?

Thanks, Gregor

bowtie2 • 3.4k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode
12.4 years ago
kstamm ▴ 50

You should scan the final accepted_hits.bam and write out any with the flag set specifying unpaired. This is part of samtools, you should become familiar with samtools for this sort of thing.

http://samtools.sourceforge.net/samtools.shtml

This code will keep reads with the "2" flag

samtools view -f 2 in.bam > out.bam

You might also want the "8" flag; see the samtools documentation I linked for a table of what these mean.

This procedure will take some time to scan over the whole file, but it's really the only way to collect the reads you're interested in. The opposite flag can be used in a second step to make an output bam of just the properly paired reads.

ADD COMMENT

Login before adding your answer.

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