-
Notifications
You must be signed in to change notification settings - Fork 0
/
STD_VQSR_SUBMITTER_GRCH38.sh
executable file
·1371 lines (1189 loc) · 45.7 KB
/
STD_VQSR_SUBMITTER_GRCH38.sh
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /bin/bash
###################
# INPUT VARIABLES #
###################
PROJECT_MS=$1 # the project where the multi-sample vcf is being written to
SAMPLE_SHEET=$2 # full/relative path to the sample sheet
PREFIX=$3 # prefix name that you want to give the multi-sample vcf
ARRAY_REF=$4 # OPTIONAL: if there is argument present the array reference genome is grch38. otherwise the default is grch37.
if [[ ! ${ARRAY_REF} ]]
then
ARRAY_REF="grch37"
fi
SNP_SENSITIVITY=$5 # SNP TRUTH SENTIVITY CUT-OFF FOR VQSR (OPTIONAL). DEFAULT IS 99.5
# VALUE MUST HAVE ONE DECIMAL POINT (e.g. 99.7)
if
[[ ! ${SNP_SENSITIVITY} ]]
then
SNP_SENSITIVITY="99.5"
fi
INDEL_SENSITIVITY=$6 # INDEL TRUTH SENTIVITY CUT-OFF FOR VQSR. DEFAULT IS 99.0
# OPTIONAL: IF YOU WANT TO SET THIS YOU NEED TO SET SNP SENSIVITY AS WELL. EVEN TO THE DEFAULT VALUE.
# VALUE MUST HAVE ONE DECIMAL POINT (e.g. 99.7)
if
[[ ! ${INDEL_SENSITIVITY} ]]
then
INDEL_SENSITIVITY="99.0"
fi
PRIORITY=$7 # SGE PRIORITY. default is -14. range is -1 to -1023. CLOSER TO ZERO IS HIGHER PRIORITY.
# OPTIONAL: IF YOU WANT TO SET THIS YOU NEED TO SET SNP SENSIVITY AND INDEL SENSITIVITY AS WELL. EVEN TO THE DEFAULT VALUES.
if
[[ ! ${PRIORITY} ]]
then
PRIORITY="-14"
fi
NUMBER_OF_BED_FILES=$8 # scatter count. HOW MANY FILES YOU WANT TO BREAK UP THE BED FILE INTO FOR PARALLEL PROCESSING DISTRIBUTION.
# OPTIONAL: IF YOU WANT TO SET THIS YOU NEED TO SET SNP AND INDEL SENSITIVITY AS WELL AS SGE PRIORITY. EVEN TO THE DEFAULT VALUES.
if
[[ ! ${NUMBER_OF_BED_FILES} ]]
then
NUMBER_OF_BED_FILES=500
fi
###########################
# CORE VARIABLES/SETTINGS #
###########################
# CHANGE SCRIPT DIR TO WHERE YOU HAVE HAVE THE SCRIPTS BEING SUBMITTED
SUBMITTER_SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
SCRIPT_DIR="${SUBMITTER_SCRIPT_PATH}/STD_VQSR_GRCH38"
COMMON_GRCH38_SCRIPT_DIR="${SUBMITTER_SCRIPT_PATH}/COMMON_GRCH38_SCRIPTS"
COMMON_SCRIPT_DIR="${SUBMITTER_SCRIPT_PATH}/COMMON_SCRIPTS"
COMMON_VQSR_SCRIPT_DIR="${SUBMITTER_SCRIPT_PATH}/COMMON_VQSR_SCRIPTS"
STD_VQSR_DIR="${SUBMITTER_SCRIPT_PATH}/STD_VQSR"
# gcc is so that it can be pushed out to the compute nodes via qsub (-V)
module load gcc/7.2.0
# Directory where sequencing projects are located
CORE_PATH="/mnt/research/active"
# Generate a list of active queue and remove the ones that I don't want to use
QUEUE_LIST=$(qstat -f -s r \
| egrep -v "^[0-9]|^-|^queue|^ " \
| cut -d @ -f 1 \
| sort \
| uniq \
| egrep -v "bigmem.q|all.q|cgc.q|programmers.q|rhel7.q|qtest.q|bigdata.q|uhoh.q|testcgc.q" \
| datamash collapse 1 \
| awk '{print $1}')
# eventually, i want to push this out to something...maybe in the vcf file header.
PIPELINE_VERSION=$(git --git-dir=$SCRIPT_DIR/../.git --work-tree=$SCRIPT_DIR/.. log --pretty=format:'%h' -n 1)
# generate a random number b/w "0 - 32767" to be used for the job name for variant annotator both pre and post refinement
# this is to help cut down on the job name length so I can increase the scatter count
HACK=$(echo $RANDOM)
# explicitly setting this b/c not everybody has had the $HOME directory transferred and I'm not going to through
# and figure out who does and does not have this set correctly
umask 0007
# grab email addy
SEND_TO=$(cat $SCRIPT_DIR/../email_lists.txt)
# QSUB ARGUMENTS LIST
# set shell on compute node
# start in current working directory
# transfer submit node env to compute node
# set SINGULARITY BINDPATH
# set queues to submit to
# set priority
# combine stdout and stderr logging to same output file
QSUB_ARGS="-S /bin/bash" \
QSUB_ARGS=${QSUB_ARGS}" -cwd" \
QSUB_ARGS=${QSUB_ARGS}" -V" \
QSUB_ARGS=${QSUB_ARGS}" -v SINGULARITY_BINDPATH=/mnt:/mnt" \
QSUB_ARGS=${QSUB_ARGS}" -q ${QUEUE_LIST}" \
QSUB_ARGS=${QSUB_ARGS}" -p ${PRIORITY}" \
QSUB_ARGS=${QSUB_ARGS}" -j y"
#####################
# PIPELINE PROGRAMS #
#####################
JAVA_1_8="/mnt/linuxtools/JAVA/jdk1.8.0_73/bin"
BEDTOOLS_DIR="/mnt/linuxtools/BEDTOOLS/bedtools-2.22.0/bin"
GATK_DIR="/mnt/linuxtools/GATK/GenomeAnalysisTK-3.7"
SAMTOOLS_0118_DIR="/mnt/linuxtools/SAMTOOLS/samtools-0.1.18"
# Becasue I didn't want to go through compiling this yet for version 1.6.
TABIX_DIR="/mnt/linuxtools/TABIX/tabix-0.2.6"
CIDRSEQSUITE_JAVA_DIR="/mnt/linuxtools/JAVA/jre1.7.0_45/bin"
CIDRSEQSUITE_6_1_1_DIR="/mnt/linuxtools/CIDRSEQSUITE/6.1.1"
CIDRSEQSUITE_ANNOVAR_JAVA="/mnt/linuxtools/JAVA/jdk1.8.0_73/bin"
CIDRSEQSUITE_DIR_4_0="/mnt/research/tools/LINUX/CIDRSEQSUITE/Version_4_0"
CIDRSEQSUITE_PROPS_DIR_HG38="/mnt/research/tools/LINUX/00_GIT_REPO_KURT/CIDR_SEQ_CAPTURE_JOINT_CALL/CMG_GRCH38"
CIDRSEQSUITE_7_5_0_DIR="/mnt/research/tools/LINUX/CIDRSEQSUITE/7.5.0"
LAB_QC_DIR="/mnt/linuxtools/CUSTOM_CIDR/EnhancedSequencingQCReport/0.1.1"
# Copied from /mnt/research/tools/LINUX/CIDRSEQSUITE/pipeline_dependencies/QC_REPORT/EnhancedSequencingQCReport.jar
# md5 f979bb4dc8d97113735ef17acd3a766e EnhancedSequencingQCReport.jar
SAMTOOLS_DIR="/mnt/linuxtools/ANACONDA/anaconda2-5.0.0.1/bin"
# This is samtools version 1.7
DATAMASH_DIR="/mnt/linuxtools/DATAMASH/datamash-1.0.6"
R_DIRECTORY="/mnt/linuxtools/R/R-3.1.1/bin"
GATK_DIR_4011="/mnt/linuxtools/GATK/gatk-4.0.11.0"
PICARD_DIR="/mnt/linuxtools/PICARD/picard-2.22.0"
PARALLEL_DIR="/cm/shared/apps/parallel/20161222/bin"
PICARD_LIFTOVER_CONTAINER="/mnt/research/tools/LINUX/00_GIT_REPO_KURT/CONTAINERS/picard-2.26.10.0.simg"
ALIGNMENT_CONTAINER="/mnt/research/tools/LINUX/00_GIT_REPO_KURT/CONTAINERS/ddl_ce_control_align-0.0.4.simg"
# contains the following software and is on Ubuntu 16.04.5 LTS
# gatk 4.0.11.0 (base image). also contains the following.
# Python 3.6.2 :: Continuum Analytics, Inc.
# samtools 0.1.19
# bcftools 0.1.19
# bedtools v2.25.0
# bgzip 1.2.1
# tabix 1.2.1
# samtools, bcftools, bgzip and tabix will be replaced with newer versions.
# R 3.2.5
# dependencies = c("gplots","digest", "gtable", "MASS", "plyr", "reshape2", "scales", "tibble", "lazyeval") # for ggplot2
# getopt_1.20.0.tar.gz
# optparse_1.3.2.tar.gz
# data.table_1.10.4-2.tar.gz
# gsalib_2.1.tar.gz
# ggplot2_2.2.1.tar.gz
# openjdk version "1.8.0_181"
# /gatk/gatk.jar -> /gatk/gatk-package-4.0.11.0-local.jar
# added
# picard.jar 2.17.0 (as /gatk/picard.jar)
# samblaster-v.0.1.24
# sambamba-0.6.8
# bwa-0.7.15
# datamash-1.6
# verifyBamID v1.1.3
# samtools 1.10
# bgzip 1.10
# tabix 1.10
# bcftools 1.10.2
##################
# PIPELINE FILES #
##################
HAPMAP_VCF="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/hapmap_3.3.hg38.vcf.gz"
OMNI_VCF="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/1000G_omni2.5.hg38.vcf.gz"
ONEKG_SNPS_VCF="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/1000G_phase1.snps.high_confidence.hg38.vcf.gz"
DBSNP_138_VCF="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/dbsnp_138.hg38.vcf.gz"
ONEKG_INDELS_VCF="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz"
AXIOM_VCF="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/Axiom_Exome_Plus.genotypes.all_populations.poly.hg38.vcf.gz"
KNOWN_SNPS="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/dbsnp_138.hg38.liftover.excluding_sites_after_129.vcf.gz"
# md5 85f3e9f0d5f30de2a046594b4ab4de86
VERACODE_CSV="/mnt/linuxtools/CIDRSEQSUITE/Veracode_hg18_hg19.csv"
MERGED_MENDEL_BED_FILE="/mnt/research/active/M_Valle_MD_SeqWholeExome_120417_1_GRCh38/BED_Files/BAITS_Merged_S03723314_S06588914_TwistCUEXmito.lift.hg38.merge.clean.bed"
# 4aa700700812d52c19f97c584eaca918
REF_DICT="/mnt/shared_resources/public_resources/GRCh38DH/GRCh38_full_analysis_set_plus_decoy_hla.dict"
HG19_REF="/mnt/research/tools/PIPELINE_FILES/GATK_resource_bundle/2.8/hg19/ucsc.hg19.fasta"
HG38_TO_HG19_CHAIN="/mnt/shared_resources/public_resources/liftOver_chain/hg38ToHg19.over.chain"
HG19_DICT="/mnt/research/tools/PIPELINE_FILES/GATK_resource_bundle/2.8/hg19/ucsc.hg19.dict"
REF_SEQ_TRANSCRIPTS="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/RefSeq.Unique.FINAL.19Feb2018.liftover.hg38.bed"
# THIS IS A LIFTOVER FROM THE 1ST VERSION CLINICAL EXOME DEFINITION. WHICH WAS BASICALLY THE LONGEST TRANSCRIPT PER TRANSLATED GENE.
# md5 7ea68d65a046934f9f2401b56d5893b8
# 107 records did not liftover involving 42 genes
# /mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/RefSeq.Unique.FINAL.19Feb2018.liftover.hg38.rejected.bed
P3_1KG="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/ALL.wgs.shapeit2_integrated_v1a.GRCh38.20181129.sites-4.1.vcf.gz"
# wget -r ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/1000_genomes_project/release/20181203_biallelic_SNV/
# change the first line in the header to say 4.1 instead of 4.3 for the file format
# md5 a76eaa4714953f8125ed7dca7e02e252
ExAC="/mnt/research/tools/PIPELINE_FILES/GRCh38_aux_files/ExAC.r0.3.sites.vep.hg38.liftover.vcf.gz"
# md5 1c890a91e3a123e7bd617e97d1289216
##################################################
##################################################
##### JOINT CALLING PROJECT SET-UP ###############
### WHERE THE MULTI-SAMPLE VCF GETS WRITTEN TO ###
##################################################
##################################################
# This checks to see if bed file directory and split gvcf list has been created from a previous run.
# If so, remove them to not interfere with current run
if [ -d ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT ]
then
rm -rf ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT
fi
if [ -d ${CORE_PATH}/${PROJECT_MS}/TEMP/SPLIT_LIST ]
then
rm -rf ${CORE_PATH}/${PROJECT_MS}/TEMP/SPLIT_LIST
fi
############################################################################################
##### MAKE THE FOLLOWING FOLDERS IN THE PROJECT WHERE THE MULTI-SAMPLE VCF IS GOING TO #####
############################################################################################
mkdir -p ${CORE_PATH}/${PROJECT_MS}/{LOGS,COMMAND_LINES}
mkdir -p ${CORE_PATH}/${PROJECT_MS}/TEMP/{BED_FILE_SPLIT,AGGREGATE,QC_REPORT_PREP_${PREFIX},SPLIT_LIST}
mkdir -p ${CORE_PATH}/${PROJECT_MS}/MULTI_SAMPLE/VARIANT_SUMMARY_STAT_VCF/
mkdir -p ${CORE_PATH}/${PROJECT_MS}/GVCF/AGGREGATE
mkdir -p ${CORE_PATH}/${PROJECT_MS}/REPORTS/{ANNOVAR,LAB_PREP_REPORTS_MS,QC_REPORTS}
mkdir -p ${CORE_PATH}/${PROJECT_MS}/REPORTS/QC_REPORT_PREP_MS/QC_REPORT_PREP_${PREFIX}
mkdir -p ${CORE_PATH}/${PROJECT_MS}/REPORTS/VCF_METRICS/MULTI_SAMPLE/
mkdir -p ${CORE_PATH}/${PROJECT_MS}/TEMP/ANNOVAR/${PREFIX}
mkdir -p ${CORE_PATH}/${PROJECT_MS}/LOGS/{A01_COMBINE_GVCF,B01_GENOTYPE_GVCF,C01_VARIANT_ANNOTATOR,H01_CALCULATE_GENOTYPE_POSTERIORS,I01_VARIANT_ANNOTATOR_REFINED,I02_LIFTOVER_HG19_REFINED}
##################################################
### FUNCTIONS FOR JOINT CALLING PROJECT SET-UP ###
##################################################
# grab the reference genome file, dbsnp file and bait bed file for the "project"
## !should do a check here to make sure that there is only one record...!
CREATE_PROJECT_INFO_ARRAY ()
{
PROJECT_INFO_ARRAY=(`sed 's/\r//g' ${SAMPLE_SHEET} \
| awk 'BEGIN{FS=","} NR>1 {print $12,$15,$16,$17,$18}' \
| sed 's/,/\t/g' \
| sort -k 1,1 \
| awk '{print $1,$2,$3,$4,$5}' \
| sort \
| uniq`)
REF_GENOME=${PROJECT_INFO_ARRAY[0]} # field 12 from the sample sheet
PROJECT_TITV_BED=${PROJECT_INFO_ARRAY[1]} # field 15 from the sample sheet
PROJECT_TITV_BED_NAME=$(basename ${PROJECT_TITV_BED} .bed)
PROJECT_BAIT_BED=${PROJECT_INFO_ARRAY[2]} # field 16 from the sample sheet
PROJECT_TARGET_BED=${PROJECT_INFO_ARRAY[3]} # field 17 from the sample sheet
PROJECT_TARGET_BED_NAME=$(basename ${PROJECT_TARGET_BED} .bed)
PROJECT_DBSNP=${PROJECT_INFO_ARRAY[4]} # field 18 from the sample sheet
}
# GET RID OF ALL THE COMMON BED FILE EFF-UPS,
FORMAT_AND_SCATTER_BAIT_BED ()
{
BED_FILE_PREFIX=(`echo BF`)
# make sure that there is EOF
# remove CARRIAGE RETURNS
# remove CHR PREFIXES (THIS IS to make sorting easier later)
# CONVERT VARIABLE LENGTH WHITESPACE FIELD DELIMETERS TO SINGLE TAB.
awk 1 $PROJECT_BAIT_BED | sed -r 's/\r//g ; s/chr//g ; s/[[:space:]]+/\t/g' \
>| ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/FORMATTED_BED_FILE.bed
# SORT TO GRCH37 ORDER
# DO NOT ADD MT
# add chr prefix so that is match grch38
(awk '$1~/^[0-9]/' ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/FORMATTED_BED_FILE.bed | sort -k1,1n -k2,2n ; \
awk '$1=="X"' ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/FORMATTED_BED_FILE.bed | sort -k 2,2n ; \
awk '$1=="Y"' ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/FORMATTED_BED_FILE.bed | sort -k 2,2n) \
| awk '{print "chr"$0}' \
>| ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/FORMATTED_AND_SORTED_BED_FILE.bed
# Determining how many records will be in each mini-bed file.
# The +1 at the end is to round up the number of records per mini-bed file to ensure all records are captured.
# So the last mini-bed file will be smaller.
# IIRC. this statement isn't really true, but I don't feel like figuring it out right now. KNH
INTERVALS_DIVIDED=`wc -l ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/FORMATTED_AND_SORTED_BED_FILE.bed \
| awk '{print $1"/""'$NUMBER_OF_BED_FILES'"}' \
| bc \
| awk '{print $0+1}'`
split -l $INTERVALS_DIVIDED \
-a 4 \
-d \
${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/FORMATTED_AND_SORTED_BED_FILE.bed \
${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/$BED_FILE_PREFIX
# ADD A .bed suffix to all of the now splitted files
ls ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/$BED_FILE_PREFIX* \
| awk '{print "mv",$0,$0".bed"}' \
| bash
# fix target and ti/tv bed files
# make sure that there is EOF
# remove CARRIAGE RETURNS
# CONVERT VARIABLE LENGTH WHITESPACE FIELD DELIMETERS TO SINGLE TAB.
awk 1 $PROJECT_TARGET_BED \
| sed -r 's/\r//g ; s/[[:space:]]+/\t/g' \
>| ${CORE_PATH}/${PROJECT_MS}/TEMP/${PROJECT_MS}-${PROJECT_TARGET_BED_NAME}.bed
awk 1 $PROJECT_TITV_BED \
| sed -r 's/\r//g ; s/[[:space:]]+/\t/g' \
>| ${CORE_PATH}/${PROJECT_MS}/TEMP/${PROJECT_MS}-${PROJECT_TITV_BED_NAME}.bed
# convert fixed bed files into picard interval lists
(grep "^@SQ" ${REF_DICT} \
; awk 'BEGIN {OFS="\t"} \
{print $1,($2+1),$3,"+",$1"_"($2+1)"_"$3}' \
${CORE_PATH}/${PROJECT_MS}/TEMP/${PROJECT_MS}-${PROJECT_TARGET_BED_NAME}.bed) \
>| ${CORE_PATH}/${PROJECT_MS}/TEMP/${PROJECT_MS}-${PROJECT_TARGET_BED_NAME}-picard.bed
(grep "^@SQ" ${REF_DICT} \
; awk 'BEGIN {OFS="\t"} \
{print $1,($2+1),$3,"+",$1"_"($2+1)"_"$3}' \
${CORE_PATH}/${PROJECT_MS}/TEMP/${PROJECT_MS}-${PROJECT_TITV_BED_NAME}.bed) \
>| ${CORE_PATH}/${PROJECT_MS}/TEMP/${PROJECT_MS}-${PROJECT_TITV_BED_NAME}-picard.bed
}
##########################################################################################################
##### UNIQUE THE SAMPLE INTO SAMPLE/PROJECT COMBOS AND CREATE A SAMPLE SHEET INTO 300 SAMPLE CHUNKS. #####
##########################################################################################################
### god, i was really tired and under a lot of pressure when I did this...i've done it more sensibly in ##
### other pipelines since then, but if this still works I'm not going to rework it to match what I did ###
### in the other pipelines ###
##############################
awk 'BEGIN {FS=",";OFS="\t"} NR>1 {print $1,$8}' \
${SAMPLE_SHEET} \
| sort -k 1,1 -k 2,2 \
| uniq \
| split -l 300 -a 4 -d - \
${CORE_PATH}/${PROJECT_MS}/TEMP/SPLIT_LIST/
# # Use the chunked up sample sheets to create gvcf list chunks
for PROJECT_SAMPLE_LISTS in $(ls ${CORE_PATH}/${PROJECT_MS}/TEMP/SPLIT_LIST/*)
do
awk 'BEGIN {OFS="/"} {print "'${CORE_PATH}'",$1,"GVCF",$2".g.vcf.gz"}' \
$PROJECT_SAMPLE_LISTS \
>| $PROJECT_SAMPLE_LISTS.list
done
# take all of the project/sample combos in the sample sheet and write a g.vcf file path to a *list file
# At this point this is just for record keeping...it is being scatterred above
CREATE_GVCF_LIST ()
{
# count how many unique sample id's (with project) are in the sample sheet.
TOTAL_SAMPLES=(`awk 'BEGIN{FS=","} NR>1{print $1,$8}' ${SAMPLE_SHEET} \
| sort \
| uniq \
| wc -l`)
# find all of the gvcf files write all of the full paths to a *samples.gvcf.list file.
awk 'BEGIN{FS=","} NR>1{print $1,$8}' ${SAMPLE_SHEET} \
| sort \
| uniq \
| awk 'BEGIN{OFS="/"}{print "ls " "'${CORE_PATH}'",$1,"GVCF",$2".g.vcf*"}' \
| bash \
| egrep -v "idx|tbi|md5" \
>| ${CORE_PATH}'/'${PROJECT_MS}'/'$TOTAL_SAMPLES'.samples.gvcf.list'
# STORE THE GVCF LIST FILE PATH AS A VARIABLE
GVCF_LIST=(`echo ${CORE_PATH}'/'${PROJECT_MS}'/'$TOTAL_SAMPLES'.samples.gvcf.list'`)
}
# Run Ben's EnhancedSequencingQCReport which;
# Generates a QC report for lab specific metrics including Physique Report, Samples Table, Sequencer XML data, Pca and Phoenix.
# Does not check if samples are dropped.
RUN_LAB_PREP_METRICS ()
{
echo \
qsub \
${QSUB_ARGS} \
-N A02-LAB_PREP_METRICS_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/${PROJECT_MS}-LAB_PREP_METRICS.log \
${COMMON_SCRIPT_DIR}/A02_LAB_PREP_METRICS.sh \
${JAVA_1_8} \
${LAB_QC_DIR} \
${CORE_PATH} \
${PROJECT_MS} \
${SAMPLE_SHEET}
}
############################################################
##### CALL THE ABOVE FUNCTIONS TO SET-UP JOINT CALLING #####
############################################################
CREATE_PROJECT_INFO_ARRAY
FORMAT_AND_SCATTER_BAIT_BED
CREATE_GVCF_LIST
RUN_LAB_PREP_METRICS
echo sleep 0.1s
#################################################################
##### CREATE SAMPLE SPECIFIC SUB-DIRECTORIES, FIX BED FILES #####
#################################################################
# for each unique sample id in the sample sheet grab the bed files, ref genome, project and store as an array
CREATE_SAMPLE_INFO_ARRAY ()
{
SAMPLE_INFO_ARRAY=(`sed 's/\r//g' ${SAMPLE_SHEET} \
| awk 'BEGIN{FS=","} NR>1 {print $1,$8,$16,$17,$15,$18,$12}' \
| sed 's/,/\t/g' \
| sort -k 2,2 \
| uniq \
| awk '$2=="'$SAMPLE'" {print $1,$2,$3,$4,$5,$6,$7,NR}'`)
PROJECT_SAMPLE=${SAMPLE_INFO_ARRAY[0]}
SM_TAG=${SAMPLE_INFO_ARRAY[1]}
BAIT_BED=${SAMPLE_INFO_ARRAY[2]}
TARGET_BED=${SAMPLE_INFO_ARRAY[3]}
TITV_BED=${SAMPLE_INFO_ARRAY[4]}
DBSNP=${SAMPLE_INFO_ARRAY[5]} #Not used unless we implement HC_BAM
SAMPLE_REF_GENOME=${SAMPLE_INFO_ARRAY[6]}
SAMPLE_ROW_COUNT=${SAMPLE_INFO_ARRAY[7]}
UNIQUE_ID_SM_TAG=$(echo $SM_TAG | sed 's/@/_/g') # If there is an @ in the qsub or holdId name it breaks
BARCODE_2D=$(echo $SM_TAG | awk '{split($1,SM_TAG,/[@-]/); print SM_TAG[2]}') # SM_TAG = RIS_ID[@-]BARCODE_2D
}
# for each sample make a bunch directories if not already present in the samples defined project directory
MAKE_PROJ_DIR_TREE ()
{
mkdir -p \
${CORE_PATH}/$PROJECT_SAMPLE/{TEMP,LOGS,COMMAND_LINES} \
${CORE_PATH}/$PROJECT_SAMPLE/REPORTS/CONCORDANCE_MS \
${CORE_PATH}/${PROJECT_MS}/TEMP/${SM_TAG} \
${CORE_PATH}/${PROJECT_MS}/LOGS/${SM_TAG}
}
###################################################
### fix common formatting problems in bed files ###
### create picard style interval files ############
### DO PER SAMPLE #################################
###################################################
FIX_BED_FILES ()
{
echo \
qsub \
${QSUB_ARGS} \
-N A00-FIX_BED_FILES_${UNIQUE_ID_SM_TAG}_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_SAMPLE}/LOGS/${SM_TAG}/${SM_TAG}-FIX_BED_FILES.log \
${COMMON_GRCH38_SCRIPT_DIR}/A00-FIX_BED_FILES.sh \
${ALIGNMENT_CONTAINER} \
${CORE_PATH} \
${PROJECT_MS} \
${SM_TAG} \
${BAIT_BED} \
${TARGET_BED} \
${TITV_BED} \
${REF_DICT} \
${HG38_TO_HG19_CHAIN} \
${HG19_DICT} \
${SAMPLE_SHEET}
}
for SAMPLE in $(awk 'BEGIN {FS=","} NR>1 {print $8}' ${SAMPLE_SHEET} | sort | uniq )
do
CREATE_SAMPLE_INFO_ARRAY
MAKE_PROJ_DIR_TREE
FIX_BED_FILES
echo sleep 0.1s
done
#######################################################################
#######################################################################
################# Scatter of Joint Calling ############################
#######################################################################
#######################################################################
# aggregate all of individual g.vcf into one cohort g.vcf per bed file chunk
COMBINE_GVCF ()
{
echo \
qsub \
${QSUB_ARGS} \
-N A01_COMBINE_GVCF_${PROJECT_MS}_${PGVCF_LIST_NAME}_${BED_FILE_NAME} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/A01_COMBINE_GVCF/A01_COMBINE_GVCF_${PGVCF_LIST_NAME}_${BED_FILE_NAME}.log \
${COMMON_SCRIPT_DIR}/A01_COMBINE_GVCF.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${CORE_PATH} \
${PROJECT_MS} \
${PGVCF_LIST} \
${PREFIX} \
${BED_FILE_NAME}
}
for BED_FILE in $(ls ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/BF*bed);
do
BED_FILE_NAME=$(basename $BED_FILE .bed)
for PGVCF_LIST in $(ls ${CORE_PATH}/${PROJECT_MS}/TEMP/SPLIT_LIST/*list)
do
PGVCF_LIST_NAME=$(basename $PGVCF_LIST .list)
COMBINE_GVCF
echo sleep 0.1s
done
done
#####################################################################
BUILD_HOLD_ID_GENOTYPE_GVCF ()
{
for PROJECT_A in ${PROJECT_MS};
# yeah, so uh, this looks bad, but I just needed a way to set a new project variable that equals the multi-sample project variable.
do
GENOTYPE_GVCF_HOLD_ID="-hold_jid "
for PGVCF_LIST in $(ls ${CORE_PATH}/$PROJECT_A/TEMP/SPLIT_LIST/*list)
do
PGVCF_LIST_NAME=$(basename $PGVCF_LIST .list)
GENOTYPE_GVCF_HOLD_ID=$GENOTYPE_GVCF_HOLD_ID'A01_COMBINE_GVCF_'$PROJECT_A'_'$PGVCF_LIST_NAME'_'${BED_FILE_NAME}','
done
done
}
# genotype the cohort g.vcf chunks
GENOTYPE_GVCF ()
{
echo \
qsub \
${QSUB_ARGS} \
-N B01_GENOTYPE_GVCF_${PROJECT_MS}_${BED_FILE_NAME} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/B01_GENOTYPE_GVCF/B01_GENOTYPE_GVCF_${BED_FILE_NAME}.log \
${GENOTYPE_GVCF_HOLD_ID} \
${COMMON_SCRIPT_DIR}/B01_GENOTYPE_GVCF.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${BED_FILE_NAME}
}
# add dnsnp ID, genotype summaries, gc percentage, variant class, tandem repeat units and homopolymer runs to genotyped g.vcf chunks.
VARIANT_ANNOTATOR ()
{
echo \
qsub \
${QSUB_ARGS} \
-N C${HACK}_${BED_FILE_NAME} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/C01_VARIANT_ANNOTATOR/C01_VARIANT_ANNOTATOR_${BED_FILE_NAME}.log \
-hold_jid B01_GENOTYPE_GVCF_${PROJECT_MS}_${BED_FILE_NAME} \
${COMMON_SCRIPT_DIR}/C01_VARIANT_ANNOTATOR.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${BED_FILE_NAME} \
${PROJECT_DBSNP}
}
# build a string of job names (comma delim) from the variant annotator scatter to store as variable to use as
# hold_jid for the cat variants gather (it's used in the next section after the for loop below)
GENERATE_CAT_VARIANTS_HOLD_ID ()
{
CAT_VARIANTS_HOLD_ID=$CAT_VARIANTS_HOLD_ID'C'${HACK}'_'${BED_FILE_NAME}','
}
# for each chunk of the original bed file, do combine gvcfs, then genotype gvcfs, then variant annotator
# then generate a string of all the variant annotator job names submitted
for BED_FILE in $(ls ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/BF*bed);
do
BED_FILE_NAME=$(basename $BED_FILE .bed)
BUILD_HOLD_ID_GENOTYPE_GVCF
GENOTYPE_GVCF
echo sleep 0.1s
VARIANT_ANNOTATOR
echo sleep 0.1s
GENERATE_CAT_VARIANTS_HOLD_ID
done
###############################
###############################
##### VCF Gather and VQSR #####
###############################
###############################
# use cat variants to gather up all of the vcf files above into one big file
# MIGHT WANT TO LOOK INTO GatherVcfs (Picard) here
# Other possibility is MergeVcfs (Picard)...GatherVcfs is supposedly used for scatter operations so hopefully more efficient
# The way that CatVariants is constructed, I think would cause a upper limit to the scatter operation.
CAT_VARIANTS ()
{
echo \
qsub \
${QSUB_ARGS} \
-N D01_CAT_VARIANTS_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/D01_CAT_VARIANTS.log \
-hold_jid ${CAT_VARIANTS_HOLD_ID} \
${COMMON_SCRIPT_DIR}/D01_CAT_VARIANTS.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX}
}
# run the snp vqsr model
# to do: find a better to push out an R version to build the plots
# right now, it's buried inside the shell script itself {grrrr}
VARIANT_RECALIBRATOR_SNV ()
{
echo \
qsub \
${QSUB_ARGS} \
-N E01_VARIANT_RECALIBRATOR_SNV_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/E01_VARIANT_RECALIBRATOR_SNV.log \
-hold_jid D01_CAT_VARIANTS_${PROJECT_MS} \
$SCRIPT_DIR/E01_VARIANT_RECALIBRATOR_SNV.sh \
${JAVA_1_8} \
${GATK_DIR} \
$REF_GENOME \
$HAPMAP_VCF \
$OMNI_VCF \
$ONEKG_SNPS_VCF \
$DBSNP_138_VCF \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
$R_DIRECTORY \
$SEND_TO
}
# run the indel vqsr model (concurrently done with the snp model above)
# to do: find a better to push out an R version to build the plots
# right now, it's buried inside the shell script itself {grrrr}
VARIANT_RECALIBRATOR_INDEL ()
{
echo \
qsub \
${QSUB_ARGS} \
-N E02_VARIANT_RECALIBRATOR_INDEL_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/E02_VARIANT_RECALIBRATOR_INDEL.log \
-hold_jid D01_CAT_VARIANTS_${PROJECT_MS} \
$SCRIPT_DIR/E02_VARIANT_RECALIBRATOR_INDEL.sh \
${JAVA_1_8} \
${GATK_DIR} \
$REF_GENOME \
$ONEKG_INDELS_VCF \
$AXIOM_VCF \
$DBSNP_138_VCF \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
$R_DIRECTORY
}
# apply the snp vqsr model to the full vcf
# this wait for both the snp and indel models to be done generating before running.
APPLY_RECALIBRATION_SNV ()
{
echo \
qsub \
${QSUB_ARGS} \
-N F01_APPLY_RECALIBRATION_SNV_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/F01_APPLY_RECALIBRATION_SNV.log \
-hold_jid E01_VARIANT_RECALIBRATOR_SNV_${PROJECT_MS} \
${COMMON_VQSR_SCRIPT_DIR}/F01_APPLY_RECALIBRATION_SNV.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${SNP_SENSITIVITY}
}
# now apply the indel vqsr model to the full vcf file
# honestly can do vqsr indel+vqsr snp, apply vqsr indel after vqsr indel done. vqsr snp waits for apply vqsr indel and vqsr snp...a little more efficient.
APPLY_RECALIBRATION_INDEL ()
{
echo \
qsub \
${QSUB_ARGS} \
-N G01_APPLY_RECALIBRATION_INDEL_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/G01_APPLY_RECALIBRATION_INDEL.log \
-hold_jid F01_APPLY_RECALIBRATION_SNV_${PROJECT_MS},E02_VARIANT_RECALIBRATOR_INDEL_${PROJECT_MS} \
${COMMON_VQSR_SCRIPT_DIR}/G01_APPLY_RECALIBRATION_INDEL.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${INDEL_SENSITIVITY}
}
# call cat variants and vqsr
CAT_VARIANTS
echo sleep 0.1s
VARIANT_RECALIBRATOR_SNV
echo sleep 0.1s
VARIANT_RECALIBRATOR_INDEL
echo sleep 0.1s
APPLY_RECALIBRATION_SNV
echo sleep 0.1s
APPLY_RECALIBRATION_INDEL
echo sleep 0.1s
##################################################
##################################################
##### SCATTER FOR GENOTYPE REFINEMENT ############
##################################################
##################################################
# do a scatter of genotype refinement using the same chunked bed files use to the g.vcf aggregation
# external priors used are the final 1kg genomes dataset, exac v0.3, no family priors used (no ped file)
CALCULATE_GENOTYPE_POSTERIORS ()
{
echo \
qsub \
${QSUB_ARGS} \
-N H01_CALCULATE_GENOTYPE_POSTERIORS_${PROJECT_MS}_${BED_FILE_NAME} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/H01_CALCULATE_GENOTYPE_POSTERIORS/H01_CALCULATE_GENOTYPE_POSTERIORS_${BED_FILE_NAME}.log \
-hold_jid G01_APPLY_RECALIBRATION_INDEL_${PROJECT_MS} \
${COMMON_SCRIPT_DIR}/H01_CALCULATE_GENOTYPE_POSTERIORS.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${P3_1KG} \
${ExAC} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${BED_FILE_NAME}
}
# recalculate the genotype summaries for the now refined genotypes for each vcf chunk
LIFTOVER_HG19_REFINED ()
{
echo \
qsub \
${QSUB_ARGS} \
-N I${HACK}J_${BED_FILE_NAME} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/I02_LIFTOVER_HG19_REFINED/I02_LIFTOVER_HG19_REFINED_${BED_FILE_NAME}.log \
-hold_jid H01_CALCULATE_GENOTYPE_POSTERIORS_${PROJECT_MS}_${BED_FILE_NAME} \
${COMMON_GRCH38_SCRIPT_DIR}/I02_REFINED_LIFTOVER_VARIANTS.sh \
${PICARD_LIFTOVER_CONTAINER} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${BED_FILE_NAME} \
${HG19_REF} \
${HG38_TO_HG19_CHAIN} \
${SAMPLE_SHEET} \
${SUBMIT_STAMP}
}
# recalculate the genotype summaries for the now refined genotypes for each vcf chunk
VARIANT_ANNOTATOR_REFINED ()
{
echo \
qsub \
${QSUB_ARGS} \
-N I${HACK}_${BED_FILE_NAME} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/I01_VARIANT_ANNOTATOR_REFINED/I01_VARIANT_ANNOTATOR_REFINED_${BED_FILE_NAME}.log \
-hold_jid H01_CALCULATE_GENOTYPE_POSTERIORS_${PROJECT_MS}_${BED_FILE_NAME} \
${COMMON_SCRIPT_DIR}/I01_VARIANT_ANNOTATOR_REFINED.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${PROJECT_DBSNP} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${BED_FILE_NAME}
}
# build a string of job names (comma delim) from the variant annotator scatter to store as variable to use as
# hold_jid for the cat variants gather and liftover gather (it's used in the next section after the for loop below)
GENERATE_CAT_REFINED_VARIANTS_HOLD_ID ()
{
CAT_REFINED_VARIANTS_HOLD_ID=${CAT_REFINED_VARIANTS_HOLD_ID}I${HACK}_${BED_FILE_NAME},
COMBINE_REFINED_LIFTOVER_VARIANTS_HOLD_ID=${COMBINE_REFINED_LIFTOVER_VARIANTS_HOLD_ID}I${HACK}J_${BED_FILE_NAME},
}
# for each chunk of the original bed file, do calculate_genotype_posteriors, then variant annotator
# then generate a string of all the variant annotator job names submitted
for BED_FILE in \
$(ls ${CORE_PATH}/${PROJECT_MS}/TEMP/BED_FILE_SPLIT/BF*);
do
BED_FILE_NAME=$(basename $BED_FILE .bed)
CALCULATE_GENOTYPE_POSTERIORS
echo sleep 0.1s
LIFTOVER_HG19_REFINED
echo sleep 0.1s
VARIANT_ANNOTATOR_REFINED
echo sleep 0.1s
GENERATE_CAT_REFINED_VARIANTS_HOLD_ID
done
#########################################################
#########################################################
##### GT Refined VCF Gather #############################
##### Multi-Sample VCF ANNOVAR ##########################
##### VARIANT SUMMARY STATS VCF BREAKOUTS ###############
#########################################################
#########################################################
# use cat variants to gather up all of the gt refined, reannotated vcf files above into one big file
CAT_REFINED_VARIANTS ()
{
echo \
qsub \
-S /bin/bash \
-cwd \
-V \
-q ${QUEUE_LIST} \
-p ${PRIORITY} \
-j y \
-N J01_CAT_REFINED_VARIANTS_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/J01_CAT_REFINED_VARIANTS.log \
-hold_jid ${CAT_REFINED_VARIANTS_HOLD_ID} \
${COMMON_SCRIPT_DIR}/J01_CAT_REFINED_VARIANTS.sh \
${JAVA_1_8} \
${GATK_DIR} \
${REF_GENOME} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX}
}
# use combine variants to gather up and sort all of the gt refined vcf files above into one big file
COMBINE_REFINED_LIFTOVER_VARIANTS ()
{
echo \
qsub \
${QSUB_ARGS} \
-N J02_COMBINE_REFINED_LIFTOVER_VARIANTS_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/J02_COMBINE_REFINED_LIFTOVER_VARIANTS.log \
-hold_jid ${COMBINE_REFINED_LIFTOVER_VARIANTS_HOLD_ID} \
${COMMON_GRCH38_SCRIPT_DIR}/J02_COMBINE_REFINED_LIFTOVER_VARIANTS.sh \
${JAVA_1_8} \
${GATK_DIR} \
${HG19_REF} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX}
}
# GENERATE GT REFINED VCF METRICS FOR ENTIRE DATASET (INCLUDING PER SAMPLE)
VCF_METRICS_BAIT ()
{
echo \
qsub \
${QSUB_ARGS} \
-N J01A03-VCF_METRICS_BAIT_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/J01A03-VCF_METRICS_BAIT.log \
-hold_jid J01_CAT_REFINED_VARIANTS_${PROJECT_MS} \
${COMMON_SCRIPT_DIR}/J01A03-VCF_METRICS_BAIT.sh \
${JAVA_1_8} \
${GATK_DIR_4011} \
${REF_DICT} \
${PROJECT_DBSNP} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${SAMPLE_SHEET} \
${SUBMIT_STAMP}
}
# GENERATE GT REFINED VCF METRICS FOR ENTIRE DATASET (INCLUDING PER SAMPLE) ON TARGET BED FILE
VCF_METRICS_TARGET ()
{
echo \
qsub \
${QSUB_ARGS} \
-N J01A04-VCF_METRICS_TARGET_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/J01A04-VCF_METRICS_TARGET.log \
-hold_jid J01_CAT_REFINED_VARIANTS_${PROJECT_MS} \
${COMMON_SCRIPT_DIR}/J01A04-VCF_METRICS_TARGET.sh \
${JAVA_1_8} \
${GATK_DIR_4011} \
${REF_DICT} \
${PROJECT_DBSNP} \
${CORE_PATH} \
${PROJECT_MS} \
${PROJECT_TARGET_BED} \
${PREFIX} \
${SAMPLE_SHEET} \
${SUBMIT_STAMP}
}
# GENERATE GT REFINED VCF METRICS FOR ENTIRE DATASET (INCLUDING PER SAMPLE) ON TARGET BED FILE
VCF_METRICS_TITV ()
{
echo \
qsub \
${QSUB_ARGS} \
-N J01A05-VCF_METRICS_TITV_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/J01A05-VCF_METRICS_TITV.log \
-hold_jid J01_CAT_REFINED_VARIANTS_${PROJECT_MS} \
${COMMON_SCRIPT_DIR}/J01A05-VCF_METRICS_TITV.sh \
${JAVA_1_8} \
${GATK_DIR_4011} \
${REF_DICT} \
${KNOWN_SNPS} \
${CORE_PATH} \
${PROJECT_MS} \
${PROJECT_TITV_BED} \
${PREFIX} \
${SAMPLE_SHEET} \
${SUBMIT_STAMP}
}
# bgzip and index genotype refined vcf
BGZIP_INDEX_REFINED_VARIANTS ()
{
echo \
qsub \
${QSUB_ARGS} \
-N J01A01_BGZIP_INDEX_${PROJECT_MS} \
-o ${CORE_PATH}/${PROJECT_MS}/LOGS/J01A01_BGZIP_INDEX_VARIANTS.log \
-hold_jid J01_CAT_REFINED_VARIANTS_${PROJECT_MS} \
${COMMON_SCRIPT_DIR}/J01A01_BGZIP_INDEX_VARIANTS.sh \
${TABIX_DIR} \
${CORE_PATH} \
${PROJECT_MS} \
${PREFIX} \
${SEND_TO}
}
#################################################################################################
### generate separate sample lists for hapmap samples and study samples #########################
### these are to do breakouts of the refined multi-sample vcf for Hua's variant summary stats ###
#################################################################################################
# generate list files by parsing the header of the final ms vcf file
GENERATE_STUDY_HAPMAP_SAMPLE_LISTS ()
{
HAP_MAP_SAMPLE_LIST=$(echo ${CORE_PATH}/${PROJECT_MS}/MULTI_SAMPLE/VARIANT_SUMMARY_STAT_VCF/${PREFIX}_hapmap_samples.args)
MENDEL_SAMPLE_LIST=$(echo ${CORE_PATH}/${PROJECT_MS}/MULTI_SAMPLE/VARIANT_SUMMARY_STAT_VCF/${PREFIX}_study_samples.args)