Skip to content

Instantly share code, notes, and snippets.

@crazyhottommy
Last active November 18, 2015 00:38
Show Gist options
  • Save crazyhottommy/b38bed2fa9d7060806e4 to your computer and use it in GitHub Desktop.
Save crazyhottommy/b38bed2fa9d7060806e4 to your computer and use it in GitHub Desktop.
#! /bin/bash
for bam in *bam
do
echo $bam
genomeCoverageBed -ibam $bam -bg -g hg19.genome.info > $(basename $bam .bam).bdg
done
for bdg in *bdg
do
echo $bdg
bdg2bw $bdg hg19.genome.info
done
#!/bin/bash
# this script is from Tao Liu https://gist.github.com/taoliu/2469050
# check commands: slopBed, bedGraphToBigWig and bedClip
which bedtools &>/dev/null || { echo "bedtools not found! Download bedTools: <http://code.google.com/p/bedtools/>"; exit 1; }
which bedGraphToBigWig &>/dev/null || { echo "bedGraphToBigWig not found! Download: <http://hgdownload.cse.ucsc.edu/admin/exe/>"; exit 1; }
which bedClip &>/dev/null || { echo "bedClip not found! Download: <http://hgdownload.cse.ucsc.edu/admin/exe/>"; exit 1; }
# end of checking
if [ $# -lt 2 ];then
echo "Need 2 parameters! <bedgraph> <chrom info>"
exit
fi
F=$1
G=$2
bedtools slop -i ${F} -g ${G} -b 0 | bedClip stdin ${G} ${F}.clip
bedGraphToBigWig ${F}.clip ${G} ${F/bdg/bw}
rm -f ${F}.clip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment