This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools depth -r

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.

Thanks in advance!

wgs

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

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.
code_formatting

Thanks Ram. Will do that next time.

0 answers

No answers yet.

Log in to answer this question.