#!/bin/bash -l
#$ -cwd
#$ -N vep
#$ -l h_rt=96:00:00
#$ -l s_rt=96:00:00
#$ -pe smp 1 -R y -binding linear:1
#$ -l h_vmem=8G
#$ -o log/vep.$TASK_ID.log
#$ -e log/vep.$TASK_ID.log
#$ -t 1-1082
#$ -tc 100

i=${SGE_TASK_ID}

mkdir -p ../tmp/variant_split_vep

sif=~/projects/software/singularity/vep/vep107/vep107.sif

loftee_path=loftee_path:/opt/vep/.vep/loftee
loftee_resource=~/projects/software/loftee_resource
anc=human_ancestor_fa:${loftee_resource}/human_ancestor.fa.gz
bind=~/projects/software/singularity/vep/vep107/vep:/opt/vep/.vep
gerp=gerp_bigwig:${loftee_resource}/gerp_conservation_scores.homo_sapiens.GRCh38.bw

singularity exec \
  --bind ${HOME}:${HOME},${bind} \
  --env PERL5LIB=${PERL5LIB}:/opt/vep/.vep/loftee/ \
  ${sif} vep \
    -i variant_split/variant_split.${i}.vcf.gz \
    -o variant_split_vep/variant_split.${i}.vep_all.gz \
    --assembly GRCh38 \
    --tab \
    --symbol \
    --check_existing \
    --canonical \
    --mane \
    --flag_pick \
    --cache \
    --offline \
    --no_stats \
    --force_overwrite \
    --compress_output gzip \
    --dir_cache /opt/vep/.vep/ \
    --dir_plugins /opt/vep/.vep/ \
    --plugin LoF,${loftee_path},${gerp},${anc}

