From b4ff01a23fb61ec50aa8a771eb84642851399282 Mon Sep 17 00:00:00 2001 From: Thorfinn Date: Fri, 6 Jan 2023 14:26:26 +0100 Subject: [PATCH 1/7] Added stopiferrors option python part of metaDMG --- src/metaDMG/cli/cli.py | 10 ++++++++++ src/metaDMG/fit/serial.py | 2 ++ src/metaDMG/utils.py | 1 + 3 files changed, 13 insertions(+) diff --git a/src/metaDMG/cli/cli.py b/src/metaDMG/cli/cli.py index b90fd3c..7e7b280 100644 --- a/src/metaDMG/cli/cli.py +++ b/src/metaDMG/cli/cli.py @@ -132,6 +132,15 @@ def create_config( rich_help_panel="LCA parameters", ), # GENERAL PARAMETERS + stopIfErrors: Optional[int] = typer.Option( + None, + # 0, + "--stopIfErrors", + "-Z", + help="Temporary hack to bypass sorting check if SO tag does not exist in sam header. Values 0 or 1. zero=dont check", + callback=lambda x: cli_utils.is_positive_int_or_None(x), + rich_help_panel="General parameters", + ), metaDMG_cpp: str = typer.Option( "./metaDMG-cpp", "--metaDMG-cpp", @@ -276,6 +285,7 @@ def create_config( sample_suffix=sample_suffix, long_name=long_name, damage_mode=damage_mode, + stopIfErrors=stopIfErrors, __version__=__version__, ) diff --git a/src/metaDMG/fit/serial.py b/src/metaDMG/fit/serial.py index fc41b64..3f25112 100644 --- a/src/metaDMG/fit/serial.py +++ b/src/metaDMG/fit/serial.py @@ -91,6 +91,7 @@ def get_LCA_command(config: Config) -> str: f"-weighttype {config['weight_type']} " f"-fix_ncbi {config['custom_database']} " f"-tempfolder {config['path_tmp']}/ " + f"--stopIfErrors {config['stopIfErrors']} " ) return command[:-1] @@ -145,6 +146,7 @@ def get_damage_command(config: Config) -> str: f"--runmode {runmode} " f"--outname {outname} " f"{config['bam']} " + f"--stopIfErrors {config['stopIfErrors']} " ) return command[:-1] diff --git a/src/metaDMG/utils.py b/src/metaDMG/utils.py index 275b414..35c01a4 100644 --- a/src/metaDMG/utils.py +++ b/src/metaDMG/utils.py @@ -170,6 +170,7 @@ def make_configs( d.setdefault("cores_per_sample", 1) d.setdefault("damage_mode", "lca") d.setdefault("min_reads", 0) + d.setdefault("stopIfErrors", 1) d["force"] = force paths = ["names", "nodes", "acc2tax", "output_dir", "config_file"] From d23acde3ff3a5cf06154a9e1d51f722e1ef3ba9b Mon Sep 17 00:00:00 2001 From: Mikkel Winther Pedersen Date: Mon, 9 Jan 2023 16:41:44 +0100 Subject: [PATCH 2/7] Commented out stopiferrors --- src/metaDMG/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metaDMG/utils.py b/src/metaDMG/utils.py index 35c01a4..f282113 100644 --- a/src/metaDMG/utils.py +++ b/src/metaDMG/utils.py @@ -170,7 +170,7 @@ def make_configs( d.setdefault("cores_per_sample", 1) d.setdefault("damage_mode", "lca") d.setdefault("min_reads", 0) - d.setdefault("stopIfErrors", 1) + #d.setdefault("stopIfErrors", 1) d["force"] = force paths = ["names", "nodes", "acc2tax", "output_dir", "config_file"] From 47b100893ecc41d3ec730ce8a38b1ce3f01dd336 Mon Sep 17 00:00:00 2001 From: Mikkel Winther Pedersen Date: Mon, 9 Jan 2023 16:44:10 +0100 Subject: [PATCH 3/7] uncommented stopiferrors --- src/metaDMG/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metaDMG/utils.py b/src/metaDMG/utils.py index f282113..35c01a4 100644 --- a/src/metaDMG/utils.py +++ b/src/metaDMG/utils.py @@ -170,7 +170,7 @@ def make_configs( d.setdefault("cores_per_sample", 1) d.setdefault("damage_mode", "lca") d.setdefault("min_reads", 0) - #d.setdefault("stopIfErrors", 1) + d.setdefault("stopIfErrors", 1) d["force"] = force paths = ["names", "nodes", "acc2tax", "output_dir", "config_file"] From ac2eec425412a9336c72520464e716552ecf58e1 Mon Sep 17 00:00:00 2001 From: Mikkel Winther Pedersen Date: Tue, 10 Jan 2023 09:18:14 +0100 Subject: [PATCH 4/7] Added stopiferrrors to config file --- src/metaDMG/cli/cli_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/metaDMG/cli/cli_utils.py b/src/metaDMG/cli/cli_utils.py index c5b532f..394880d 100644 --- a/src/metaDMG/cli/cli_utils.py +++ b/src/metaDMG/cli/cli_utils.py @@ -459,6 +459,7 @@ def get_config_dict( sample_prefix: str = "", sample_suffix: str = "", long_name: bool = False, + stopIfErrors: int = 1, damage_mode: DAMAGE_MODE = DAMAGE_MODE.LCA, __version__: str = "", ) -> dict: @@ -486,6 +487,7 @@ def get_config_dict( "weight_type": weight_type, "custom_database": custom_database, "forward_only": forward_only, + "stopIfErrors": stopIfErrors, # "output_dir": output_dir, "parallel_samples": parallel_samples, From 563cdac33493ae00c169df44cf7acfe336677a1c Mon Sep 17 00:00:00 2001 From: Mikkel Winther Pedersen Date: Tue, 10 Jan 2023 09:20:06 +0100 Subject: [PATCH 5/7] set stopiferrors default 0 --- src/metaDMG/cli/cli.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/metaDMG/cli/cli.py b/src/metaDMG/cli/cli.py index 7e7b280..42dec73 100644 --- a/src/metaDMG/cli/cli.py +++ b/src/metaDMG/cli/cli.py @@ -133,8 +133,7 @@ def create_config( ), # GENERAL PARAMETERS stopIfErrors: Optional[int] = typer.Option( - None, - # 0, + 0, "--stopIfErrors", "-Z", help="Temporary hack to bypass sorting check if SO tag does not exist in sam header. Values 0 or 1. zero=dont check", From 91020ded4218491a50aa77ecff29f330473db398 Mon Sep 17 00:00:00 2001 From: Mikkel Winther Pedersen Date: Tue, 10 Jan 2023 14:20:10 +0100 Subject: [PATCH 6/7] changed --stopIfErrors to -stopIfErrors --- src/metaDMG/fit/serial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/metaDMG/fit/serial.py b/src/metaDMG/fit/serial.py index 3f25112..07ec4ac 100644 --- a/src/metaDMG/fit/serial.py +++ b/src/metaDMG/fit/serial.py @@ -91,7 +91,7 @@ def get_LCA_command(config: Config) -> str: f"-weighttype {config['weight_type']} " f"-fix_ncbi {config['custom_database']} " f"-tempfolder {config['path_tmp']}/ " - f"--stopIfErrors {config['stopIfErrors']} " + f"-stopIfErrors {config['stopIfErrors']} " ) return command[:-1] @@ -146,7 +146,7 @@ def get_damage_command(config: Config) -> str: f"--runmode {runmode} " f"--outname {outname} " f"{config['bam']} " - f"--stopIfErrors {config['stopIfErrors']} " + f"-stopIfErrors {config['stopIfErrors']} " ) return command[:-1] From 2d4e063b53b509c325d84b52a9d10d9b0a3aee40 Mon Sep 17 00:00:00 2001 From: Mikkel Winther Pedersen Date: Tue, 10 Jan 2023 14:22:02 +0100 Subject: [PATCH 7/7] changed --stopIfErrors to -stopIfErrors --- src/metaDMG/cli/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metaDMG/cli/cli.py b/src/metaDMG/cli/cli.py index 42dec73..7fb12f0 100644 --- a/src/metaDMG/cli/cli.py +++ b/src/metaDMG/cli/cli.py @@ -134,7 +134,7 @@ def create_config( # GENERAL PARAMETERS stopIfErrors: Optional[int] = typer.Option( 0, - "--stopIfErrors", + "-stopIfErrors", "-Z", help="Temporary hack to bypass sorting check if SO tag does not exist in sam header. Values 0 or 1. zero=dont check", callback=lambda x: cli_utils.is_positive_int_or_None(x),