Skip to content

Commit

Permalink
Merge branch 'main' into feature/update_pybasecall_client_lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mattloose committed Apr 22, 2024
2 parents a4d8b7e + f5e40c9 commit 944e36c
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/readfish/_cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions src/readfish/_read_until_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/readfish/plugins/_mappy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Mapping interface for readfish, using Minimap2 mappy, or mappy-rs as dictated by the experiment TOML
`mapper_settings.<PLUGIN>` section. See {ref}`plugin configuration <plugins-config>` section.
"""

from __future__ import annotations
from enum import Enum
from itertools import chain, repeat
Expand Down Expand Up @@ -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}"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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']
Empty file.
13 changes: 13 additions & 0 deletions tests/static/mappy_validation_test/pass/006_passing_fna_mmi.toml
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Aligner initialised
Empty file.

0 comments on commit 944e36c

Please sign in to comment.