I am using samtools depth to get read depth at each position from the bam file which I have after doing alignment. I used the command: samtools depth -a -H input.bam -o output_duplicates
Since my bam file comprise more than one sample, how samtools depth will calculate the read depth? The output file I have consist of three columns with the first column chromosome, second position and third read depth.
Thank you in advance
Hi, I highly appreciate any help at this point.
What do you see for the following?
Hi @GenoMax samtools that I have is of 1.3.1 version. I see: samtools 1.3.1 Using htslib 1.3.1
yes it's too old. I added the option
-H
in https://github.com/samtools/samtools/pull/937 sept 2018.while 1.3.1 is 2016 https://github.com/samtools/samtools/releases/tag/1.3.1
Hi,
Knowing that -H option is not so important as it is for header, I just ran the code without it. for RG in SAMPLE; do samtools view -u -r ${RG} input.bam | samtools depth -a -o {RG}.depth.txt; done
Now the error I have is: depth: invalid option -- 'o'
Is it because of the old version of samtools I am using?
you can always redirect the output instead of using
-o
Install latest
samtools
usingconda
if you are not able to upgrade the main install.-I did install latest version of samtools:
Then I tried to split the original .bam file by using one sample
Then I used
But I see that in Sample1_bam_depth it's only printing header as
I don't understand what I am missing at this point.
Is there data in
Sample1.bam
aside from the header? Is your read-group calledSampl1
in your file.I found the error. It was the RG I was missing up, and it just printed header to my bam file. Now, I am able to run samtools depth. Thank you.
yes