Mercurial > repos > jbrayet > maketssdist_histones_1_0_docker
changeset 0:88a8e2392731 draft
Uploaded
| author | jbrayet |
|---|---|
| date | Mon, 04 Jan 2016 10:21:43 -0500 |
| parents | |
| children | 635bfae8de52 |
| files | makeTSSdist_wrapper_hist.sh |
| diffstat | 1 files changed, 81 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makeTSSdist_wrapper_hist.sh Mon Jan 04 10:21:43 2016 -0500 @@ -0,0 +1,81 @@ +#!/bin/bash + +REG="NA" +CONTROLFILE="NA" + +while getopts "f:c:l:o:r:u:v:e:p:" optionName; do +case "$optionName" in + +f) CHIPFILE="$OPTARG";; +c) CONTROLFILE="$OPTARG";; +l) STEP="$OPTARG";; +r) RIGHT="$OPTARG";; +o) OUTPUT="$OPTARG";; +u) OUTSTAT="$OPTARG";; +v) GENOME="$OPTARG";; +e) REG="$OPTARG";; +p) PDF="$OPTARG";; + +esac +done + +LOGTMP=$OUTPUT.log.tmp + +#LOGTMP=/data/tmp/log.tmp + +#echo $LOGTMP +#echo "$@" + +echo "$@" >> $LOGTMP + +LOCAL_DIR=`( cd -P $(dirname $0); pwd)` +DOCKER_PATH='/usr/bin/maketssdist_histones' + + +OUTPUT_DIR=`dirname $OUTPUT` +R_PATH='/usr/bin/R-3.1.0/bin/Rscript --slave ' + +databasePath=$(find / -type d -name files | grep database) + +mkdir -p $databasePath/nebulaAnnotations +mkdir -p $databasePath/nebulaAnnotations/noIdenticalTransc +nebulaAnnotationPath=$databasePath/nebulaAnnotations +[ ! -f $nebulaAnnotationPath/noIdenticalTransc/$GENOME.noIdenticalTransc.txt ] && curl -s -o $nebulaAnnotationPath/noIdenticalTransc/$GENOME.noIdenticalTransc.txt -L https://github.com/jbrayet/nebula_tools_docker/raw/master/tools_data/noIdenticalTransc/$GENOME.noIdenticalTransc.txt + +noIdenticalTranscPath=$nebulaAnnotationPath/noIdenticalTransc + +if [ -r $REG ]; then + echo "1: perl $DOCKER_PATH/crossBedWithGenes_hist.pl -g $noIdenticalTranscPath/$GENOME.noIdenticalTransc.txt -f $CHIPFILE -reg $REG -o $OUTPUT.annotated" >> $LOGTMP + perl $DOCKER_PATH/crossBedWithGenes_hist.pl -g $noIdenticalTranscPath/$GENOME.noIdenticalTransc.txt -f $CHIPFILE -reg $REG -o $OUTPUT.annotated >> $LOGTMP 2>> $LOGTMP + else + echo "2: perl $DOCKER_PATH/crossBedWithGenes_hist.pl -g $noIdenticalTranscPath/$GENOME.noIdenticalTransc.txt -f $CHIPFILE -reg $REG -o $OUTPUT.annotated" >> $LOGTMP + perl $DOCKER_PATH/crossBedWithGenes_hist.pl -g $noIdenticalTranscPath/$GENOME.noIdenticalTransc.txt -f $CHIPFILE -o $OUTPUT.annotated >> $LOGTMP 2>> $LOGTMP +fi + +if [ -r $CONTROLFILE ]; then + #create a subset of control peaks (highest peaks, the same number as in the sample) + echo " perl $DOCKER_PATH/createControlPeakSubSet.pl -f $CHIPFILE -c $CONTROLFILE -o ${OUTPUT_DIR}/control.tmp" >>$LOGTMP + perl $DOCKER_PATH/createControlPeakSubSet.pl -f $CHIPFILE -c $CONTROLFILE -o ${OUTPUT_DIR}/control.tmp >>$LOGTMP 2>>$LOGTMP + if [ -r $REG ]; then + perl $DOCKER_PATH/crossBedWithGenes_hist.pl -g $noIdenticalTranscPath/$GENOME.noIdenticalTransc.txt -f ${OUTPUT_DIR}/control.tmp -reg $REG -o $OUTPUT.control.annotated >> $LOGTMP 2>> $LOGTMP + else + perl $DOCKER_PATH/crossBedWithGenes_hist.pl -g $noIdenticalTranscPath/$GENOME.noIdenticalTransc.txt -f ${OUTPUT_DIR}/control.tmp -o $OUTPUT.control.annotated >> $LOGTMP 2>> $LOGTMP + fi + echo "3: cat $DOCKER_PATH/makeTSSdist_hist.R | R --slave --args $STEP $RIGHT $OUTPUT.annotated $OUTPUT $OUTSTAT $OUTPUT.control.annotated $PDF" >> $LOGTMP + cat $DOCKER_PATH/makeTSSdist_hist.R | R --slave --args $STEP $RIGHT $OUTPUT.annotated $OUTPUT $OUTSTAT $OUTPUT.control.annotated $PDF >>$LOGTMP 2>>$LOGTMP +else + echo "4: cat $DOCKER_PATH/makeTSSdist_hist.R | R --slave --args $STEP $RIGHT $OUTPUT.annotated $OUTPUT $OUTSTAT $PDF 2>>$LOGTMP" >>$LOGTMP + cat $DOCKER_PATH/makeTSSdist_hist.R | R --slave --args $STEP $RIGHT $OUTPUT.annotated $OUTPUT $OUTSTAT $PDF 2>>$LOGTMP >>$LOGTMP +fi + +if [ -r $LOGTMP ]; then + rm $LOGTMP +fi + +rm $OUTPUT.annotated* + +if [ -r $CONTROLFILE ]; then + rm $OUTPUT.control.annotated* + rm ${OUTPUT_DIR}/control.tmp +fi +
