Extract reads by type +/-
2
0
Entering edit mode
7.8 years ago
ksadree • 0

Dear all,

I am trying to extract reads from a bam file that align to genes in one direction only; using samtools. See image:

https://postimg.org/image/inh0uxq9z/

The reads to extract are circled.

thanks for your help!

RNA-Seq alignment next-gen • 2.0k views
ADD COMMENT
0
Entering edit mode

How was the mapping done? The process will be different for genome versus transcriptome mapping.

ADD REPLY
0
Entering edit mode

Reads were aligned against transcriptome with Bowtie2

ADD REPLY
0
Entering edit mode
7.8 years ago
mbk0asis ▴ 680

check this page

ADD COMMENT
0
Entering edit mode

I tried something like that, but it extracts only + or - reads. I am interested in reads that coincide with the direction for the gene. thanks.

ADD REPLY
0
Entering edit mode

Since you mapped to the transcriptome, all + reads will be in the same direction as the gene, and minus reads will be in the opposite direction. It only gets complicated when you map to the genome. You can also use BBMap's SplitSam tool for this purpose:

splitsam.sh mapped.sam plus.sam minus.sam unmapped.sam

This will produce 3 output files from the input file "mapped.sam", such that "plus.sam" contains reads in the forward direction, and "minus.sam" contains reverse-direction reads.

P.S. It works on bam files as well, if samtools is installed.

ADD REPLY
0
Entering edit mode
7.8 years ago

In .bam format, reads which are aligned in the reverse direction have the '16' flag set, reads in the forward do not. samtools view can pull out reads based on whether or not they have the 16 flagged.

ADD COMMENT

Login before adding your answer.

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