diff --git a/snappy_pipeline/workflows/somatic_variant_filtration/Snakefile b/snappy_pipeline/workflows/somatic_variant_filtration/Snakefile index d81e9112a..e71d9a122 100644 --- a/snappy_pipeline/workflows/somatic_variant_filtration/Snakefile +++ b/snappy_pipeline/workflows/somatic_variant_filtration/Snakefile @@ -53,27 +53,6 @@ rule somatic_variant_filtration_link_out_run: # Somatic Variant Filtration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Run DKFZ Bias Filter -------------------------------------------------------- - - -rule somatic_variant_filtration_dkfz_bias_filter_run: - input: - **wf.get_input_files("dkfz_bias_filter", "run"), - output: - **wf.get_output_files("dkfz_bias_filter", "run"), - threads: wf.get_resource("dkfz_bias_filter", "run", "threads") - resources: - time=wf.get_resource("dkfz_bias_filter", "run", "time"), - memory=wf.get_resource("dkfz_bias_filter", "run", "memory"), - partition=wf.get_resource("dkfz_bias_filter", "run", "partition"), - tmpdir=wf.get_resource("dkfz_bias_filter", "run", "tmpdir"), - params: - **{"args": wf.get_params("dkfz_bias_filter", "run")}, - log: - **wf.get_log_file("dkfz_bias_filter", "run"), - wrapper: - wf.wrapper_path("dkfz_bias_filter") - # Write out "panel of normals" file for eb_filter ------------------------------ @@ -95,175 +74,189 @@ rule somatic_variant_filtration_eb_filter_write_panel: wf.substep_getattr("eb_filter", "write_panel_of_normals_file")(wildcards) -# Run eb_filter ---------------------------------------------------------------- - - -rule somatic_variant_filtration_eb_filter_run: - input: - unpack(wf.get_input_files("eb_filter", "run")), - output: - **wf.get_output_files("eb_filter", "run"), - threads: wf.get_resource("eb_filter", "run", "threads") - resources: - time=wf.get_resource("eb_filter", "run", "time"), - memory=wf.get_resource("eb_filter", "run", "memory"), - partition=wf.get_resource("eb_filter", "run", "partition"), - tmpdir=wf.get_resource("eb_filter", "run", "tmpdir"), - params: - **{"args": wf.get_params("eb_filter", "run")}, - log: - **wf.get_log_file("eb_filter", "run"), - wrapper: - wf.wrapper_path("eb_filter") - - -# Apply Filters --------------------------------------------------------------- - - -rule variant_filtration_apply_filters_run: - input: - **(wf.get_input_files("apply_filters", "run")), - output: - **wf.get_output_files("apply_filters", "run"), - threads: wf.get_resource("apply_filters", "run", "threads") - resources: - time=wf.get_resource("apply_filters", "run", "time"), - memory=wf.get_resource("apply_filters", "run", "memory"), - partition=wf.get_resource("apply_filters", "run", "partition"), - tmpdir=wf.get_resource("apply_filters", "run", "tmpdir"), - log: - wf.get_log_file("apply_filters", "run"), - params: - args=wf.substep_dispatch("apply_filters", "get_args", "run"), - wrapper: - wf.wrapper_path("somatic_variant_filtration/apply_filters") - - -# Filter to Exons-------------------------------------------------------------- - +# Run DKFZ Bias Filter -------------------------------------------------------- -rule variant_filtration_filter_to_exons_run: - input: - unpack(wf.get_input_files("filter_to_exons", "run")), - output: - **wf.get_output_files("filter_to_exons", "run"), - threads: wf.get_resource("filter_to_exons", "run", "threads") - resources: - time=wf.get_resource("filter_to_exons", "run", "time"), - memory=wf.get_resource("filter_to_exons", "run", "memory"), - partition=wf.get_resource("filter_to_exons", "run", "partition"), - tmpdir=wf.get_resource("filter_to_exons", "run", "tmpdir"), - log: - wf.get_log_file("filter_to_exons", "run"), - wrapper: - wf.wrapper_path("somatic_variant_filtration/filter_to_exons") +if len(config["step_config"]["somatic_variant_filtration"]["filter_sets"]) > 0: + + rule somatic_variant_filtration_dkfz_bias_filter_run: + input: + **wf.get_input_files("dkfz_bias_filter", "run"), + output: + **wf.get_output_files("dkfz_bias_filter", "run"), + threads: wf.get_resource("dkfz_bias_filter", "run", "threads") + resources: + time=wf.get_resource("dkfz_bias_filter", "run", "time"), + memory=wf.get_resource("dkfz_bias_filter", "run", "memory"), + partition=wf.get_resource("dkfz_bias_filter", "run", "partition"), + tmpdir=wf.get_resource("dkfz_bias_filter", "run", "tmpdir"), + params: + **{"args": wf.get_params("dkfz_bias_filter", "run")}, + log: + **wf.get_log_file("dkfz_bias_filter", "run"), + wrapper: + wf.wrapper_path("dkfz_bias_filter") + + # Run eb_filter ---------------------------------------------------------------- + + rule somatic_variant_filtration_eb_filter_run: + input: + unpack(wf.get_input_files("eb_filter", "run")), + output: + **wf.get_output_files("eb_filter", "run"), + threads: wf.get_resource("eb_filter", "run", "threads") + resources: + time=wf.get_resource("eb_filter", "run", "time"), + memory=wf.get_resource("eb_filter", "run", "memory"), + partition=wf.get_resource("eb_filter", "run", "partition"), + tmpdir=wf.get_resource("eb_filter", "run", "tmpdir"), + params: + **{"args": wf.get_params("eb_filter", "run")}, + log: + **wf.get_log_file("eb_filter", "run"), + wrapper: + wf.wrapper_path("eb_filter") + + # Apply Filters --------------------------------------------------------------- + + rule variant_filtration_apply_filters_run: + input: + **(wf.get_input_files("apply_filters", "run")), + output: + **wf.get_output_files("apply_filters", "run"), + threads: wf.get_resource("apply_filters", "run", "threads") + resources: + time=wf.get_resource("apply_filters", "run", "time"), + memory=wf.get_resource("apply_filters", "run", "memory"), + partition=wf.get_resource("apply_filters", "run", "partition"), + tmpdir=wf.get_resource("apply_filters", "run", "tmpdir"), + log: + wf.get_log_file("apply_filters", "run"), + params: + args=wf.substep_dispatch("apply_filters", "get_args", "run"), + wrapper: + wf.wrapper_path("somatic_variant_filtration/apply_filters") + + # Filter to Exons-------------------------------------------------------------- + + rule variant_filtration_filter_to_exons_run: + input: + unpack(wf.get_input_files("filter_to_exons", "run")), + output: + **wf.get_output_files("filter_to_exons", "run"), + threads: wf.get_resource("filter_to_exons", "run", "threads") + resources: + time=wf.get_resource("filter_to_exons", "run", "time"), + memory=wf.get_resource("filter_to_exons", "run", "memory"), + partition=wf.get_resource("filter_to_exons", "run", "partition"), + tmpdir=wf.get_resource("filter_to_exons", "run", "tmpdir"), + log: + wf.get_log_file("filter_to_exons", "run"), + wrapper: + wf.wrapper_path("somatic_variant_filtration/filter_to_exons") # Flexible Somatic Variant Filtration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -checkpoint one_dkfz: - input: - unpack(wf.get_input_files("one_dkfz", "run")), - output: - **wf.get_output_files("one_dkfz", "run"), - threads: wf.get_resource("one_dkfz", "run", "threads") - resources: - time=wf.get_resource("one_dkfz", "run", "time"), - memory=wf.get_resource("one_dkfz", "run", "memory"), - partition=wf.get_resource("one_dkfz", "run", "partition"), - tmpdir=wf.get_resource("one_dkfz", "run", "tmpdir"), - log: - **wf.get_log_file("one_dkfz", "run"), - wrapper: - wf.wrapper_path("dkfz_bias_filter") - - -checkpoint one_ebfilter: - input: - unpack(wf.get_input_files("one_ebfilter", "run")), - output: - **wf.get_output_files("one_ebfilter", "run"), - params: - wf.get_params("one_ebfilter", "run"), - threads: wf.get_resource("one_ebfilter", "run", "threads") - resources: - time=wf.get_resource("one_ebfilter", "run", "time"), - memory=wf.get_resource("one_ebfilter", "run", "memory"), - partition=wf.get_resource("one_ebfilter", "run", "partition"), - tmpdir=wf.get_resource("one_ebfilter", "run", "tmpdir"), - log: - **wf.get_log_file("one_ebfilter", "run"), - wrapper: - wf.wrapper_path("eb_filter") - - -checkpoint one_bcftools: - input: - unpack(wf.get_input_files("one_bcftools", "run")), - output: - **wf.get_output_files("one_bcftools", "run"), - threads: wf.get_resource("one_bcftools", "run", "threads") - resources: - time=wf.get_resource("one_bcftools", "run", "time"), - memory=wf.get_resource("one_bcftools", "run", "memory"), - partition=wf.get_resource("one_bcftools", "run", "partition"), - tmpdir=wf.get_resource("one_bcftools", "run", "tmpdir"), - log: - **wf.get_log_file("one_bcftools", "run"), - wrapper: - wf.wrapper_path("bcftools/filter") - - -checkpoint one_regions: - input: - unpack(wf.get_input_files("one_regions", "run")), - output: - **wf.get_output_files("one_regions", "run"), - threads: wf.get_resource("one_regions", "run", "threads") - resources: - time=wf.get_resource("one_regions", "run", "time"), - memory=wf.get_resource("one_regions", "run", "memory"), - partition=wf.get_resource("one_regions", "run", "partition"), - tmpdir=wf.get_resource("one_regions", "run", "tmpdir"), - log: - **wf.get_log_file("one_regions", "run"), - wrapper: - wf.wrapper_path("bcftools/regions") - - -checkpoint one_protected: - input: - unpack(wf.get_input_files("one_protected", "run")), - output: - **wf.get_output_files("one_protected", "run"), - threads: wf.get_resource("one_protected", "run", "threads") - resources: - time=wf.get_resource("one_protected", "run", "time"), - memory=wf.get_resource("one_protected", "run", "memory"), - partition=wf.get_resource("one_protected", "run", "partition"), - tmpdir=wf.get_resource("one_protected", "run", "tmpdir"), - log: - **wf.get_log_file("one_protected", "run"), - wrapper: - wf.wrapper_path("bcftools/protected") - - -rule last_filter: - input: - **wf.get_input_files("last_filter", "run"), - output: - **wf.get_output_files("last_filter", "run"), - threads: wf.get_resource("last_filter", "run", "threads") - resources: - time=wf.get_resource("last_filter", "run", "time"), - memory=wf.get_resource("last_filter", "run", "memory"), - partition=wf.get_resource("last_filter", "run", "partition"), - tmpdir=wf.get_resource("last_filter", "run", "tmpdir"), - log: - **wf.get_log_file("last_filter", "run"), - wrapper: - wf.wrapper_path("somatic_variant_filtration/apply_all_filters") +if len(config["step_config"]["somatic_variant_filtration"]["filter_list"]) > 0: + + checkpoint one_dkfz: + input: + unpack(wf.get_input_files("one_dkfz", "run")), + output: + **wf.get_output_files("one_dkfz", "run"), + threads: wf.get_resource("one_dkfz", "run", "threads") + resources: + time=wf.get_resource("one_dkfz", "run", "time"), + memory=wf.get_resource("one_dkfz", "run", "memory"), + partition=wf.get_resource("one_dkfz", "run", "partition"), + tmpdir=wf.get_resource("one_dkfz", "run", "tmpdir"), + log: + **wf.get_log_file("one_dkfz", "run"), + wrapper: + wf.wrapper_path("dkfz_bias_filter") + + checkpoint one_ebfilter: + input: + unpack(wf.get_input_files("one_ebfilter", "run")), + output: + **wf.get_output_files("one_ebfilter", "run"), + params: + wf.get_params("one_ebfilter", "run"), + threads: wf.get_resource("one_ebfilter", "run", "threads") + resources: + time=wf.get_resource("one_ebfilter", "run", "time"), + memory=wf.get_resource("one_ebfilter", "run", "memory"), + partition=wf.get_resource("one_ebfilter", "run", "partition"), + tmpdir=wf.get_resource("one_ebfilter", "run", "tmpdir"), + log: + **wf.get_log_file("one_ebfilter", "run"), + wrapper: + wf.wrapper_path("eb_filter") + + checkpoint one_bcftools: + input: + unpack(wf.get_input_files("one_bcftools", "run")), + output: + **wf.get_output_files("one_bcftools", "run"), + threads: wf.get_resource("one_bcftools", "run", "threads") + resources: + time=wf.get_resource("one_bcftools", "run", "time"), + memory=wf.get_resource("one_bcftools", "run", "memory"), + partition=wf.get_resource("one_bcftools", "run", "partition"), + tmpdir=wf.get_resource("one_bcftools", "run", "tmpdir"), + log: + **wf.get_log_file("one_bcftools", "run"), + wrapper: + wf.wrapper_path("bcftools/filter") + + checkpoint one_regions: + input: + unpack(wf.get_input_files("one_regions", "run")), + output: + **wf.get_output_files("one_regions", "run"), + threads: wf.get_resource("one_regions", "run", "threads") + resources: + time=wf.get_resource("one_regions", "run", "time"), + memory=wf.get_resource("one_regions", "run", "memory"), + partition=wf.get_resource("one_regions", "run", "partition"), + tmpdir=wf.get_resource("one_regions", "run", "tmpdir"), + log: + **wf.get_log_file("one_regions", "run"), + wrapper: + wf.wrapper_path("bcftools/regions") + + checkpoint one_protected: + input: + unpack(wf.get_input_files("one_protected", "run")), + output: + **wf.get_output_files("one_protected", "run"), + threads: wf.get_resource("one_protected", "run", "threads") + resources: + time=wf.get_resource("one_protected", "run", "time"), + memory=wf.get_resource("one_protected", "run", "memory"), + partition=wf.get_resource("one_protected", "run", "partition"), + tmpdir=wf.get_resource("one_protected", "run", "tmpdir"), + log: + **wf.get_log_file("one_protected", "run"), + wrapper: + wf.wrapper_path("bcftools/protected") + + rule last_filter: + input: + **wf.get_input_files("last_filter", "run"), + output: + **wf.get_output_files("last_filter", "run"), + threads: wf.get_resource("last_filter", "run", "threads") + resources: + time=wf.get_resource("last_filter", "run", "time"), + memory=wf.get_resource("last_filter", "run", "memory"), + partition=wf.get_resource("last_filter", "run", "partition"), + tmpdir=wf.get_resource("last_filter", "run", "tmpdir"), + log: + **wf.get_log_file("last_filter", "run"), + wrapper: + wf.wrapper_path("somatic_variant_filtration/apply_all_filters") # Variant Statistics Computation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~