Samtools Depth Option For More Than One Bam Files
1
1
Entering edit mode
9.0 years ago
Maria333 ▴ 20

Hi everyone,

I've been stuck on this for several days. I want to use the samtools depth command but not only for a single bam file. I need to find a way to include all my bam files downloaded in the command.

Has anyone got an idea of how i can do this??

samtools • 6.9k views
3
Entering edit mode
9.0 years ago

The usage says that you can link multiple files, make sure the specify the options before the bam files

Usage: samtools depth [options] in1.bam [in2.bam [...]]
Options:
-b <bed>            list of positions or regions
-f <list>           list of input BAM filenames, one per line [null]
-l <int>            minQLen
-q <int>            base quality threshold
-Q <int>            mapping quality threshold
-r <chr:from-to>    region

1
Entering edit mode

Be warned though, samtools depth (at least as of version 1.1-30-g7f47a7c) doesn't combine the depth info across bam files for samples (same SM tag) occurring in multiple files.
I expected it to output one column per sample since most other commands work that way, but instead it outputs one column per bam file.

0
Entering edit mode

Hey, If my command is :

samtools depth -a -f list.txt > all.depth


and list.txt looks like this:

F1.bam
F2.bam
...
F10.bam


Is samtools output in the same order?

I mean is the third column F1.bam, the fourth F2.bam, and so on?