Split paired-end reads BAM file into Forward and Reverse Strands
2
0
Entering edit mode
3.3 years ago
GA • 0

Hello,

I’m trying to split BAM files with paired-end reads into forward and reverse strands. I know samtools view -F 16 and samtools view -f 16 separates into forward and reverse strands, but I’ve read in some forums that it doesn’t deal well with paired-end reads. What other methods would people recommend for paired-end reads?

Thank you for your help!

RNA-seq BAM • 4.0k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode

Thank you! I will look into his approach.

ADD REPLY
0
Entering edit mode

I've read the tutorial you sent me and I have a question that you might know the answer to. I'm trying to understand how the SAM flags work in the script from the tutorial. My original SAM file has flags: 99, 147, 163, and 83, but this script uses flags: 128, 80, 144, and 64. Do you know the difference between these flags? Would the split.sh script still separate my BAM file into forward and reverse strands with the flags it lists or should I edit the script to reflect my flags (99, 147, 163, 83)? Thank you for your help!!

ADD REPLY
0
Entering edit mode

to see how flag works: https://broadinstitute.github.io/picard/explain-flags.html

Basically, you do not need to change the flags because they are not exclusive. For instance, if you ask for flag 64, it will also includes flag 83.

ADD REPLY
0
Entering edit mode

Thank you for the explanation!! I appreciate it!

ADD REPLY
0
Entering edit mode
3.3 years ago

I'm not sure what you mean by "doesn't deal well". In almost every case, one read will align in the forward direction, and the other in reverse, so if everything is working right, every pair should be split between the two directions.

ADD COMMENT
0
Entering edit mode
3.3 years ago

If you want an alternative way, you may sort the bam files by read-names and then convert bam files into fastq files using Samtools. After that, you can split the fastq files to forward and reverse read files by a simple bash script(or python whatever you feel comfortable with).

ADD COMMENT
0
Entering edit mode

Thanks for the advice!

ADD REPLY

Login before adding your answer.

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