|
| 1 | +#!/bin/bash |
| 2 | +#PBS -l nodes=1:ppn=4 |
| 3 | +#PBS -l pmem=16gb |
| 4 | +#PBS -l walltime=00:10:00 |
| 5 | +#PBS -A open |
| 6 | +#PBS -o logs/depth.did.Rap1.1M.log.out |
| 7 | +#PBS -e logs/depth.did.Rap1.1M.log.err |
| 8 | +#PBS -t 1-1000 |
| 9 | + |
| 10 | +# This script will check that 1000 BAM files have been generated before executing DeletionID. |
| 11 | + |
| 12 | +module load gcc/8.3.1 |
| 13 | +module load bedtools/2.27.1 |
| 14 | +module load bwa/0.7.15 |
| 15 | +module load samtools/1.5 |
| 16 | +module load anaconda3 |
| 17 | +source activate genopipe |
| 18 | + |
| 19 | +# FIRST CHANGE PATH TO EXECUTE |
| 20 | +WRK=/path/to/GenoPipe/paper/SyntheticDeletion |
| 21 | +cd $WRK |
| 22 | + |
| 23 | +INFO=`sed "2q;d" depth_simulations.txt` |
| 24 | +LOCUS=`awk '{print $1}' <(echo $INFO)` |
| 25 | +DEPTH=`awk '{print $2}' <(echo $INFO)` |
| 26 | + |
| 27 | +REF=`echo $LOCUS | awk -F'_' '{print $1}'` |
| 28 | + |
| 29 | +OUTPUT=$WRK/results/$LOCUS\_$DEPTH |
| 30 | +BAM=$WRK/results/$LOCUS\_$DEPTH/BAM |
| 31 | +TEMP=$WRK/temp2-$PBS_ARRAYID |
| 32 | + |
| 33 | +[ -d $OUTPUT/ID ] || mkdir $OUTPUT/ID |
| 34 | +[ -d logs ] || mkdir logs |
| 35 | +[ -d $ID ] || mkdir $ID |
| 36 | +[ -d $TEMP ] || mkdir $TEMP |
| 37 | + |
| 38 | +#Check that BAM file was generated first |
| 39 | +if [ -f $BAM.bam ]; |
| 40 | +then |
| 41 | + echo "BAM input for ${LOCUS}_${DEPTH}_${PBS_ARRAYID} does not exist. Exiting." |
| 42 | + exit |
| 43 | +fi |
| 44 | +#Check that BAM Index file exists |
| 45 | +if [ -f $BAM.bam.bai ]; |
| 46 | +then |
| 47 | + echo "BAI missing for for ${LOCUS}_${DEPTH}_${PBS_ARRAYID}. Exiting." |
| 48 | + exit |
| 49 | +fi |
| 50 | +#Check if ID file alrady generated |
| 51 | +#if [[ -f $ID/Simulation_$PBS_ARRAYID\_R1-ID.tab ]]; then |
| 52 | +# echo "ID already generated ($PBS_ARRAYID). Exiting.." |
| 53 | +# exit |
| 54 | +#fi |
| 55 | + |
| 56 | +# Set-up Temp directory |
| 57 | +cd $TEMP |
| 58 | +echo $BAM |
| 59 | +ln -s $BAM/Simulation_$PBS_ARRAYID.bam |
| 60 | +ln -s $BAM/Simulation_$PBS_ARRAYID.bam.bai |
| 61 | + |
| 62 | +DATABASE=$WRK/../db/sacCer3_Del |
| 63 | +GENOPIPE=$WRK/../.. |
| 64 | + |
| 65 | +## Execute Single DeletionID and record time |
| 66 | +cd $GENOPIPE/DeletionID |
| 67 | +echo "**Begin executing DeletionID for ${LOCUS}_${DEPTH}..." |
| 68 | +time bash identify-Deletion.sh -i $TEMP -o $OUTPUT/ID -d $DATABASE |
| 69 | +MESSAGE="...single DeletionID for ${LOCUS} ${DEPTH} finished." |
| 70 | +echo $MESSAGE |
| 71 | +cd $WRK |
| 72 | + |
| 73 | +## Clean-up |
| 74 | +rm -r $TEMP |
0 commit comments