<p>Found it, it is an extended .bed file format, so not specific to bedtools output: <a href="http://www.ensembl.org/info/website/upload/bed.html#optional" rel="nofollow noreferrer">source bed file output</a>.
With 4 added columns to the end from bedtools -hist option:
<a href="https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html" rel="nofollow noreferrer">bedtools -hist option</a></p>

CC BY-SA 4.0
2022-11-07T14:25:37.627Z
Thanks for posting the answer, appreciated.
M__
CC BY-SA 4.0
2022-11-07T13:27:50.730Z
2022-11-07T13:27:50.730Z
Dandelion
<p>I am using <a href="https://bedtools.readthedocs.io/en/latest/index.html#" rel="nofollow noreferrer">bedtools</a> to caculate the coverage of my targets of my WES data, to later plot. But to plot, I need to know what to plot and what it is I am seeing. I have unsuccefully tried to find what exactly the columns are in the output of the <a href="https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html#" rel="nofollow noreferrer">bedtool coverage</a>, and how to read them. Also, the documentation does not help me a lot, and I find it confusing. Does anyone know, or where to find this a bit more elaboratly explained?</p>
<p>I used the following code:</p>
<p><code>bedtools coverage -hist -abam input.bam -b input.bed &gt; output &gt;2 log</code></p>
<p><strong>Correction note</strong>: the code above is actually wrong (thanks to @Alexlok) and should be:
<code>bedtools coverage -hist -a input.bed -b input.bam &gt; output 2&gt; log</code></p>
<p>And the output is (first line):</p>
<p><a href="https://i.sstatic.net/M2fdP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/M2fdP.png" alt="First 5 lines" /></a></p>
<p>Last 5 lines:</p>
<p><a href="https://i.sstatic.net/008DK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/008DK.png" alt="Last 5 Lines" /></a></p>
<p>Thank you in advance</p>

CC BY-SA 4.0
2022-11-07T19:06:09.950Z
Make sure that you're not following a script written for bedtools version < 2.24: the inputs `a` and `b` are inverted in recent versions. So on a recent version of bedtools, if you want to count the read coverage of your features, you need: `bedtools coverage -a input.bed -b input.bam`. Your current command counts the number of features in `b` that intersect each read in `a`, and I'm not sure that what you want to do.
Alexlok
CC BY-SA 4.0
2022-11-08T12:43:07.750Z
I am following workflows for exome coverage probally indeed using <2.24, since they were published a while ago... not finding any new versions. I want to see how much of the exome targets (bed file) are actually captured by my reads indeed. I use `-abam` (my aligned reads to the reference genome) and `-b` (my target bed file) option? So I am not actually using the `-a` option. Does it also count then? Thanks
Dandelion
CC BY-SA 4.0
2022-11-08T20:16:17.473Z
If I understand correctly (I have only used bedtools a bit, no expert on that), on older versions (before 2.19.0) `-a` would have expected a bed file, so `-abam` made explicit that it was a bam. But on more recent versions, `-a` and `-b` automatically detect the input type, so `-abam` is synonym with `-a` (kept for compatibility). And since version 2.24 the options `a` and `b` are inverted, so you would need a `-bbam` (which does not exist since `-b` covers that use case). See the example in [the page you linked](https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html).
Alexlok
CC BY-SA 4.0
2022-11-09T10:54:07.557Z
Thank you so much for that. You are absolutly right and I got totally confused.
Dandelion
<sequence-analysis><bedtools><coverage><exome>
What are the columns in bedtools coverage output hist file?
# What are the columns in bedtools coverage output hist file?

(Asked by: username_0 on 2022-11-04)

I am using [bedtools](https://bedtools.readthedocs.io/en/latest/index.html#) to caculate the coverage of my targets of my WES data, to later plot. But to plot, I need to know what to plot and what it is I am seeing. I have unsuccefully tried to find what exactly the columns are in the output of the [bedtool coverage](https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html#), and how to read them. Also, the documentation does not help me a lot, and I find it confusing. Does anyone know, or where to find this a bit more elaboratly explained?

I used the following code:

`bedtools coverage -hist -abam input.bam -b input.bed > output >2 log`

**Correction note**: the code above is actually wrong (thanks to @Alexlok) and should be:
`bedtools coverage -hist -a input.bed -b input.bam > output 2> log`

And the output is (first line):

[![First 5 lines](https://i.sstatic.net/M2fdP.png)](https://i.sstatic.net/M2fdP.png)

Last 5 lines:

[![Last 5 Lines](https://i.sstatic.net/008DK.png)](https://i.sstatic.net/008DK.png)

Thank you in advance

**Tags:** sequence-analysis, bedtools, coverage, exome
> **Comments:**
> **username_1**: Make sure that you're not following a script written for bedtools version < 2.24: the inputs `a` and `b` are inverted in recent versions. So on a recent version of bedtools, if you want to count the read coverage of your features, you need: `bedtools coverage -a input.bed -b input.bam`. Your current command counts the number of features in `b` that intersect each read in `a`, and I'm not sure that what you want to do.  
> **username_0**: I am following workflows for exome coverage probally indeed using <2.24, since they were published a while ago... not finding any new versions. I want to see how much of the exome targets (bed file) are actually captured by my reads indeed. I use `-abam` (my aligned reads to the reference genome) and `-b` (my target bed file) option? So I am not actually using the `-a` option. Does it also count then? Thanks  
> **username_1**: If I understand correctly (I have only used bedtools a bit, no expert on that), on older versions (before 2.19.0) `-a` would have expected a bed file, so `-abam` made explicit that it was a bam. But on more recent versions, `-a` and `-b` automatically detect the input type, so `-abam` is synonym with `-a` (kept for compatibility). And since version 2.24 the options `a` and `b` are inverted, so you would need a `-bbam` (which does not exist since `-b` covers that use case). See the example in [the page you linked](https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html).  
> **username_0**: Thank you so much for that. You are absolutly right and I got totally confused.  

---

## 1 answers

### Answer by username_0 on 2022-11-07. Score: 1 | Accepted answer

Found it, it is an extended .bed file format, so not specific to bedtools output: [source bed file output](http://www.ensembl.org/info/website/upload/bed.html#optional).
With 4 added columns to the end from bedtools -hist option:
[bedtools -hist option](https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html)

> **Comments:**
> **username_2**: Thanks for posting the answer, appreciated.  

---

