And it is not working :/
"It is not working" is not really helpful, copy the error message, or, if no error message, explicitly say "there is no error message and bedtools produces an empty file", or something to this effect.
Anyway, I believe your command should be:
bedtools coverage -a file.bam -b file.gff
As per documentation:
As of version 2.24.0, the coverage tool has changed such that the coverage is computed for the A file, not the B file.
edit:
You are right, the command I gave above is the opposite of what you want. You really want
bedtools coverage -a file.gff -b file.bam
Regarding the error you got (slurmstepd: error: task/cgroup: unable to add task[pid=XXXXXXX] to memory cg '(null)
), it is related to excessive memory use. You can ask for more memory or try different queue. If you sort both bam and gff, you can pass the argument -sorted
to bedtools, which is both faster and uses less memory.
May it work if I convert the bam to bed?
Yes, should work both with bam or bed.
Not working is a tremendously detailed description. Please elaborate.
Please use the formatting bar (especially the
code
option) to present your post better. I've done it for you this time.I run the code and nothing happens, however when I do:
screenshot: https://ibb.co/jcpTtd
I get results but not the ones I want. It generates the coverage of features in the .gff on the features in the .bam and I want the opposite
bam files do not have features, they have reads / sequences mapped.
I am not sure what you want, could you explain? Maybe bedtools intersect can do what you want?
Ok I want to know how many reads from the .bam overlap with each of the positions I have on my .gff.
I tried bedtools intersect as well, and it is the same.
May it work if I convert the bam to bed?
Thanks in advance
Regarding the error message posted as an image (which should be avoided, it is better to copy / paste the text of the message), see this:
https://sites.google.com/a/case.edu/hpc-upgraded-cluster/cluster-faq/running-jobs#TOC-The-job-I-started-stops-terminates-fails-in-the-middle