# Splitting .bam files into separate samples for tophat2

I have RNA seq data of 12 samples (paired end, so 24 files) and I ran tophat2 for alignment on all of them which gave me one bam file for all the samples. Now I need separate bam files for all the samples. Can I spilt them from the one I have or I have to do tophat2 for all the samples separately? If yes, how to do it.

I need them for FRASER (splicing detction) I would also appreciate if anyone used FRASER before could help me a bit to get started. I am working with plant data for the first time.

The command I used

tophat2 -p 40 \
-o tophat_output_final bowtie_indexes/Medicago1/Medicago \
NRNSA_S103_R1_001.fastq.gz,NRNSB_S107_R1_001.fastq.gz,\
NRNSC_S111_R1_001.fastq.gz,NRSA_S104_R1_001.fastq.gz,\
NRSB_S108_R1_001.fastq.gz,NRSC_S112_R1_001.fastq.gz,\
RNSA_S105_R1_001.fastq.gz,RNSB_S109_R1_001.fastq.gz,\
RNSC_S113_R1_001.fastq.gz,SRAB_S106_R1_001.fastq.gz,\
SRB_S110_R1_001.fastq.gz,SRC_S114_R1_001.fastq.gz \
NRNSA_S103_R2_001.fastq.gz,NRNSB_S107_R2_001.fastq.gz,\
NRNSC_S111_R2_001.fastq.gz,NRSA_S104_R2_001.fastq.gz,\
NRSB_S108_R2_001.fastq.gz,NRSC_S112_R2_001.fastq.gz,\
RNSA_S105_R2_001.fastq.gz,RNSB_S109_R2_001.fastq.gz,\
RNSC_S113_R2_001.fastq.gz,SRAB_S106_R2_001.fastq.gz,\
SRB_S110_R2_001.fastq.gz,SRC_S114_R2_001.fastq.gz

• Did you assign read groups while aligning? Can you add the command that you used with tophat2? Aug 14 at 18:40
• Hi Wouter De Coster, I have added the command in the question itself. I don't know what you mean by assigning read groups? Aug 16 at 2:08
• The way you aligned them you can not split them in separate samples. You should have run Tophat2 for each sample separately. Aug 16 at 18:06
• Thank you, Wouter De Coster I have 3 replicates of each treatment. so 4 treatments x 3 replicates =12 files. Should I merge the replicates or just go for separate alignment for each sample? Aug 17 at 1:53
• Yes, separate alignments for each (biological) replicate Aug 17 at 19:22