UPDATE: Partly solved. It works without sorted option and now I do not need this option. However, the original question remains the same - how to calculate coverage from .bam file using -sorted
option. I added dummy region from MT to the .bed file - it did not work.
Have a problem with coverageBed. Run command:
covBed -d -sorted -b Sample.realigned.dm.recalibrated.bam -a srt.bed
Get output:
ERROR: Database file Sample.realigned.dm.recalibrated.bam contains chromosome , but the query file does not.
Please re-reun with the -g option for a genome file.
See documentation for details.
How to solve it? (coverageBed with -g option ? - was not really helpful). It works without -sorted
option.
My bed file chromosomes:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
X
Y
Bam file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
X
Y
MT
Upvote for providing data with your question this time :)
Also, please be aware that when a tool doesn't give an error, that doesn't mean it worked. It is your job as the analyst to make sure all your coordinates (BAM and BED) are exactly the same, otherwise they'll be a serious and non-obvious error in your data.
Going back to the map analogy, if I asked you to go to position "51.5072°N, 0.1275°W", and you used the Greenwhich Meridian, you'd end up in London. If however you used any of the other zero meridians (http://www.worldheritagesite.org/tags/tag433.html) you'd end up somewhere else - probably in the middle of an ocean. Make sure your coordinates match up, ideally by using the same reference file throughout.
I agree. But providing coordinates and using the wrong meridian should give you some answer. The tool should not crash when meridian is not Greenwhich. Tool should not care about it. It should make several steps starting from 0 and give result (right or wrong). In my case it does not do it.
John would probably argue that it's better to have a tool that doesn't drop you in the middle of the ocean when your intended destination is London...
Seriously, we're trying to share our experience and help you avoid an all-too-common error. Complaining that the tool 'should give you some answer' is counterproductive, and foolhardy if the answer is wrong. The tool is obviously designed to check if the maps agree, and they don't. It even provides a useful error message and recommended solution, which is better than a lot of software. If the tool doesn't perform the way that you think it should, then you're welcome to develop your own.
Thank you for the comments, I really appreciate your help. I am a tools' developer, the problem is that everybody was complaining on me that I re-invent wheels all the time, that's why I decided to use third-party tools where it is possible. As a developer I can not imagine a mechanism of checking if 2 references are the same for bam file and bed file, can you? Moreover, the coordinate system was the same, the reference was the same (look at the answer by dariober) and the tool worked well without sorted option (all probes, like 5% of the genome, was well-covered, and it could not happen with the wrong map). The problem was not in wrong coordinate system, the problem was "to explain tool that it should not complain and just do his job".