This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merge and fixmate of multiple BAM files generated from pair-end DNA sequences

Dear All,

I have multiple name-sorted BAM files generated from pair-end DNA sequences which look like: R1-1.bam, R1-2.bam, ..., R2-1.bam, R2-2.bam, ..., and I am going to do SNP calling. Before SNP calling, I am not sure if I have to merge them together and then fill them in mate coordinates just like:

# Merge multiple name-sorted BAM files into one single BAM file. The option, -n,
# indicates the input files are sorted by read names rather than by chromosomal coordinates
samtools merge -n merged.bam *bam

# Fill the merged BAM file in mate coordinates
samtools fixmate -O bam merged.bam fixmated.bam
# Or piped above commands as
samtools merge - *bam | samtools fixmate -O bam - fixmated.bam

Could you please give me some comments or suggestions? Thank you in advance.

Best regards

snp

Given the example file names (not to mention the usage of fixmat and name-sorted files), I suspect that you did the mapping incorrectly. Before tackling your actual question, could you please briefly outline how you did your alignments?

No problem for the mapping. It's a Hi-C data and each side of the pair-end reads was mapped separately.

Ah, Hi-C data would make sense, then. We use an internal tool (that should be made public fairly soon) for these purposes. The general method is to ensure that the order of the reads in the BAM files is the same and write a little script (typically in python) to re-pair the mates. You could name sort, merge, and run fixmate, but that process would take longer.

A possibly better question is why you're trying to use Hi-C data to call variants. That's really not an ideal situation.

0 answers

No answers yet.

Log in to answer this question.