Created
May 2, 2013 11:26
-
-
Save pjbriggs/5501613 to your computer and use it in GitHub Desktop.
Utility script to create bigWig files from phastCons wig data files. Needs the chromosome sizes which can be obtained by doing e. "fetchChromSizes mm9 > mm9chromSizes". For each .data file in the specified directory, runs wigToBigWig to generate corresponding .bw file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
CHROMSIZE_FILE=$1 | |
if [ -z "$CHROMSIZE_FILE" ] ; then | |
echo "Usage: $0 CHROMSIZE_FILE [ DATA_DIR ]" | |
exit | |
fi | |
if [ -z "$2" ] ; then | |
DATA_DIR=`pwd` | |
else | |
DATA_DIR=$2 | |
fi | |
data_files=`ls $DATA_DIR/*.data` | |
for f in $data_files ; do | |
echo $f | |
bw=`basename $f` | |
bw=${bw%.*}.bw | |
if [ -f "$bw" ] ; then | |
echo "$bw already exists" | |
else | |
wigToBigWig -clip $f $CHROMSIZE_FILE $bw | |
if [ ! -f "$bw" ] ; then | |
echo "Failed to make $bw" | |
exit | |
fi | |
fi | |
done | |
## | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment