samtools depth -r
0
0
Entering edit mode
12 months ago
lz1903 • 0

Hi,

I am using samtools to compute depth at a specific region. Here is my code:

samtools depth 1.bam 2.bam 3.bam -b 1.bed


the bed file is like this:

#chrom start end
1 1000 2000


this command output depth at each locus which is not I want.

I tried

samtools depth 1.bam 2.bam 3.bam -r 1:1000-2000


which output same result.

I am really confused how can I output the average depth. There should be only 1 value for each bam file.

WGS • 467 views
0
Entering edit mode

Why don't you try to use bedtools genomecov instead? -d option, will report the coverage at every position in your BAM file. And you can also use your BED file with target regions of interest

0
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (text becomes text), or select a chunk of text and use the highlighted button to format it as a code block. If your code has long lines with a single command, break those lines into multiple lines with proper escape sequences so they're easier to read and still run when copy-pasted. I've done it for you this time.

0
Entering edit mode

Thanks Ram. Will do that next time.