From 18b9d0e6e20abac7211842d9fbd5f1b7cf0b6899 Mon Sep 17 00:00:00 2001 From: marvin-jens Date: Fri, 21 Apr 2023 15:53:08 +0200 Subject: [PATCH] * removed polyA_adapter_trimming=false support throughout. If it's present in a user's config.yaml, this will trigger a warning and be overriden with 'true' --- spacemake/config.py | 31 +++++++++++++------ spacemake/data/config/config.yaml | 2 -- .../scripts/snakemake_helper_functions.py | 1 - 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/spacemake/config.py b/spacemake/config.py index 339faa61..cfdd76b3 100644 --- a/spacemake/config.py +++ b/spacemake/config.py @@ -76,14 +76,14 @@ def get_run_mode_parser(required=True): + "parameter is set, contiguous islands within umi_cutoff passing beads will " + "also be included in the analysis", ) - parser.add_argument( - "--polyA_adapter_trimming", - required=False, - choices=bool_in_str, - type=str, - help="if set, reads will have polyA stretches and adapter sequence overlaps trimmed " - + "BEFORE mapping.", - ) + # parser.add_argument( + # "--polyA_adapter_trimming", + # required=False, + # choices=bool_in_str, + # type=str, + # help="if set, reads will have polyA stretches and adapter sequence overlaps trimmed " + # + "BEFORE mapping.", + # ) parser.add_argument( "--count_intronic_reads", required=False, @@ -581,6 +581,18 @@ def correct(self): if not var in RunMode.variable_types: del variables[var] + if ("polyA_adapter_trimming" in variables) and ( + variables["polyA_adapter_trimming"] == False + ): + import logging + + logger = logging.getLogger("spacemake.config") + logger.warning( + f"WARNING: run_mode {run_mode_name} lists polyA_adapter_trimming=false. This is no longer supported and will be overriden with true" + ) + variables["polyA_adapter_trimming"] = True + + # print(f"assigning run mode {run_mode_name}: {variables}") self.variables["run_modes"][run_mode_name] = variables def dump(self): @@ -723,7 +735,7 @@ def add_variable(self, variable, name, **kwargs): # --name is absolutely REQUIRED and its value has to map somehow onto # an internal function name # @TAMAS: can you help? - print(f"add_variable() called with variable={variable} name={name} kw={kwargs}") + # print(f"add_variable() called with variable={variable} name={name} kw={kwargs}") if variable == "species": # for the species command, collision check is on the reference name, not the species name @@ -769,6 +781,7 @@ def update_variable(self, variable, name, **kwargs): return variable_data def get_variable(self, variable, name): + # print(f"config.get_variable({variable}, {name})") if not self.variable_exists(variable, name): raise ConfigVariableNotFoundError(variable, name) else: diff --git a/spacemake/data/config/config.yaml b/spacemake/data/config/config.yaml index 802f8806..4a2ae45a 100644 --- a/spacemake/data/config/config.yaml +++ b/spacemake/data/config/config.yaml @@ -35,7 +35,6 @@ run_modes: umi_cutoff: [1000] clean_dge: False detect_tissue: True - polyA_adapter_trimming: False count_intronic_reads: False count_mm_reads: True slide_seq: @@ -47,7 +46,6 @@ run_modes: n_beads: 10000 umi_cutoff: [500] detect_tissue: False - polyA_adapter_trimming: True count_intronic_reads: True count_mm_reads: False seq_scope: diff --git a/spacemake/snakemake/scripts/snakemake_helper_functions.py b/spacemake/snakemake/scripts/snakemake_helper_functions.py index bc3e56b4..9a8adff1 100644 --- a/spacemake/snakemake/scripts/snakemake_helper_functions.py +++ b/spacemake/snakemake/scripts/snakemake_helper_functions.py @@ -65,7 +65,6 @@ def get_output_files( for run_mode in row["run_mode"]: run_mode_variables = project_df.config.get_run_mode(run_mode).variables - if "polyA_adapter_trimmed" in kwargs: polyA_adapter_trimmed = kwargs["polyA_adapter_trimmed"] else: