Merging CRAM files in a specified genomic interval using an input list
Entering edit mode
11 weeks ago
flo24 ▴ 20


I usually merge BAM files in a specified interval from a list of files like so:

samtools merge -R "chr1:0-100000" -b bam_files_list.txt -u -o - | command2

However, this command fails when I use a list of CRAM files; the samtools documentation says -b must be a list of input BAM files.

Is there a way to merge from a list of CRAM files using samtools?

Thank you.

samtools • 258 views
Entering edit mode

this command fails when I use a list of CRAM files;

what's the error ?

what in bam_file_list.txt ? did you use full paths ? are the bam files indexed ?version of samtools, etc...

Entering edit mode

Mostly when the documentation states BAM, it means SAM, BAM or CRAM. Historically the code had explicit commands that only worked on SAM or only worked on BAM. We changed all of that to be agnostic, bar specific things such as file concatenation and reheader, which are very different operations per type of file.

How many files are in your list? CRAM reading has a higher memory footprint as the block size is bigger. If you have many thousands of files, that may become an issue.

When reporting issues like this, please always report the version of the tool you're using (eg from samtools version), and the actual error message. People cannot help you if you don't give enough information to diagnose the fault.


Login before adding your answer.

Traffic: 1965 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6