"-hist" is indeed what I need! Thank you. I don't have a BED file but I guess I can convert a GFF file to a BED file.
I have a single BAM file between a set of vectors and the bacterium genome. I would like to know the read depth of each genomic feature of the plasmid, and the median coverage of each plasmid. I would like to use bedtools coverage but I am finding difficulties applying it with my dataset as I only have one alignment file. I looked at FeatureCounts but as far as I could search, it retrieves the read counts. Is there a way to use bedtools coverage with a single bam file?
I hope you could help me out. Thank you in advance.
1 answer
Are your features and/or plasmids (vectors) described in a BED file? If so, you can query coverage overlaps in a straightforward way:
bedtools coverage -a features.bed -b alignments.bam
the number of alignment files (BAM files) is not relevant. However, to clarify, when say: "read depth of each genomic feature" what do you actually mean? Read depth can vary along features. You might be able to play with "-hist" option to easily get what you need.
Thank you so much! Just running bedtools coverage -a features.bed -b alignments.bam worked.
I assume the last four columns of that output retrieves:
depth of coverage, number of bases at that depth, size of the feature, and fraction covered.
Log in to answer this question.
hum... why is it a problem ? what did you try ?
Having just a BAM file was not enough and I didn't understand what parameters to include but the problem was solved.