From 6a7a2b177ab7ee17da75ad7cfcc097b6cd52e187 Mon Sep 17 00:00:00 2001 From: Vijini Mallawaarachchi Date: Thu, 13 Jun 2024 13:45:58 +0930 Subject: [PATCH] DEV: Add VOG count threshold fix #5 --- reneo/__main__.py | 10 +++++++++- reneo/config/config.yaml | 1 + reneo/workflow/rules/reneo.smk | 1 + reneo/workflow/scripts/reneo.py | 4 ++++ reneo/workflow/scripts/reneo_utils/component_utils.py | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/reneo/__main__.py b/reneo/__main__.py index ba0d99b..1b56e1f 100644 --- a/reneo/__main__.py +++ b/reneo/__main__.py @@ -161,7 +161,7 @@ def run_options(func): "--evalue", default=1e-10, required=False, - help="maximum e-value for phrog annotations", + help="maximum e-value for vog annotations", type=float, show_default=True, ), @@ -173,6 +173,14 @@ def run_options(func): type=float, show_default=True, ), + click.option( + "--nvogs", + default=10, + required=False, + help="minimum number of vogs to consider a component", + type=int, + show_default=True, + ), click.option( "--covtol", default=100, diff --git a/reneo/config/config.yaml b/reneo/config/config.yaml index 95eb257..f332cf6 100644 --- a/reneo/config/config.yaml +++ b/reneo/config/config.yaml @@ -25,6 +25,7 @@ reneo: mgfrac: 0.2 evalue: 1E-10 hmmscore: 50 + nvogs: 10 covtol: 100 alpha: 1.2 koverage_args: diff --git a/reneo/workflow/rules/reneo.smk b/reneo/workflow/rules/reneo.smk index deb5f26..fd6daeb 100644 --- a/reneo/workflow/rules/reneo.smk +++ b/reneo/workflow/rules/reneo.smk @@ -24,6 +24,7 @@ rule run_reneo: mgfrac = config['mgfrac'], evalue = config['evalue'], hmmscore = config['hmmscore'], + nvogs = config['nvogs'], covtol = config['covtol'], alpha = config['alpha'], output = RESDIR, diff --git a/reneo/workflow/scripts/reneo.py b/reneo/workflow/scripts/reneo.py index bf43162..57221ec 100644 --- a/reneo/workflow/scripts/reneo.py +++ b/reneo/workflow/scripts/reneo.py @@ -1360,6 +1360,9 @@ def main(**kwargs): kwargs["logger"].info( f"Minimum hmm score for vog annotations: {kwargs['hmmscore']}" ) + kwargs["logger"].info( + f"Minimum number of vogs to consider a component: {kwargs['nvogs']}" + ) kwargs["logger"].info( f"Coverage tolerance for extending subpaths: {kwargs['covtol']}" ) @@ -1622,6 +1625,7 @@ def main(**kwargs): mgfrac=float(snakemake.params.mgfrac), evalue=float(snakemake.params.evalue), hmmscore=float(snakemake.params.hmmscore), + nvogs = int(snakemake.params.nvogs), covtol=float(snakemake.params.covtol), alpha=float(snakemake.params.alpha), output=snakemake.params.output, diff --git a/reneo/workflow/scripts/reneo_utils/component_utils.py b/reneo/workflow/scripts/reneo_utils/component_utils.py index ba5669e..49f750e 100644 --- a/reneo/workflow/scripts/reneo_utils/component_utils.py +++ b/reneo/workflow/scripts/reneo_utils/component_utils.py @@ -41,7 +41,7 @@ def get_components(**kwargs): if ( vogs_present - # and unitig_names[unitig] in circular + and len(vogs_found) >= kwargs['nvogs'] and kwargs["edges_lengths"][kwargs["unitig_names"][unitig]] > kwargs["minlength"] ): pruned_vs[i] = component