diff --git a/src/readfish/_cli_args.py b/src/readfish/_cli_args.py index cbfde3ff..2102afa0 100644 --- a/src/readfish/_cli_args.py +++ b/src/readfish/_cli_args.py @@ -127,9 +127,10 @@ ( "--wait-for-ready", dict( - help="Timeout for the MinKNOW data folder to appear, and the device to report it is ready to start sequencing. Default 60 seconds.", + help="Timeout for the MinKNOW data folder to appear, and the device to report it is ready to start sequencing in seconds. (default: 120s).", required=False, - default=60, + default=120, + type=int, ), ), ) + BASE_ARGS diff --git a/src/readfish/_read_until_client.py b/src/readfish/_read_until_client.py index 91307389..d98fa139 100644 --- a/src/readfish/_read_until_client.py +++ b/src/readfish/_read_until_client.py @@ -41,6 +41,8 @@ class RUClient(ReadUntilClient): """Subclasses ONTs read_until_api ReadUntilClient adding extra function that logs unblocks read_ids.""" def __init__(self, *args, **kwargs): + # Default to TIMEOUT in the event we are not starting from the CLI. + # If started from CLI args.wait-for-ready is used - also defaults to 120s self.timeout = kwargs.pop("timeout", TIMEOUT) super().__init__(*args, **kwargs) # disable the read until client logger @@ -170,10 +172,10 @@ def set_acquisition_state(self): else: raise SystemExit(1) - def wait_for_minknow_folder(self, timeout: int = TIMEOUT): + def wait_for_minknow_folder(self, timeout: int): """ Rather than messing about with permissions wait for MinKNOW to create the run - folder. If the folder doesn't appear after TIMEOUT seconds then write to the + folder. If the folder doesn't appear after timeout seconds then write to the current working directory instead. """ seconds_waited = 0 diff --git a/src/readfish/plugins/_mappy.py b/src/readfish/plugins/_mappy.py index edc9d6e9..0b88e181 100644 --- a/src/readfish/plugins/_mappy.py +++ b/src/readfish/plugins/_mappy.py @@ -1,6 +1,7 @@ """Mapping interface for readfish, using Minimap2 mappy, or mappy-rs as dictated by the experiment TOML `mapper_settings.` section. See {ref}`plugin configuration ` section. """ + from __future__ import annotations from enum import Enum from itertools import chain, repeat @@ -87,10 +88,7 @@ def validate(self) -> None: file_extensions.append(".mmi") if all((not Path(index).is_file(), index)): raise FileNotFoundError(f"{index} does not exist") - if ( - "".join(map(str.lower, Path(index).suffixes)) not in set(file_extensions) - and index - ): + if not any(index.lower().endswith(suffix) for suffix in file_extensions): raise RuntimeError( f"Provided index file appears to be of an incorrect type - should be one of {file_extensions}" ) diff --git a/tests/static/mappy_validation_test/fail/004_bad_reference_file_extension.toml b/tests/static/mappy_validation_test/fail/004_bad_reference_file_extension.toml new file mode 100644 index 00000000..163ad023 --- /dev/null +++ b/tests/static/mappy_validation_test/fail/004_bad_reference_file_extension.toml @@ -0,0 +1,13 @@ +[caller_settings.no_op] + +[mapper_settings.mappy] +fn_idx_in = "tests/static/mappy_validation_test/fail/bad_extension.mmi.cabbage" + +[[regions]] +name = "abc" +no_seq = "proceed" +no_map = "proceed" +single_on = "proceed" +single_off = "proceed" +multi_on = "proceed" +multi_off = "proceed" diff --git a/tests/static/mappy_validation_test/fail/004_bad_reference_file_extension.txt b/tests/static/mappy_validation_test/fail/004_bad_reference_file_extension.txt new file mode 100644 index 00000000..0193d70c --- /dev/null +++ b/tests/static/mappy_validation_test/fail/004_bad_reference_file_extension.txt @@ -0,0 +1 @@ +Provided index file appears to be of an incorrect type - should be one of ['.fasta', '.fna', '.fsa', '.fa', '.fastq', '.fq', '.fasta.gz', '.fna.gz', '.fsa.gz', '.fa.gz', '.fastq.gz', '.fq.gz', '.mmi'] diff --git a/tests/static/mappy_validation_test/fail/bad_extension.mmi.cabbage b/tests/static/mappy_validation_test/fail/bad_extension.mmi.cabbage new file mode 100644 index 00000000..e69de29b diff --git a/tests/static/mappy_validation_test/pass/006_passing_fna_mmi.toml b/tests/static/mappy_validation_test/pass/006_passing_fna_mmi.toml new file mode 100644 index 00000000..0f37e53c --- /dev/null +++ b/tests/static/mappy_validation_test/pass/006_passing_fna_mmi.toml @@ -0,0 +1,13 @@ +[caller_settings.no_op] + +[mapper_settings.mappy] +fn_idx_in = "tests/static/mappy_validation_test/pass/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.mmi" + +[[regions]] +name = "abc" +no_seq = "proceed" +no_map = "proceed" +single_on = "proceed" +single_off = "proceed" +multi_on = "proceed" +multi_off = "proceed" diff --git a/tests/static/mappy_validation_test/pass/006_passing_fna_mmi.txt b/tests/static/mappy_validation_test/pass/006_passing_fna_mmi.txt new file mode 100644 index 00000000..bb31ec64 --- /dev/null +++ b/tests/static/mappy_validation_test/pass/006_passing_fna_mmi.txt @@ -0,0 +1 @@ +Aligner initialised diff --git a/tests/static/mappy_validation_test/pass/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.mmi b/tests/static/mappy_validation_test/pass/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.mmi new file mode 100644 index 00000000..e69de29b