1
$\begingroup$

I am using bedtools 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, 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

Last 5 lines:

Last 5 Lines

Thank you in advance

$\endgroup$
4
  • 1
    $\begingroup$ 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. $\endgroup$
    – Alexlok
    Commented Nov 7, 2022 at 19:06
  • $\begingroup$ 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 $\endgroup$
    – Dandelion
    Commented Nov 8, 2022 at 12:43
  • 1
    $\begingroup$ 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. $\endgroup$
    – Alexlok
    Commented Nov 8, 2022 at 20:16
  • $\begingroup$ Thank you so much for that. You are absolutly right and I got totally confused. $\endgroup$
    – Dandelion
    Commented Nov 9, 2022 at 10:54

1 Answer 1

1
$\begingroup$

Found it, it is an extended .bed file format, so not specific to bedtools output: source bed file output. With 4 added columns to the end from bedtools -hist option: bedtools -hist option

$\endgroup$
1
  • $\begingroup$ Thanks for posting the answer, appreciated. $\endgroup$
    – M__
    Commented Nov 7, 2022 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.