-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.txt
executable file
·157 lines (113 loc) · 4.74 KB
/
commands.txt
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
## Commands
This section lists command(s) run by variantEffectPredictor workflow
* Running variantEffectPredictor
### Derive a chromosome-specific scaling coefficient
```
CHR_LEN=$(zcat ~{inputVcf} | head -n 800 | grep contig | grep -w ~{chromosome} | grep -v _ | sed -r 's/.*length=([[:digit:]]+)./\1/')
LARGEST=$(zcat ~{inputVcf} | head -n 800 | grep contig | grep -v _ | sed -r 's/.*length=([[:digit:]]+)./\1/' | sort -n | tail -n 1)
echo | awk -v chr_len=$CHR_LEN -v largest_chr=$LARGEST '{print int((chr_len/largest_chr + 0.1) * 10)/10}'
```
### targetBedTask - extract variants overlapping intervals from a .bed file
```
set -euo pipefail
bedtools intersect -header -u \
-a ~{vcfFile} \
-b ~{targetBed} \
> ~{basename}.targeted.vcf
bgzip -c ~{basename}.targeted.vcf > ~{basename}.targeted.vcf.gz
tabix -p vcf ~{basename}.targeted.vcf.gz
```
### Retrieve all chromosomes from vcf file
This ensures that we split only by those chromosomes for which we have records
```
zgrep -v ^# ~{vcfFile} | cut -f 1 | uniq
```
### Split vcf file by chromosome
```
set -euo pipefail
bcftools view -r ~{regions} ~{vcfFile} | bgzip -c > ~{basename}.vcf.gz
```
### Run variant effect prediction
```
set -euo pipefail
if [ "~{species}" = "homo_sapiens" ]; then
human_only_command_line="--polyphen b --af --af_1kg --af_esp --af_gnomad"
else
human_only_command_line=""
fi
if ~{vepStats} ; then
vepStats_command_line=""
else
vepStats_command_line="--no_stats"
fi
vep --offline --dir ~{vepCacheDir} -i ~{vcfFile} --fasta ~{referenceFasta} --species ~{species} \
--assembly ~{ncbiBuild} --custom ~{customTranscriptFile},,gtf -o ~{basename}.vep.vcf.gz --vcf --compress_output bgzip ~{addParam} \
--no_progress --sift b --ccds --uniprot --hgvs --symbol --numbers --domains --gene_phenotype --mane \
--canonical --protein --biotype --uniprot --tsl --variant_class --check_existing --total_length \
--allele_number --no_escape --xref_refseq --failed 1 --flag_pick_allele \
--pick_order canonical,tsl,biotype,rank,ccds,length \
$vepStats_command_line \
$human_only_command_line \
--pubmed --fork 4 --regulatory
```
### getSampleNames
```
set -euo pipefail
TUMR="~{tumorName}"
if [ -z "~{normalName}" ]; then
NORM="unmatched";
else NORM="~{normalName}";
fi
echo $TUMR > names.txt
echo $NORM >> names.txt
```
### tumorOnlyAlign task
```
set -euo pipefail
if ~{updateTagValue} ; then
zcat ~{vcfFile} | sed s/Number\=A/Number\=./ | sed s/Number\=R/Number\=./ > "~{basename}_temporary.vcf"
cat ~{basename}_temporary.vcf | sed 's/QSS\,Number\=A/QSS\,Number\=\./' | sed 's/AS_FilterStatus\,Number\=A/AS_FilterStatus\,Number\=\./' | bgzip -c > "~{basename}_input.vcf.gz"
else
zcat ~{vcfFile} | sed 's/QSS\,Number\=A/QSS\,Number\=\./' | sed 's/AS_FilterStatus\,Number\=A/AS_FilterStatus\,Number\=\./' | bgzip -c > "~{basename}_input.vcf.gz"
fi
tabix -p vcf "~{basename}_input.vcf.gz"
cat ~{tumorNormalNames} > "~{basename}_header"
bcftools merge "~{basename}_input.vcf.gz" "~{basename}_input.vcf.gz" --force-samples > "~{basename}.temp_tumor.vcf"
bcftools reheader -s "~{basename}_header" "~{basename}.temp_tumor.vcf" > "~{basename}.unmatched.vcf"
bgzip -c "~{basename}.unmatched.vcf" > "~{basename}.unmatched.vcf.gz"
tabix -p vcf "~{basename}.unmatched.vcf.gz"
```
### vcf2maf conversion
```
set -euo pipefail
TUMR=$(sed -n 1p ~{tumorNormalNames} )
NORM=$(sed -n 2p ~{tumorNormalNames} )
bgzip -c -d ~{vcfFile} > ~{basename}
if ~{retainInfoProvided} ; then
retainInfo_command_line="--retain-info MBQ,MMQ,TLOD,set"
else
retainInfo_command_line=""
fi
vcf2maf --ref-fasta ~{referenceFasta} --species ~{species} --ncbi-build ~{ncbiBuild} \
--input-vcf ~{basename} --output-maf ~{basename}.maf \
--tumor-id $TUMR --normal-id $NORM --vcf-tumor-id $TUMR --vcf-normal-id $NORM \
--vep-path ~{vepPath} --vep-data ~{vepCacheDir} \
--min-hom-vaf ~{minHomVaf} --buffer-size ~{bufferSize} \
$retainInfo_command_line \
--vep-stats ~{vepStats} \
--custom-enst ~{customTranscriptENSTids}
```
### mergeMafs
```
set -euo pipefail
head -n 2 ~{mafs[0]} > ~{basename}
cat ~{sep=" " mafs} | grep -v ^# | grep -v "Hugo_Symbol" >> ~{basename}
bgzip -c ~{basename} > ~{basename}.maf.gz
```
### Merging vcf files
```
set -euo pipefail
gatk --java-options "-Xmx~{jobMemory - overhead}G" MergeVcfs \
-I ~{sep=" -I " vcfs} ~{extraArgs} \
-O ~{basename}.vcf.gz
```