sam=$1
bedgraph=$(echo $sam | sed 's/.bam/.bedgraph/g')
bw=$(echo $sam | sed 's/.bam/.bw/g')


echo "make index file"
samtools index $1
echo "Create BedGraph coverage file"
/data/hannon/gordon/usr/bin/genomeCoverageBed -bg -ibam $1 -g /data/zhang/makerman/SOLEXA/bedToBrowser/INDEX/hg18_chromInfo.txt > $bedgraph
echo "Convert the BedGraph file to BigWig"
/data/hannon/gordon/usr/bin/bedGraphToBigWig $bedgraph /data/zhang/makerman/SOLEXA/bedToBrowser/INDEX/hg18_chromInfo.txt $bw
