Skip to content

Instantly share code, notes, and snippets.

@Yixf-Self
Forked from stephenturner/exome-coverage-multi.sh
Created December 27, 2018 02:26
Show Gist options
  • Save Yixf-Self/057f74c9a800a2dc23c12994194f82c0 to your computer and use it in GitHub Desktop.
Save Yixf-Self/057f74c9a800a2dc23c12994194f82c0 to your computer and use it in GitHub Desktop.
run bedtools coverage on multiple files using GNU parallel
# Set up to run in GNU parallel.
find *bam | parallel 'bedtools coverage -hist -abam {} -b target_regions.bed | grep ^all > {}.hist.all.txt'
# What this actually runs:
bedtools coverage -hist -abam samp.01.bam -b target_regions.bed | grep ^all > samp.01.bam.hist.all.txt
bedtools coverage -hist -abam samp.02.bam -b target_regions.bed | grep ^all > samp.02.bam.hist.all.txt
bedtools coverage -hist -abam samp.03.bam -b target_regions.bed | grep ^all > samp.03.bam.hist.all.txt
bedtools coverage -hist -abam samp.05.bam -b target_regions.bed | grep ^all > samp.05.bam.hist.all.txt
bedtools coverage -hist -abam samp.06.bam -b target_regions.bed | grep ^all > samp.06.bam.hist.all.txt
bedtools coverage -hist -abam samp.10.bam -b target_regions.bed | grep ^all > samp.10.bam.hist.all.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment