wrapper_delete.sh 999 Bytes
Newer Older
1 2 3
#! /bin/sh

### ASDP PIPELINE ###
4 5 6 7 8
## Version: 0.0.1
## Licence: AGPLV3
## Author: anne-sophie.denomme-pichon@u-bourgogne.fr
## Description: a wrapper for qsubing bam deletion for STR pipeline
## Usage: qsub -pe smp 1 -v SAMPLE=<sample>,[LOGFILE=<path to the log file>] wrapper_delete.sh
9

10 11
# Source the configuration file
. "$(dirname "$0")/config.sh"
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34

# Log file path option
if [ -z "$LOGFILE" ]
then
    LOGFILE=delete.$(date +"%F_%H-%M-%S").log
fi

# Logging
exec 1>> "$LOGFILE" 2>&1
echo "$(date +"%F_%H-%M-%S"): START"

# Check if sample is specified
if [ -z "$SAMPLE" ]
then
    echo "Sample is not specified"
    echo "$(date +"%F_%H-%M-%S"): END"
    exit 1
fi

# Delete and check exit code
echo "command : rm \
    $SAMPLE"
rm \
35 36
    "$OUTPUTDIR/$SAMPLE/$SAMPLE.bam" \
    "$OUTPUTDIR/$SAMPLE/$SAMPLE.bai"
37 38 39 40 41 42 43 44 45 46 47

delete_exitcode=$?

echo "delete exit code : $delete_exitcode"
if [ $delete_exitcode != 0 ]
then
    echo "$(date +"%F_%H-%M-%S"): END"
    exit 1
fi

echo "$(date +"%F_%H-%M-%S"): END"