From 76a73c0aa25ff48e6a154300a95a4af0430bce6c Mon Sep 17 00:00:00 2001 From: Andrea Talenti Date: Thu, 23 May 2024 12:52:28 +0000 Subject: [PATCH] Add new models and new container [CW-4123] --- CHANGELOG.md | 8 +++++--- bin/workflow_glue/__init__.py | 32 +++++++++++++++++++++----------- nextflow.config | 4 ++-- nextflow_schema.json | 22 ++++++++++++++++++++-- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5034f01..cd17183 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [unreleased] +## [v1.1.9] ### Fixed -- Report crashing when no data are present in the input pod5 -- Reconciled workflow with wf-template v5.1.2 +- Report crashing when no data are present in the input pod5. +- Reconciled workflow with wf-template v5.1.3. +- Updated Dorado to v0.7.0 (see https://github.com/nanoporetech/dorado/releases/tag/v0.7.0) +- Added new DNA and RNA 5.0.0 models. ## [v1.1.8] ### Changed diff --git a/bin/workflow_glue/__init__.py b/bin/workflow_glue/__init__.py index 30febca..3949151 100755 --- a/bin/workflow_glue/__init__.py +++ b/bin/workflow_glue/__init__.py @@ -3,6 +3,7 @@ import glob import importlib import os +import sys from .util import _log_level, get_main_logger # noqa: ABS101 @@ -11,15 +12,17 @@ _package_name = "workflow_glue" -def get_components(): +def get_components(allowed_components=None): """Find a list of workflow command scripts.""" logger = get_main_logger(_package_name) path = os.path.dirname(os.path.abspath(__file__)) - components = list() + components = dict() for fname in glob.glob(os.path.join(path, "*.py")): name = os.path.splitext(os.path.basename(fname))[0] if name in ("__init__", "util"): continue + if allowed_components is not None and name not in allowed_components: + continue # leniently attempt to import module try: @@ -34,7 +37,7 @@ def get_components(): try: req = "main", "argparser" if all(callable(getattr(mod, x)) for x in req): - components.append(name) + components[name] = mod except Exception: pass return components @@ -42,6 +45,8 @@ def get_components(): def cli(): """Run workflow entry points.""" + logger = get_main_logger(_package_name) + logger.info("Bootstrapping CLI.") parser = argparse.ArgumentParser( 'wf-glue', parents=[_log_level()], @@ -56,16 +61,21 @@ def cli(): help='additional help', dest='command') subparsers.required = True - # all component demos, plus some others - components = [ - f'{_package_name}.{comp}' for comp in get_components()] - for module in components: - mod = importlib.import_module(module) + # importing everything can take time, try to shortcut + if len(sys.argv) > 1: + components = get_components(allowed_components=[sys.argv[1]]) + if not sys.argv[1] in components: + logger.warn("Importing all modules, this may take some time.") + components = get_components() + else: + components = get_components() + + # add all module parsers to main CLI + for name, module in components.items(): p = subparsers.add_parser( - module.split(".")[-1], parents=[mod.argparser()]) - p.set_defaults(func=mod.main) + name.split(".")[-1], parents=[module.argparser()]) + p.set_defaults(func=module.main) - logger = get_main_logger(_package_name) args = parser.parse_args() logger.info("Starting entrypoint.") diff --git a/nextflow.config b/nextflow.config index 33ffec4..1af5f9d 100644 --- a/nextflow.config +++ b/nextflow.config @@ -61,7 +61,7 @@ params { wf { basecaller_container = "ontresearch/dorado" - container_sha = "shaa5cd803bdb5f3cac5c612e47ea6391b882861b8b" + container_sha = "shac2d8bc91ca2d043fed84d06cca92aaeb62bcc1cd" bonito_container = "ontresearch/bonito" bonito_sha = "shaea43ca2333f91fa78a823f640ba158e4268f1f98" common_sha = "sha91cd87900c86f05bf36d8c77b841b8fda5ecf3aa" @@ -83,7 +83,7 @@ manifest { description = 'Helper workflow for basecalling ONT reads.' mainScript = 'main.nf' nextflowVersion = '>=23.04.2' - version = '1.1.8' + version = '1.1.9' } epi2melabs { diff --git a/nextflow_schema.json b/nextflow_schema.json index a1407ed..24ce4bf 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -87,10 +87,13 @@ "dna_r10.4.1_e8.2_400bps_fast@v4.1.0", "dna_r10.4.1_e8.2_400bps_fast@v4.2.0", "dna_r10.4.1_e8.2_400bps_fast@v4.3.0", + "dna_r10.4.1_e8.2_400bps_fast@v5.0.0", "dna_r10.4.1_e8.2_400bps_hac@v4.1.0", "dna_r10.4.1_e8.2_400bps_hac@v4.3.0", + "dna_r10.4.1_e8.2_400bps_hac@v5.0.0", "dna_r10.4.1_e8.2_400bps_sup@v4.1.0", "dna_r10.4.1_e8.2_400bps_sup@v4.3.0", + "dna_r10.4.1_e8.2_400bps_sup@v5.0.0", "dna_r9.4.1_e8_fast@v3.4", "dna_r9.4.1_e8_hac@v3.3", "dna_r9.4.1_e8_sup@v3.3", @@ -98,8 +101,11 @@ "rna002_70bps_fast@v3", "rna002_70bps_hac@v3", "rna004_130bps_fast@v3.0.1", + "rna004_130bps_fast@v5.0.0", "rna004_130bps_hac@v3.0.1", - "rna004_130bps_sup@v3.0.1" + "rna004_130bps_hac@v5.0.0", + "rna004_130bps_sup@v3.0.1", + "rna004_130bps_sup@v5.0.0" ] }, "duplex": { @@ -124,17 +130,29 @@ "dna_r10.4.1_e8.2_400bps_hac@v4.3.0_5mCG_5hmCG@v1", "dna_r10.4.1_e8.2_400bps_hac@v4.3.0_5mC_5hmC@v1", "dna_r10.4.1_e8.2_400bps_hac@v4.3.0_6mA@v2", + "dna_r10.4.1_e8.2_400bps_hac@v5.0.0_4mC_5mC@v1", + "dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mCG_5hmCG@v1", + "dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mC_5hmC@v1", + "dna_r10.4.1_e8.2_400bps_hac@v5.0.0_6mA@v1", "dna_r10.4.1_e8.2_400bps_sup@v4.1.0_5mCG_5hmCG@v2", "dna_r10.4.1_e8.2_400bps_sup@v4.3.0_5mCG_5hmCG@v1", "dna_r10.4.1_e8.2_400bps_sup@v4.3.0_5mC_5hmC@v1", "dna_r10.4.1_e8.2_400bps_sup@v4.3.0_6mA@v2", + "dna_r10.4.1_e8.2_400bps_sup@v5.0.0_4mC_5mC@v1", + "dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mCG_5hmCG@v1", + "dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mC_5hmC@v1", + "dna_r10.4.1_e8.2_400bps_sup@v5.0.0_6mA@v1", "dna_r9.4.1_e8_fast@v3.4_5mCG@v0.1", "dna_r9.4.1_e8_fast@v3.4_5mCG_5hmCG@v0", "dna_r9.4.1_e8_hac@v3.3_5mCG@v0.1", "dna_r9.4.1_e8_hac@v3.3_5mCG_5hmCG@v0", "dna_r9.4.1_e8_sup@v3.3_5mCG@v0.1", "dna_r9.4.1_e8_sup@v3.3_5mCG_5hmCG@v0", - "rna004_130bps_sup@v3.0.1_m6A_DRACH@v1" + "rna004_130bps_hac@v5.0.0_m6A@v1", + "rna004_130bps_hac@v5.0.0_pseU@v1", + "rna004_130bps_sup@v3.0.1_m6A_DRACH@v1", + "rna004_130bps_sup@v5.0.0_m6A@v1", + "rna004_130bps_sup@v5.0.0_pseU@v1" ] }, "dorado_ext": {