merge_GATK.sh 2.51 KB
Newer Older
Simon Verdez's avatar
Simon Verdez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#!/bin/ksh

### PharmAnnot PIPELINE ###
## merge_GATK.sh
## Version : 1.0.0
## Description : This script merge two vcf file
## Usage : qsub -pe smp <nb thread> -v INPUTFILE1=</path/to/the/input/vcf/file>,INPUTFILE2=</path/to/the/input/vcf/file>,REF=</path/to/the/ref/file>,OUTPUTFILE=</path/to/the/output/vcf/file>,[LOGFILE=/path/to/the/log/file],[CONFIGFILE=/path/to/the/config/file] merge_GATK.sh
## Output : .vcf file containing annotations
## Requirements : jdk 1.8.0

## Author : simon.verdez@chu-dijon.fr
## Creation Date : 20180702
## last revision date : 20180702
## Known bugs : None

#$ -q batch
#$ -V



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

# Config file path option
if [ -z ${CONFIGFILE} ]
then
    CONFIGFILE=analysis_config.tsv
fi

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

# Check if config file exist
if [ ! -f $CONFIGFILE ]
then
    echo "Config file does not exist"
    echo "$(date +"%F_%H-%M-%S"): END"
    touch merge_GATK.failed
    exit 1
fi

# Check if input1 file exist
if [ ! -f $INPUTFILE1 ]
then
    echo "Input1 file does not exist"
    echo "$(date +"%F_%H-%M-%S"): END"
    touch merge_GATK.failed
    exit 1
fi

# Check if input2 file exist
if [ ! -f $INPUTFILE2 ]
then
    echo "Input2 file does not exist"
    echo "$(date +"%F_%H-%M-%S"): END"
    touch merge_GATK.failed
    exit 1
fi

# Check if ref file exist
if [ ! -f $REF ]
then
    echo "ref file does not exist"
    echo "$(date +"%F_%H-%M-%S"): END"
    touch merge_GATK.failed
    exit 1
fi

# Check if output file is specified
if [ -z $OUTPUTFILE ]
then
    echo "Output file is not specified"
    echo "$(date +"%F_%H-%M-%S"): END"
    touch merge_GATK.failed
    exit 1
fi

Simon Verdez's avatar
Simon Verdez committed
82 83
#JAVA=$(grep "javacmd" $CONFIGFILE | awk '{print $2}')
module load java64/1.8.0_162
Simon Verdez's avatar
Simon Verdez committed
84
PATHSCRIPT=$(grep "pipelinebase" $CONFIGFILE | awk '{print $2}')
Simon Verdez's avatar
Simon Verdez committed
85
#GATK=$(grep "GATKbase" $CONFIGFILE | awk '{print $2}')
Simon Verdez's avatar
Simon Verdez committed
86

Simon Verdez's avatar
Simon Verdez committed
87 88
echo "command : $JAVA -jar /work/gad/shared/bin/GATK_3.7/GenomeAnalysisTK.jar -T CombineVariants -R $REF --variant $INPUTFILE1 --variant $INPUTFILE2 -genotypeMergeOptions UNIQUIFY"
java -jar /work/gad/shared/bin/GATK_3.7/GenomeAnalysisTK.jar -T CombineVariants -R $REF --variant $INPUTFILE1 --variant $INPUTFILE2 -o $OUTPUTFILE -genotypeMergeOptions UNIQUIFY
Simon Verdez's avatar
Simon Verdez committed
89 90 91 92 93 94 95 96 97 98 99

genotypeMerge_exitcode=$?
echo "GenotypeMerge exit code : $genotypeMerge_exitcode"
if [ $genotypeMerge_exitcode != 0 ]
then
    echo "$(date +"%F_%H-%M-%S"): END"
    touch merge.failed
    exit 1
fi

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