Hi @Pierre Lindenbaum I did as per your suggetion, and I got the error as depth: invalid option -- 'H' So I changed my code to parse just one sample. But I got the same error.
My code for one sample is: for RG in Sample1; do samtools view -u -r ${RG} input.bam | samtools depth -a -H -o {RG}.depth.txt; done
With the code samtools view -u -r Sample1 input.bam > Sample1.bam the ouput file is not empty. I am really stuck at this point.
Thank you for your help.
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
-Hin 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?
yes
you can always redirect the output instead of using
-oInstall latest
samtoolsusingcondaif 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.bamaside from the header? Is your read-group calledSampl1in 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.