Entering edit mode
7 weeks ago
User000 ▴ 640
I need to get a per read depth coverage for mytest.chrM.bam file. I extract chrM from a whole genome file like this:
samtools view test.wgs.bam chrM -b > test.chrM.bam
When I try to calculate the coverage I get an error:
##### ERROR MESSAGE: Badly formed genome location: Contig chr1 given as location, but this contig isn't present in the Fasta sequence dictionary
This is how I calculate the coverage. I guess the problem is in the bam file header, but how to solve this problem?
java -Djava.io.tmpdir=/home/tmp -Xmx2g -jar /path/to/GenomeAnalysisTK.jar -T DepthOfCoverage -R chrM.fa -I test.chrM.bam -o test.chrM.stat -nt 3
What happens if you use the whole genome fasta? I think the issue may be that in the bam header you have all chromosomes, but in the fasta you have only the mitochondrion.