Commit 09f63c40 authored by nchernia's avatar nchernia
Browse files

Small updates to mega with exit codes; updating chmod modes of files

parent 6999168b
Loading
Loading
Loading
Loading
+1 −1
Changes for SLURM/scripts/statistics.pl: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ use vars qw/ $opt_s $opt_l $opt_d $opt_o $opt_q $opt_h /;
# Check arguments
getopts('s:l:o:q:h');

my $site_file = "/poscratch/aidenlab/juicer/restriction_sites/hg19_DpnII.txt";
my $site_file = "/projects/ea14/juicer/restriction_sites/hg19_DpnII.txt";
my $ligation_junction = "GATCGATC";
my $stats_file = "stats.txt";
my $mapq_threshold = 1;

UGER/scripts/collisions.awk

100644 → 100755
+0 −0

File mode changed from 100644 to 100755.

UGER/scripts/diploid_split.awk

100644 → 100755
+0 −0

File mode changed from 100644 to 100755.

+0 −0

File mode changed from 100644 to 100755.

+40 −31
Changes for UGER/scripts/mega.sh: 40 added lines, 31 removed lines.
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ if [ ! -e "$site_file" ] && [ "$site" != "none" ]
then
    echo "***! $site_file does not exist. It must be created before running this script."
    echo "The site file is used for statistics even if fragment delimited maps are excluded"
    exit 100
    exit 1
fi

## Directories to be created and regex strings for listing files
@@ -127,7 +127,7 @@ merged_count=`find -L ${topDir} | grep merged_nodups.txt | wc -l`
if [ "$merged_count" -lt "1" ]
then
	echo "***! Failed to find at least one merged_nodups files under ${topDir}"
	exit 100
	exit 1
fi

merged_names1=$(find -L ${topDir} | grep merged_nodups.txt)
@@ -138,7 +138,7 @@ if [[ $merged_names == *".txt.gz"* ]]
then
    gzipped=1
    echo "***! Mega map of gzipped files not yet supported, please unzip before running."
    exit 100
    exit 1
    # we need to unzip here
    for i in $merged_names1
    do
@@ -147,7 +147,7 @@ then
	    echo "***! Mixture of gzipped and unzipped merged_nodups files"
	    echo "Ensure that the merged_nodups are all either unzipped or gzipped then rerun"
	    echo "Files: $merged_names"
	    exit 100
	    exit 1
	fi
    done
fi
@@ -193,13 +193,14 @@ export LC_ALL=en_US.UTF-8
if ! awk -f ${juiceDir}/scripts/makemega_addstats.awk ${inter_names} > ${outputdir}/inter.txt
then  
    echo "***! Some problems occurred somewhere in creating top stats files."
    exit 100
    exit 1
else
    echo "(-: Finished creating top stats files."
    cp ${outputdir}/inter.txt ${outputdir}/inter_30.txt
fi
touch $touchfile1
TOPSTATS`
echo "topstats job id: $jid1" > $logdir/jobs.out

touchfile2=${megadir}/touch2
# Merge all merged_nodups.txt files found under current dir
@@ -210,7 +211,7 @@ then
  if ! gunzip -c $merged_names | sort -T ${tmpdir} -m -k2,2d -k6,6d > ${outputdir}/merged_nodups.txt 
  then
    echo "***! Some problems occurred somewhere in merging sorted merged_nodups files."
    exit 100
    exit 1
  else
    echo "(-: Finished sorting all merged_nodups files into a single merge."
    rm -r ${tmpdir}
@@ -218,13 +219,14 @@ then
elif ! sort -T ${tmpdir} -m -k2,2d -k6,6d ${merged_names} > ${outputdir}/merged_nodups.txt
then 
  echo "***! Some problems occurred somewhere in merging sorted merged_nodups files."
  exit 100
  exit 1
else
  echo "(-: Finished sorting all merged_nodups files into a single merge."
  rm -r ${tmpdir}
fi
touch $touchfile2
MRGSRT`
echo "merge job id: $jid2" >> $logdir/jobs.out

touchfile3=${megadir}/touch3
holdjobs1="-hold_jid ${groupname}_merge,${groupname}_topstats";    
@@ -234,17 +236,18 @@ jid3=`qsub -terse -o ${logdir}/inter0.out -e ${logdir}/inter0.err -q ${queue} -r
if [ ! -f "${touchfile1}" ]
then
   echo "***! Top stats job failed, type qacct -j $jid1 to see what happened."
   exit 100;
   exit 1
fi
if [ ! -f "${touchfile2}" ]
then
   echo "***! Sort job failed, type qacct -j $jid2 to see what happened."
   exit 100;
   exit 1
fi

${juiceDir}/scripts/statistics.pl -q 1 -o${outputdir}/inter.txt -s $site_file -l $ligation ${outputdir}/merged_nodups.txt
touch $touchfile3
INTER0`
echo "statistics mapq0 job id: $jid3" >> $logdir/jobs.out

touchfile4=${megadir}/touch4
holdjobs2="-hold_jid ${groupname}_inter0";    
@@ -254,17 +257,19 @@ jid4=`qsub -terse -o ${logdir}/inter30.out -e ${logdir}/inter30.err -q ${queue}
if [ ! -f "${touchfile1}" ]
then
   echo "***! Top stats job failed, type qacct -j $jid1 to see what happened."
   exit 100;
   exit 1
fi
if [ ! -f "${touchfile2}" ]
then
   echo "***! Sort job failed, type qacct -j $jid2 to see what happened."
   exit 100;
   exit 1
fi

${juiceDir}/scripts/statistics.pl -q 30 -o${outputdir}/inter_30.txt -s $site_file -l $ligation ${outputdir}/merged_nodups.txt 
touch $touchfile4
INTER30`
echo "statistics mapq30 job id: $jid4" >> $logdir/jobs.out

holdjobs3="-hold_jid ${groupname}_inter30";
touchfile5=${megadir}/touch5

@@ -275,24 +280,25 @@ $load_java
if [ ! -f "${touchfile3}" ]
then
   echo "***! Statistics q=1 job failed, type qacct -j $jid3 to see what happened."
   exit 100;
   exit 1
fi
myexitcode=1
if [ -z "$exclude" ]
then
    echo "Launching ${juiceDir}/scripts/juicer_tools pre $resolutions -f ${site_file} -s ${outputdir}/inter.txt -g ${outputdir}/inter_hists.m -q 1 ${outputdir}/merged_nodups.txt ${outputdir}/inter.hic ${genomeID}"
    ${juiceDir}/scripts/juicer_tools pre $resolutions -f ${site_file} -s ${outputdir}/inter.txt -g ${outputdir}/inter_hists.m -q 1 ${outputdir}/merged_nodups.txt ${outputdir}/inter.hic ${genomeID}
    myexitcode=\$?
    if ${juiceDir}/scripts/juicer_tools pre $resolutions -f ${site_file} -s ${outputdir}/inter.txt -g ${outputdir}/inter_hists.m -q 1 ${outputdir}/merged_nodups.txt ${outputdir}/inter.hic ${genomeID}
    then
       touch $touchfile5
    fi
else
    echo "Launching ${juiceDir}/scripts/juicer_tools pre $resolutions -s ${outputdir}/inter.txt -g ${outputdir}/inter_hists.m -q 1 ${outputdir}/merged_nodups.txt ${outputdir}/inter.hic ${genomeID}"
    ${juiceDir}/scripts/juicer_tools pre $resolutions -s ${outputdir}/inter.txt -g ${outputdir}/inter_hists.m -q 1 ${outputdir}/merged_nodups.txt ${outputdir}/inter.hic ${genomeID}
    myexitcode=\$?
fi
if [ "\${myexitcode}" -eq 0 ]
    if ${juiceDir}/scripts/juicer_tools pre $resolutions -s ${outputdir}/inter.txt -g ${outputdir}/inter_hists.m -q 1 ${outputdir}/merged_nodups.txt ${outputdir}/inter.hic ${genomeID}
    then
       touch $touchfile5
    fi
fi
HIC0`
echo "hic mapq0 job id: $jid5" >> $logdir/jobs.out

touchfile6=${megadir}/touch6
# Create HIC maps file for MQ > 30
@@ -302,24 +308,25 @@ $load_java
if [ ! -f "${touchfile4}" ]
then
   echo "***! Statistics q=30 job failed, type qacct -j $jid4 to see what happened."
   exit 100;
   exit 1
fi
myexitcode=1
if [ -z "${exclude}" ]
then
    echo "Launching ${juiceDir}/scripts/juicer_tools pre $resolutions -f ${site_file} -s ${outputdir}/inter_30.txt -g ${outputdir}/inter_30_hists.m -q 30 ${outputdir}/merged_nodups.txt ${outputdir}/inter_30.hic ${genomeID}"
    ${juiceDir}/scripts/juicer_tools pre $resolutions -f ${site_file} -s ${outputdir}/inter_30.txt -g ${outputdir}/inter_30_hists.m -q 30 ${outputdir}/merged_nodups.txt ${outputdir}/inter_30.hic ${genomeID}
    myexitcode=\$?
    if ${juiceDir}/scripts/juicer_tools pre $resolutions -f ${site_file} -s ${outputdir}/inter_30.txt -g ${outputdir}/inter_30_hists.m -q 30 ${outputdir}/merged_nodups.txt ${outputdir}/inter_30.hic ${genomeID}
    then
       touch $touchfile6
    fi
else
    echo "Launching ${juiceDir}/scripts/juicer_tools pre $resolutions -s ${outputdir}/inter_30.txt -g ${outputdir}/inter_30_hists.m -q 30 ${outputdir}/merged_nodups.txt ${outputdir}/inter_30.hic ${genomeID}"
    ${juiceDir}/scripts/juicer_tools pre $resolutions -s ${outputdir}/inter_30.txt -g ${outputdir}/inter_30_hists.m -q 30 ${outputdir}/merged_nodups.txt ${outputdir}/inter_30.hic ${genomeID}
    myexitcode=\$?
fi
if [ "\${myexitcode}" -eq 0 ]
    if ${juiceDir}/scripts/juicer_tools pre $resolutions -s ${outputdir}/inter_30.txt -g ${outputdir}/inter_30_hists.m -q 30 ${outputdir}/merged_nodups.txt ${outputdir}/inter_30.hic ${genomeID}
    then
       touch $touchfile6
    fi
fi
HIC30`
echo "hic mapq30 job id: $jid6" >> $logdir/jobs.out

touchfile7=${megadir}/touch7
jid7=`qsub -terse -o ${logdir}/hiccups.out -e ${logdir}/hiccups.err -q ${queue} -r y -N ${groupname}_hiccups  -l h_vmem=16g -hold_jid ${groupname}_hic30 <<- HICCUPS
@@ -330,11 +337,12 @@ export LC_ALL=en_US.UTF-8;
if [ ! -f "${touchfile6}" ]
then
   echo "***! Failed to make inter_30.hic, type qacct -j $jid6 to see what happened."
   exit 100;
   exit 1
fi
${juiceDir}/scripts/juicer_hiccups.sh -j ${juiceDir}/scripts/juicer_tools -i ${outputdir}/inter_30.hic -m ${juiceDir}/references/motif -g ${genomeID}
touch $touchfile7
HICCUPS`
echo "hiccups job id: $jid7" >> $logdir/jobs.out

touchfile8=${megadir}/touch8
jid8=`qsub -terse -o ${logdir}/arrowhead.out -e ${logdir}/arrowhead.err -q ${queue} -r y -N ${groupname}_arrowhead  -l h_vmem=4g -hold_jid ${groupname}_hic30 <<- ARROWHEAD
@@ -345,11 +353,12 @@ export LC_ALL=en_US.UTF-8;
if [ ! -f "${touchfile6}" ]
then
   echo "***! Failed to make inter_30.hic, type qacct -j $jid6 to see what happened."
   exit 100;
   exit 1
fi
${juiceDir}/scripts/juicer_arrowhead.sh -j ${juiceDir}/scripts/juicer_tools -i ${outputdir}/inter_30.hic
touch $touchfile8
ARROWHEAD`
echo "arrowhead job id: $jid8" >> $logdir/jobs.out

holdjobs="-hold_jid ${groupname}_hic0,${groupname}_hic30,${groupname}_hiccups,${groupname}_arrowhead";

@@ -357,22 +366,22 @@ qsub -o ${logdir}/done.out -e ${logdir}/done.err -r y -N ${groupname}_done $hold
if [ ! -f "${touchfile5}" ]
then
   echo "***! Failed to make inter.hic, type qacct -j $jid5 to see what happened."   
   exit 100;
   exit 1
fi
if [ ! -f "${touchfile6}" ]
then
   echo "***! Failed to make inter_30.hic, type qacct -j $jid6 to see what happened."   
   exit 100;
   exit 1
fi
if [ ! -f "${touchfile7}" ]
then
   echo "***! Failed to create loop lists, type qacct -j $jid7 to see what happened."   
   exit 100;
   exit 1
fi
if [ ! -f "${touchfile8}" ]
then
   echo "***! Failed to create contact domain lists, type qacct -j $jid8 to see what happened."   
   exit 100;
   exit 1
fi
rm -r ${tmpdir}
rm $touchfile1 $touchfile2 $touchfile3 $touchfile4 $touchfile5 $touchfile6 $touchfile7 $touchfile8
Loading