diff --git a/workflow/rules/call_variants.smk b/workflow/rules/call_variants.smk index d5603a5..9e0df92 100644 --- a/workflow/rules/call_variants.smk +++ b/workflow/rules/call_variants.smk @@ -2,18 +2,32 @@ rule get_sample_names: input: normal=lambda wildcards: get_normal_bam(wildcards), - tumoral= lambda wildcards: get_tumoral_bam(wildcards), + tumoral=lambda wildcards: get_tumoral_bam(wildcards), output: - normal=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tmp/{sample}_normal.samplename.txt"), - tumor=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tmp/{sample}_tumor.samplename.txt") + normal=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tmp/{sample}_normal.samplename.txt", + ), + tumor=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tmp/{sample}_tumor.samplename.txt", + ), params: - custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"),multiply_by=5) + custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), log: - normal=resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/getsamplename/{sample}.gsn.log"), - tumor=resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/getsamplename/{sample}.gsn_tumor.log") + normal=resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/getsamplename/{sample}.gsn.log", + ), + tumor=resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/getsamplename/{sample}.gsn_tumor.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") - threads: conservative_cpu_count(reserve_cores=2,max_cores=99) + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) + threads: conservative_cpu_count(reserve_cores=2, max_cores=99) shell: "gatk " "--java-options {params.custom} " @@ -28,32 +42,59 @@ rule get_sample_names: "-O {output.normal} " ">& {log.normal} " + rule mutect_matched: input: normal=lambda wildcards: get_normal_bam(wildcards), - tumoral= lambda wildcards: get_tumoral_bam(wildcards), - normal_name=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tmp/{sample}_normal.samplename.txt"), - tumor_name=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tmp/{sample}_tumor.samplename.txt") + tumoral=lambda wildcards: get_tumoral_bam(wildcards), + normal_name=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tmp/{sample}_normal.samplename.txt", + ), + tumor_name=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tmp/{sample}_tumor.samplename.txt", + ), output: - vcf=resolve_results_filepath(config.get("paths").get("results_dir"),"results/matched/{sample}_somatic.vcf.gz"), - bam=resolve_results_filepath(config.get("paths").get("results_dir"),"results/matched/{sample}_tumor_normal.bam"), - fir=resolve_results_filepath(config.get("paths").get("results_dir"),"results/matched/{sample}_tumor_normal_f1r2.tar.gz"), - stats=resolve_results_filepath(config.get("paths").get("results_dir"),"results/matched/{sample}_somatic.vcf.gz.stats") + vcf=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/matched/{sample}_somatic.vcf.gz", + ), + bam=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/matched/{sample}_tumor_normal.bam", + ), + fir=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/matched/{sample}_tumor_normal_f1r2.tar.gz", + ), + stats=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/matched/{sample}_somatic.vcf.gz.stats", + ), params: custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), genome=config.get("resources").get("reference"), - intervals=resolve_single_filepath(config.get("paths").get("workdir"),resolve_single_filepath("resources",config.get("resources").get("bed"))), + intervals=resolve_single_filepath( + config.get("paths").get("workdir"), + resolve_single_filepath("resources", config.get("resources").get("bed")), + ), param=config.get("params").get("gatk").get("Mutect"), germline_resource=config.get("params").get("gatk").get("germline"), - normal_bam = lambda wildcards, input: get_name(input.normal_name), - tumor_bam= lambda wildcards,input: get_name(input.tumor_name) + normal_bam=lambda wildcards, input: get_name(input.normal_name), + tumor_bam=lambda wildcards, input: get_name(input.tumor_name), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}.mutect.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}.mutect.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk " "--java-options {params.custom} " @@ -74,21 +115,30 @@ rule mutect_matched: "--f1r2-tar-gz {output.fir} " ">& {log} " + rule learn_orientation_model: input: - rules.mutect_matched.output.fir + rules.mutect_matched.output.fir, output: - resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/matched/{sample}_read-orientation-model.tar.gz") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/matched/{sample}_read-orientation-model.tar.gz", + ), params: custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), - exac=config.get("params").get("gatk").get("exac") + exac=config.get("params").get("gatk").get("exac"), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}_pileupsummaries_T.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}_pileupsummaries_T.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk LearnReadOrientationModel " "--java-options {params.custom} " @@ -96,22 +146,34 @@ rule learn_orientation_model: "-O {output} " ">& {log} " + rule pileup_summaries_tumoral: input: - tumoral= lambda wildcards: get_tumoral_bam(wildcards) + tumoral=lambda wildcards: get_tumoral_bam(wildcards), output: - resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/matched/{sample}_getpileupsummaries.table") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/matched/{sample}_getpileupsummaries.table", + ), params: custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), - intervals=resolve_single_filepath(config.get("paths").get("workdir"),resolve_single_filepath("resources",config.get("resources").get("bed"))), - exac=config.get("params").get("gatk").get("exac") + intervals=resolve_single_filepath( + config.get("paths").get("workdir"), + resolve_single_filepath("resources", config.get("resources").get("bed")), + ), + exac=config.get("params").get("gatk").get("exac"), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}_pileupsummaries_T.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}_pileupsummaries_T.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk GetPileupSummaries " "--java-options {params.custom} " @@ -121,22 +183,34 @@ rule pileup_summaries_tumoral: "-O {output} " ">& {log} " + rule pileup_summaries_normal: input: - normal=lambda wildcards: get_normal_bam(wildcards) + normal=lambda wildcards: get_normal_bam(wildcards), output: - resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/matched/{sample}_normal_pileups.table") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/matched/{sample}_normal_pileups.table", + ), params: custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), - intervals=resolve_single_filepath(config.get("paths").get("workdir"),resolve_single_filepath("resources",config.get("resources").get("bed"))), - exac=config.get("params").get("gatk").get("exac") + intervals=resolve_single_filepath( + config.get("paths").get("workdir"), + resolve_single_filepath("resources", config.get("resources").get("bed")), + ), + exac=config.get("params").get("gatk").get("exac"), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}_pileupsummaries_C.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}_pileupsummaries_C.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk GetPileupSummaries " "--java-options {params.custom} " @@ -146,22 +220,34 @@ rule pileup_summaries_normal: "-O {output} " ">& {log} " + rule calculate_contamination: input: tab_t=rules.pileup_summaries_tumoral.output, - tab_c=rules.pileup_summaries_normal.output + tab_c=rules.pileup_summaries_normal.output, output: - table=resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/matched/{sample}_contamination.table"), - segment=resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/matched/{sample}_tumor.segment") + table=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/matched/{sample}_contamination.table", + ), + segment=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/matched/{sample}_tumor.segment", + ), params: - custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"),multiply_by=5) + custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}_calculatecontamination.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}_calculatecontamination.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk CalculateContamination " "--java-options {params.custom} " diff --git a/workflow/rules/call_variants_tumoronly.smk b/workflow/rules/call_variants_tumoronly.smk index e74d5ef..12f7857 100644 --- a/workflow/rules/call_variants_tumoronly.smk +++ b/workflow/rules/call_variants_tumoronly.smk @@ -1,18 +1,26 @@ # TUMOR-ONLY CALL WORKFLOW rule get_tumoronly_sample_names: input: - tumoral= lambda wildcards: get_tumoral_bam(wildcards) + tumoral=lambda wildcards: get_tumoral_bam(wildcards), output: - tumor=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tmp/tumoronly/{sample}_tumor.samplename.txt") + tumor=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tmp/tumoronly/{sample}_tumor.samplename.txt", + ), params: - custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"),multiply_by=5) + custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/getsamplename/{sample}.gsn.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/getsamplename/{sample}.gsn.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") - threads: conservative_cpu_count(reserve_cores=2,max_cores=99) + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) + threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk " "--java-options {params.custom} " @@ -21,29 +29,53 @@ rule get_tumoronly_sample_names: "-O {output.tumor} " ">& {log} " + rule mutect_tumoronly: input: - tumoral= lambda wildcards: get_tumoral_bam(wildcards), - tumor_name=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tmp/tumoronly/{sample}_tumor.samplename.txt") + tumoral=lambda wildcards: get_tumoral_bam(wildcards), + tumor_name=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tmp/tumoronly/{sample}_tumor.samplename.txt", + ), output: - vcf=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tumoronly/{sample}_somatic.vcf.gz"), - bam=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tumoronly/{sample}_tumor_normal.bam"), - fir=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tumoronly/{sample}_tumor_normal_f1r2.tar.gz"), - stats=resolve_results_filepath(config.get("paths").get("results_dir"),"results/tumoronly/{sample}_somatic.vcf.gz.stats") + vcf=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tumoronly/{sample}_somatic.vcf.gz", + ), + bam=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tumoronly/{sample}_tumor_normal.bam", + ), + fir=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tumoronly/{sample}_tumor_normal_f1r2.tar.gz", + ), + stats=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/tumoronly/{sample}_somatic.vcf.gz.stats", + ), params: custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), genome=config.get("resources").get("reference"), - intervals=resolve_single_filepath(config.get("paths").get("workdir"),resolve_single_filepath("resources",config.get("resources").get("bed"))), + intervals=resolve_single_filepath( + config.get("paths").get("workdir"), + resolve_single_filepath("resources", config.get("resources").get("bed")), + ), param=config.get("params").get("gatk").get("Mutect"), germline_resource=config.get("params").get("gatk").get("germline"), - tumor_bam= lambda wildcards,input: get_name(input.tumor_name) + tumor_bam=lambda wildcards, input: get_name(input.tumor_name), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}.mutect.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}.mutect.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk " "--java-options {params.custom} " @@ -65,19 +97,27 @@ rule mutect_tumoronly: rule orientation_model_tumoronly: input: - rules.mutect_tumoronly.output.fir + rules.mutect_tumoronly.output.fir, output: - resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/tumoronly/{sample}_read-orientation-model.tar.gz") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/tumoronly/{sample}_read-orientation-model.tar.gz", + ), params: custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), - exac=config.get("params").get("gatk").get("exac") + exac=config.get("params").get("gatk").get("exac"), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}_orientation.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}_orientation.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk LearnReadOrientationModel " "--java-options {params.custom} " @@ -88,20 +128,31 @@ rule orientation_model_tumoronly: rule pileup_summaries_tumoronly: input: - tumoral= lambda wildcards: get_tumoral_bam(wildcards) + tumoral=lambda wildcards: get_tumoral_bam(wildcards), output: - resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/tumoronly/{sample}_getpileupsummaries.table") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/tumoronly/{sample}_getpileupsummaries.table", + ), params: custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), - intervals=resolve_single_filepath(config.get("paths").get("workdir"),resolve_single_filepath("resources",config.get("resources").get("bed"))), - exac=config.get("params").get("gatk").get("exac") + intervals=resolve_single_filepath( + config.get("paths").get("workdir"), + resolve_single_filepath("resources", config.get("resources").get("bed")), + ), + exac=config.get("params").get("gatk").get("exac"), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}_pileupsummaries_T.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}_pileupsummaries_T.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk GetPileupSummaries " "--java-options {params.custom} " @@ -114,19 +165,30 @@ rule pileup_summaries_tumoronly: rule calculate_contamination_tumoronly: input: - tab_t=rules.pileup_summaries_tumoronly.output + tab_t=rules.pileup_summaries_tumoronly.output, output: - table=resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/tumoronly/{sample}_contamination.table"), - segment=resolve_results_filepath(config.get("paths").get("results_dir"),"results/filters/tumoronly/{sample}_tumor.segment") + table=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/tumoronly/{sample}_contamination.table", + ), + segment=resolve_results_filepath( + config.get("paths").get("results_dir"), + "results/filters/tumoronly/{sample}_tumor.segment", + ), params: - custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"),multiply_by=5) + custom=java_params(tmp_dir=config.get("paths").get("tmp_dir"), multiply_by=5), log: - resolve_results_filepath(config.get("paths").get("results_dir"),"logs/gatk/Mutect2/{sample}_calculatecontamination.log") + resolve_results_filepath( + config.get("paths").get("results_dir"), + "logs/gatk/Mutect2/{sample}_calculatecontamination.log", + ), conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/gatk.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/gatk.yaml" + ) threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), shell: "gatk CalculateContamination " "--java-options {params.custom} " diff --git a/workflow/rules/maftools.smk b/workflow/rules/maftools.smk index b8c6461..a1c4205 100644 --- a/workflow/rules/maftools.smk +++ b/workflow/rules/maftools.smk @@ -1,127 +1,192 @@ rule maftools_base: input: - mafs=get_maf_file_input() + mafs=get_maf_file_input(), output: summary=report( - resolve_single_filepath(config.get("paths").get("results_dir"),"results/analysis/base/plots/summary.png"), - caption=resolve_single_filepath(config.get("paths").get("workdir"),"workflow/report/summary.rst"), - category="Maftools" + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/base/plots/summary.png", + ), + caption=resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/report/summary.rst" + ), + category="Maftools", ), oncoplot=report( - resolve_single_filepath(config.get("paths").get("results_dir"),"results/analysis/base/plots/large_oncoplot.png"), - caption=resolve_single_filepath(config.get("paths").get("workdir"),"workflow/report/oncoplot.rst"), - category="Maftools" + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/base/plots/large_oncoplot.png", + ), + caption=resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/report/oncoplot.rst" + ), + category="Maftools", ), tgca=report( - resolve_single_filepath(config.get("paths").get("results_dir"), "results/analysis/base/plots/TGCA_compare.png"), - caption=resolve_single_filepath(config.get("paths").get("workdir"),"workflow/report/tgca.rst"), - category="Maftools" + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/base/plots/TGCA_compare.png", + ), + caption=resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/report/tgca.rst" + ), + category="Maftools", ), vaf=report( - resolve_single_filepath(config.get("paths").get("results_dir"), "results/analysis/base/plots/top10_VAF.png"), - caption=resolve_single_filepath(config.get("paths").get("workdir"),"workflow/report/vaf.rst"), - category="Maftools" - ) + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/base/plots/top10_VAF.png", + ), + caption=resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/report/vaf.rst" + ), + category="Maftools", + ), params: project_id=config.get("params").get("maftools").get("project_name"), - outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0] + outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0], conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/maftools.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/maftools.yaml" + ) log: - resolve_single_filepath(config.get("paths").get("results_dir"),"logs/maftools/maftools_base.log") - threads: - conservative_cpu_count(reserve_cores=2, max_cores=99) + resolve_single_filepath( + config.get("paths").get("results_dir"), "logs/maftools/maftools_base.log" + ), + threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), script: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/scripts/maftools_basic.R") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/scripts/maftools_basic.R" + ) rule maftools_signatures: input: mafs=get_maf_file_input(), - requisites=rules.maftools_base.output.summary + requisites=rules.maftools_base.output.summary, output: signatures=report( - resolve_single_filepath(config.get("paths").get("results_dir"),"results/analysis/signatures/plots/cosmic_signatures.png"), - caption=resolve_single_filepath(config.get("paths").get("workdir"),"workflow/report/signatures.rst"), + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/signatures/plots/cosmic_signatures.png", + ), + caption=resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/report/signatures.rst" + ), category="Signatures", - ) + ), params: project_id=config.get("params").get("maftools").get("project_name"), - outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0] + outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0], conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/maftools.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/maftools.yaml" + ) log: - resolve_single_filepath(config.get("paths").get("results_dir"),"logs/maftools/maftools_signatures.log") - threads: - conservative_cpu_count(reserve_cores=2, max_cores=99) + resolve_single_filepath( + config.get("paths").get("results_dir"), + "logs/maftools/maftools_signatures.log", + ), + threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), script: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/scripts/maftools_signatures.R") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/scripts/maftools_signatures.R" + ) rule maftools_driver: input: mafs=get_maf_file_input(), - requisites=rules.maftools_base.output.summary + requisites=rules.maftools_base.output.summary, output: interactions=report( - resolve_single_filepath(config.get("paths").get("results_dir"),"results/analysis/driver/plots/somatic_interactions.png"), - caption=resolve_single_filepath(config.get("paths").get("workdir"),"workflow/report/interactions.rst"), + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/driver/plots/somatic_interactions.png", + ), + caption=resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/report/interactions.rst" + ), category="Somatic Interactions", - ) + ), params: - outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0] + outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0], conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/maftools.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/maftools.yaml" + ) log: - resolve_single_filepath(config.get("paths").get("results_dir"),"logs/maftools/maftools_driver.log") - threads: - conservative_cpu_count(reserve_cores=2, max_cores=99) + resolve_single_filepath( + config.get("paths").get("results_dir"), "logs/maftools/maftools_driver.log" + ), + threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), script: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/scripts/maftools_driver.R") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/scripts/maftools_driver.R" + ) rule maftools_pathways: input: mafs=get_maf_file_input(), - requisites=rules.maftools_base.output.summary + requisites=rules.maftools_base.output.summary, output: - resolve_single_filepath(config.get("paths").get("results_dir"),"results/analysis/pathways/plots/oncogenic_pathways.png") + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/pathways/plots/oncogenic_pathways.png", + ), params: - outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0] + outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0], conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/maftools.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/maftools.yaml" + ) log: - resolve_single_filepath(config.get("paths").get("results_dir"),"logs/maftools/maftools_pathways.log") - threads: - conservative_cpu_count(reserve_cores=2, max_cores=99) + resolve_single_filepath( + config.get("paths").get("results_dir"), + "logs/maftools/maftools_pathways.log", + ), + threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), script: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/scripts/maftools_pathway.R") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/scripts/maftools_pathway.R" + ) rule maftools_heterogeneity: input: mafs=get_maf_file_input(), - requisites=rules.maftools_base.output.summary + requisites=rules.maftools_base.output.summary, output: - resolve_single_filepath(config.get("paths").get("results_dir"),"results/analysis/heterogeneity/tables/successful.tsv") + resolve_single_filepath( + config.get("paths").get("results_dir"), + "results/analysis/heterogeneity/tables/successful.tsv", + ), params: - outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0] + outdir=lambda w, output: os.path.split(os.path.split(output[0])[0])[0], conda: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/envs/maftools.yaml") + resolve_single_filepath( + config.get("paths").get("workdir"), "workflow/envs/maftools.yaml" + ) log: - resolve_single_filepath(config.get("paths").get("results_dir"),"logs/maftools/maftools_heterogeneity.log") - threads: - conservative_cpu_count(reserve_cores=2, max_cores=99) + resolve_single_filepath( + config.get("paths").get("results_dir"), + "logs/maftools/maftools_heterogeneity.log", + ), + threads: conservative_cpu_count(reserve_cores=2, max_cores=99) resources: - tmpdir = config.get("paths").get("tmp_dir") + tmpdir=config.get("paths").get("tmp_dir"), script: - resolve_single_filepath(config.get("paths").get("workdir"),"workflow/scripts/maftools_heterogeneity.R") + resolve_single_filepath( + config.get("paths").get("workdir"), + "workflow/scripts/maftools_heterogeneity.R", + )