From ae7b8ba4b4752dc6bb58322899d95bc0f025e98a Mon Sep 17 00:00:00 2001 From: VinzentRisch Date: Tue, 16 Jul 2024 13:28:57 +0200 Subject: [PATCH] added new parameter to split tthe -1 identmin --- q2_amr/amrfinderplus/sample_data.py | 1 + q2_amr/amrfinderplus/tests/test_sample_data.py | 1 + q2_amr/amrfinderplus/tests/test_utils.py | 4 ++++ q2_amr/amrfinderplus/utils.py | 5 ++++- q2_amr/plugin_setup.py | 10 ++++++---- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/q2_amr/amrfinderplus/sample_data.py b/q2_amr/amrfinderplus/sample_data.py index ba849a1..34bb07a 100644 --- a/q2_amr/amrfinderplus/sample_data.py +++ b/q2_amr/amrfinderplus/sample_data.py @@ -22,6 +22,7 @@ def annotate_sample_data_amrfinderplus( plus: bool = False, report_all_equal: bool = False, ident_min: float = None, + curated_ident: bool = False, coverage_min: float = 0.5, translation_table: str = "11", threads: int = None, diff --git a/q2_amr/amrfinderplus/tests/test_sample_data.py b/q2_amr/amrfinderplus/tests/test_sample_data.py index 0b8e701..f925a2e 100644 --- a/q2_amr/amrfinderplus/tests/test_sample_data.py +++ b/q2_amr/amrfinderplus/tests/test_sample_data.py @@ -22,6 +22,7 @@ def mock_run_amrfinderplus_n( plus, report_all_equal, ident_min, + curated_ident, coverage_min, translation_table, threads, diff --git a/q2_amr/amrfinderplus/tests/test_utils.py b/q2_amr/amrfinderplus/tests/test_utils.py index f464e77..efe9e05 100644 --- a/q2_amr/amrfinderplus/tests/test_utils.py +++ b/q2_amr/amrfinderplus/tests/test_utils.py @@ -20,6 +20,7 @@ def test_run_amrfinderplus_n(self, mock_run_command): plus=True, report_all_equal=True, ident_min=1, + curated_ident=False, coverage_min=1, translation_table="11", threads=4, @@ -73,6 +74,7 @@ def test_run_amrfinderplus_n_minimal(self, mock_run_command): plus=False, report_all_equal=False, ident_min=None, + curated_ident=True, coverage_min=None, translation_table=None, threads=None, @@ -85,6 +87,8 @@ def test_run_amrfinderplus_n_minimal(self, mock_run_command): "-o", "path_dir/amr_annotations.tsv", "--print_node", + "--ident_min", + "-1", ], "path_dir", verbose=True, diff --git a/q2_amr/amrfinderplus/utils.py b/q2_amr/amrfinderplus/utils.py index ee30541..8141761 100644 --- a/q2_amr/amrfinderplus/utils.py +++ b/q2_amr/amrfinderplus/utils.py @@ -13,6 +13,7 @@ def run_amrfinderplus_n( plus, report_all_equal, ident_min, + curated_ident, coverage_min, translation_table, threads, @@ -60,8 +61,10 @@ def run_amrfinderplus_n( cmd.append("--plus") if report_all_equal: cmd.append("--report_all_equal") - if ident_min: + if ident_min and not curated_ident: cmd.extend(["--ident_min", str(ident_min)]) + if curated_ident: + cmd.extend(["--ident_min", "-1"]) if coverage_min: cmd.extend(["--coverage_min", str(coverage_min)]) if translation_table: diff --git a/q2_amr/plugin_setup.py b/q2_amr/plugin_setup.py index 04b9aff..2027ecd 100644 --- a/q2_amr/plugin_setup.py +++ b/q2_amr/plugin_setup.py @@ -1154,6 +1154,7 @@ "plus": Bool, "report_all_equal": Bool, "ident_min": Float % Range(-1, 1, inclusive_start=True, inclusive_end=True), + "curated_ident": Bool, "coverage_min": Float % Range(0, 1, inclusive_start=True, inclusive_end=True), "translation_table": Str % Choices(translation_tables), "threads": Int % Range(0, None, inclusive_start=False), @@ -1181,10 +1182,11 @@ "each of the database proteins that are equally close to " "the query sequence.", "ident_min": "Minimum identity for a blast-based hit hit (Methods BLAST or " - "PARTIAL). -1 means use the curated threshold if it exists and " - "0.9 otherwise. Setting this value to something other than -1 " - "will override curated similarity cutoffs. We only recommend " - "using this option if you have a specific reason.", + "PARTIAL). Setting this value to something will override curated similarity " + "cutoffs. We only recommend using this option if you have a specific reason.", + "curated_ident": "Use the curated threshold for a blast-based hit, if it " + "exists and 0.9 otherwise. This will overwrite the value given with the " + "'ident_min' parameter", "coverage_min": "Minimum proportion of reference gene covered for a " "BLAST-based hit (Methods BLAST or PARTIAL).", "translation_table": "Translation table used for BLASTX.",