how to read indexed bamfiles
1
0
Entering edit mode
7.1 years ago
onemore100iq ▴ 20

I am trying to calculate depth by region using samtools depth command to extract depth information for specific region in chromosome_3 in a bam file.bam I indexed the bam file using samtools index bamfile.bam to bamfile.bam.bai when I typed samtools depth -r chromosome_3:10001-10010 bamfile.bam.bai
it gave erorr : could not open "bamfile.bam.bai" : Success how it could not open the bam.bai file and count it as success?

any help would be highly apprciated

next-gen • 3.0k views
ADD COMMENT
0
Entering edit mode

Was this bam files sorted before it was indexed?

ADD REPLY
0
Entering edit mode

yes. and it worked now thanks

ADD REPLY
0
Entering edit mode

You could have a look at https://github.com/brentp/mosdepth

ADD REPLY
3
Entering edit mode
7.1 years ago

samtools depth -r chromosome_3:10001-10010 bamfile.bam.bai

You should point samtools to the bam file, not the index file.

ADD COMMENT
1
Entering edit mode

Correctly said by Chris, Input requirement for samtools depth is .bam file not .bai (indexed) file

samtools depth -r <chr:from-to> .bam

Above command should work. (Also make sure that .bam and .bai are in the same directory)

ADD REPLY
0
Entering edit mode

Thanks i did as u said and it worked. Thank u so much

ADD REPLY
0
Entering edit mode

Thanks Chris, it worked. La

ADD REPLY

Login before adding your answer.

Traffic: 2615 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6