Skip to content

Instantly share code, notes, and snippets.

@srividya22
Created February 2, 2018 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srividya22/13f18be50692b931e1a03ba1ccacbfbf to your computer and use it in GitHub Desktop.
Save srividya22/13f18be50692b931e1a03ba1ccacbfbf to your computer and use it in GitHub Desktop.
Links:
http://quinlanlab.org/tutorials/bedtools/bedtools.html
Use Case 1: Given a.bam and b.regions.bed. how to get the parts of b.regions.bed that are not covered by a.bam?
Answer:
bedtools genomecov -ibam aln.bam -bga \
| awk '$4==0' |
| bedtools intersect -a regions -b - > foo
Option -bga Report depth in BedGraph format, as above (i.e., -bg). However with this option, regions with zero coverage are also reported. This allows one to quickly extract all regions of a genome with 0 coverage by applying: “grep -w 0$” to the output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment