Skip to content

Commit

Permalink
Merge pull request #167 from LCR-BCCRC/modules/slms-3/1.0
Browse files Browse the repository at this point in the history
Fix Mutect2 renaming rule, make manta augment vcf script a parameter not an input.
  • Loading branch information
lkhilton authored Jan 18, 2021
2 parents e34a146 + 37e06c7 commit e80e830
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 22 deletions.
2 changes: 2 additions & 0 deletions modules/manta/2.0/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ lcr-modules:
# Available wildcards: {seq_type} {genome_build} {sample_id}
sample_bam: null # UPDATE
sample_bai: null # UPDATE

scripts:
augment_manta_vcf: "{SCRIPTSDIR}/augment_manta_vcf/1.0/augment_manta_vcf.py"

options:
Expand Down
8 changes: 4 additions & 4 deletions modules/manta/2.0/manta.smk
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ rule _manta_run:
# and fixes the sample IDs in the VCF header to match sample IDs used in Snakemake
rule _manta_augment_vcf:
input:
variants_dir = rules._manta_run.output.variants_dir,
aug_vcf = CFG["inputs"]["augment_manta_vcf"]
variants_dir = rules._manta_run.output.variants_dir
output:
vcf = CFG["dirs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/{vcf_name}.augmented.vcf"
log:
stdout = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stdout.log",
stderr = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stderr.log"
params:
opts = CFG["options"]["augment_vcf"]
opts = CFG["options"]["augment_vcf"],
aug_vcf = CFG["scripts"]["augment_manta_vcf"]
conda:
CFG["conda_envs"]["augment_manta_vcf"]
threads:
Expand All @@ -167,7 +167,7 @@ rule _manta_augment_vcf:
mem_mb = CFG["mem_mb"]["augment_vcf"]
shell:
op.as_one_line("""
{input.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
{params.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
--vcf_type {wildcards.vcf_name} {input.variants_dir}/{wildcards.vcf_name}.vcf.gz {output.vcf}
> {log.stdout} 2> {log.stderr}
""")
Expand Down
2 changes: 2 additions & 0 deletions modules/manta/2.1/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ lcr-modules:
# Available wildcards: {seq_type} {genome_build} {sample_id}
sample_bam: "__UPDATE__"
sample_bai: "__UPDATE__"

scripts:
augment_manta_vcf: "{SCRIPTSDIR}/augment_manta_vcf/1.0/augment_manta_vcf.py"

options:
Expand Down
8 changes: 4 additions & 4 deletions modules/manta/2.1/manta.smk
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ rule _manta_run:
# and fixes the sample IDs in the VCF header to match sample IDs used in Snakemake
rule _manta_augment_vcf:
input:
variants_dir = rules._manta_run.output.variants_dir,
aug_vcf = CFG["inputs"]["augment_manta_vcf"]
variants_dir = rules._manta_run.output.variants_dir
output:
vcf = CFG["dirs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/{vcf_name}.augmented.vcf"
log:
stdout = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stdout.log",
stderr = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stderr.log"
params:
opts = CFG["options"]["augment_vcf"]
opts = CFG["options"]["augment_vcf"],
aug_vcf = CFG["scripts"]["augment_manta_vcf"]
conda:
CFG["conda_envs"]["augment_manta_vcf"]
threads:
Expand All @@ -167,7 +167,7 @@ rule _manta_augment_vcf:
mem_mb = CFG["mem_mb"]["augment_vcf"]
shell:
op.as_one_line("""
{input.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
{params.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
--vcf_type {wildcards.vcf_name} {input.variants_dir}/{wildcards.vcf_name}.vcf.gz {output.vcf}
> {log.stdout} 2> {log.stderr}
""")
Expand Down
2 changes: 2 additions & 0 deletions modules/manta/2.2/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ lcr-modules:
# Available wildcards: {seq_type} {genome_build} {sample_id}
sample_bam: "__UPDATE__"
sample_bai: "__UPDATE__"

scripts:
augment_manta_vcf: "{SCRIPTSDIR}/augment_manta_vcf/1.0/augment_manta_vcf.py"

options:
Expand Down
8 changes: 4 additions & 4 deletions modules/manta/2.2/manta.smk
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ rule _manta_run:
# and fixes the sample IDs in the VCF header to match sample IDs used in Snakemake
rule _manta_augment_vcf:
input:
variants_dir = str(rules._manta_run.output.variants_dir),
aug_vcf = CFG["inputs"]["augment_manta_vcf"]
variants_dir = str(rules._manta_run.output.variants_dir)
output:
vcf = CFG["dirs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/{vcf_name}.augmented.vcf"
log:
stdout = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stdout.log",
stderr = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stderr.log"
params:
opts = CFG["options"]["augment_vcf"]
opts = CFG["options"]["augment_vcf"],
aug_vcf = CFG["scripts"]["augment_manta_vcf"]
conda:
CFG["conda_envs"]["augment_manta_vcf"]
threads:
Expand All @@ -167,7 +167,7 @@ rule _manta_augment_vcf:
mem_mb = CFG["mem_mb"]["augment_vcf"]
shell:
op.as_one_line("""
{input.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
{params.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
--vcf_type {wildcards.vcf_name} {input.variants_dir}/{wildcards.vcf_name}.vcf.gz {output.vcf}
> {log.stdout} 2> {log.stderr}
""")
Expand Down
2 changes: 2 additions & 0 deletions modules/manta/2.3/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ lcr-modules:
# Available wildcards: {seq_type} {genome_build} {sample_id}
sample_bam: "__UPDATE__"
sample_bai: "__UPDATE__"

scripts:
augment_manta_vcf: "{SCRIPTSDIR}/augment_manta_vcf/1.1/augment_manta_vcf.py"

options:
Expand Down
8 changes: 4 additions & 4 deletions modules/manta/2.3/manta.smk
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ rule _manta_run:
# and fixes the sample IDs in the VCF header to match sample IDs used in Snakemake
rule _manta_augment_vcf:
input:
variants_dir = str(rules._manta_run.output.variants_dir),
aug_vcf = CFG["inputs"]["augment_manta_vcf"]
variants_dir = str(rules._manta_run.output.variants_dir)
output:
vcf = CFG["dirs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/{vcf_name}.augmented.vcf"
log:
stdout = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stdout.log",
stderr = CFG["logs"]["augment_vcf"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/manta_augment_vcf.{vcf_name}.stderr.log"
params:
opts = CFG["options"]["augment_vcf"]
opts = CFG["options"]["augment_vcf"],
aug_vcf = CFG["scripts"]["augment_manta_vcf"]
conda:
CFG["conda_envs"]["augment_manta_vcf"]
threads:
Expand All @@ -170,7 +170,7 @@ rule _manta_augment_vcf:
mem_mb = CFG["mem_mb"]["augment_vcf"]
shell:
op.as_one_line("""
{input.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
{params.aug_vcf} {params.opts} --tumour_id {wildcards.tumour_id} --normal_id {wildcards.normal_id}
--vcf_type {wildcards.vcf_name} {input.variants_dir}/{wildcards.vcf_name}.vcf.gz {output.vcf}
> {log.stdout} 2> {log.stderr}
""")
Expand Down
16 changes: 10 additions & 6 deletions modules/slms_3/1.0/slms_3.smk
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ rule _slms_3_mutect2_depth_filt:
table = str(rules._slms_3_mutect2_samples_table.output.table)
output:
vcf = CFG_SLMS3["dirs"]["mutect2_depth_filt"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}.depthfilt.mutect2.combined.vcf.gz",
tbi = CFG_SLMS3["dirs"]["mutect2_depth_filt"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}.depthfilt.mutect2.combined.vcf.gz.tbi",
samples = temp(CFG_SLMS3["dirs"]["mutect2_depth_filt"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}.samples.txt")
tbi = CFG_SLMS3["dirs"]["mutect2_depth_filt"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}.depthfilt.mutect2.combined.vcf.gz.tbi"
log:
stderr = CFG_SLMS3["logs"]["mutect2_depth_filt"] + "{seq_type}--{genome_build}/{tumour_id}--{normal_id}--{pair_status}/mutect2_depth_filt.stderr.log"
conda:
Expand All @@ -302,10 +301,10 @@ rule _slms_3_mutect2_depth_filt:
op.as_one_line("""
tsamp=$(zgrep "##tumor_sample=" {input.vcf} | sed 's|##tumor_sample=||g');
nsamp=$(zgrep "##normal_sample=" {input.vcf} | sed 's|##normal_sample=||g');
printf "$tsamp TUMOR\\n$nsamp NORMAL\\n" > {output.samples} &&
bcftools reheader -s {output.samples} {input.vcf} 2> {log.stderr} |
bcftools view {input.vcf} |
sed "s|$tsamp|TUMOR|g" | sed "s|$nsamp|NORMAL|g" |
bcftools view -s "NORMAL,TUMOR" -i 'FMT/DP[@{input.table}] >= 10 && FMT/AD[@{input.table}:1] >= 4 && FMT/AF[@{input.table}:0] >= 0.1'
-Oz -o {output.vcf} 2>> {log.stderr} &&
-Oz -o {output.vcf} 2> {log.stderr} &&
tabix -p vcf {output.vcf} 2>> {log.stderr}
""")

Expand Down Expand Up @@ -427,7 +426,12 @@ rule _slms_3_output_vcf:
# Generates the target sentinels for each run, which generate the symlinks
rule _slms_3_all:
input:
# rules._starfish_all.input,
rules._manta_all.input,
rules._strelka_all.input,
rules._lofreq_all.input,
rules._sage_all.input,
rules._mutect2_all.input,
rules._starfish_all.input,
expand(
[
str(rules._slms_3_output_vcf.output.isec_vcf),
Expand Down

0 comments on commit e80e830

Please sign in to comment.