This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bedtools coverage confuses chromosomes

I have a problem running bedtools coverage (bedtools v2.26.0 ): my bed file is:

9   137618991   137619028   EHMT1   0   +  
Y   14056216    14056289    VCY1B   0   +

and my Genome File is:

1   248956422
10  133797422
11  135086622
12  133275309
13  114364328
14  107043718
15  101991189
16  90338345
17  83257441
18  80373285
19  58617616
2   242193529
20  64444167
21  46709983
22  50818468
3   198295559
4   190214555
5   181538259
6   170805979
7   159345973
8   145138636
9   138394717
GL000194.1  191469
GL000213.1  164239
KI270711.1  42210
KI270721.1  100316
KI270727.1  448248
KI270728.1  1872759
KI270734.1  165050
X   156040895
Y   57227415

Yet when I try to run bedtools coverage -sorted I get: Error: requested chromosome MT does not exist in the genome file notebook_resources_LARP7_transcription/GRCh38.dna.primary_assembly.Genome_File.txt. Exiting.
Did anyone else encounter this?
I know that it is the second line in the bed file that is a problem. The first runs through...

===========
My command is:

bedtools coverage -sorted -a bed -b bam -g Genome_File.txt > out.tsv;
software error alignment rna-seq

Hello,

please show us the complete command you are running.

Thanks.

fin swimmer

It should be just that the bed file has mitochondria entry whereas the genome file do not have an entry regarding that.

I have added the command above; Well, it should be but my bed file does not have MT entries...

Check the separators. MT is there in EHMT1 . Is the bed made in a Windows machine or so?

If so dos2unix might help

Also what about GRCh38.dna.primary_assembly.Genome_File.txt ?

1 answer

The header of the BAM file most likely contains MT. Simple add it to the genome file. You can check with samtools view -H your.bam. To make genome files that match BAMs, you can do:

## requires indexed BAM file:
samtools idxstats your.bam | cut -f1-2 | grep -v '\*' > Genome_File.txt

Log in to answer this question.