Merging BAM vs concatenate FASTQ
1
0
Entering edit mode
3.8 years ago
nhaus ▴ 360

Hi,

i am fairly new to bioinformatics (genomics to be specific) so excuse me if this is a straight forward question.

I have perforemd paired end WES which was performed across different lanes, so I have 2 fastq files per sample (4 in total).

I know that I can merge BAM files after aligning each fastq like this:


bwa mem  lane1_R1.fq lane1_R2.fq | samtools view -o lane1.bam

bwa mem lane2_R1.fq lane2_R2.fq | samtools view -o lane2.bam

samtools merge merged.bam lane1.bam lane2.bam

If you dont care about read groups or potential batch effects, is it also possible to just concatenate lane1_R1 and lane2_R1 and then do the alignment, so something like this:


cat lane1_R1.fq lane2_R1.fq > WES_R1.fq

cat lane1_R2.fq lane2_R2.fq > WES_R2.fq

bwa mem WES_R1.fq WES_R2.fq

If anyone could tell me what the "best practice" for this is, I'd be very thankful!

Cheers!

sequencing genome • 2.7k views
ADD COMMENT
0
Entering edit mode

Good question! I don't see this as a rule of what you have to do... I like to concatenate all my R1 and R2 files before alignment. But it should be fine to align your BAM files also!

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode
3.8 years ago
GenoMax 143k

It should be fine to merge the files before alignment. Processing individual sequence files can allow you to process your data in parallel in case you have access to a compute cluster.

ADD COMMENT
0
Entering edit mode

If you merge, however, make sure you document that properly. I am currently dealing with legacy data, where someone seems to have merged different runs (different instruments, different library types). While this doesn't seem to have an effect on our processing, it is still very confusing.

Also, I see you're having uncompressed data. "Best practice" would be to have the fastqs compressed and you can even concatenate gzipped files (with cat) without decompressing them first.

ADD REPLY
0
Entering edit mode

Indeed, document everything in, e.g., a README file.

ADD REPLY

Login before adding your answer.

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