Skip to content

Instantly share code, notes, and snippets.

@klmr
Created February 20, 2013 15:38
Show Gist options
  • Save klmr/4996432 to your computer and use it in GitHub Desktop.
Save klmr/4996432 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
source ~/.config/extpaths # For samtools
set -e
set -u
n=0
for bam in $*; do
out="${bam%.bam}.bgr.gz"
let n=n+1
echo "$bam $out"
bsub -J test-$n "
echo 'track type=bedGraph' > \"$out\"
samtools view \"$bam\" | while read qname flag chr pos mapq cigar rnext pnext tlen seq; do
let start=\$pos-1
end=\$pos+\${#seq}
echo \"\$chr \$start \$end\"
done | gzip -c >> \"$out\""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment