-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introducing a dorado specific plugin which handles the change from ont_pyguppy_client_lib to ont_pybasecaller_client_lib * minor code reformat * Bump version * Update Changelog * Add `ont-pybasecall-client-lib` as a dependency under target `dorado` * Add try/except on import helper functions and pyclient for basecaller This is so pytest collections (The only time both are imported into the same interperter runtime) doesn't crash. This requires all tests to only test one, so I've moved all tests to test dorado * Move tests to test dorado rather than guppy plugin when validating This is due to the fact that pytest imports all files, the only time that pyguppy-client-lib and pybasecall-client-lib are imported at the same time In a real experiment, the plugin choice for base-caller imports the correct module and leaves the other one out of the interpreter runtime * Remove dorado, guppy and _read_until_client from coverage reporting as we can't really cover them They require things link a read_until_api or live base caller to properly test * Introducing sample rate from minknow and catching sub_read issue. * Updating documentation for dorado * Feature/check minknow (#351) * Initial validation of minknow version and guppy dorado versions * MinKNOW compatibility check function Base-caller compatibiity check * edit insanely long string multiline string example of sub tags * Local updates * Error checking and minor corrections to address compatibility. We no longer raise RuntimeException when a version issue is encountered. This means that readfish will continue to function with future versions of minKNOW if compatible. * Add default when popping `sample_rate` from guppy params Prevents `KeyError` from being raised if `sample_rate`isn't listed as a `kwarg` * Remove unused basecaller compatibilty function We now just check in `dorado.py` and warn if there is a mismatch * Correct docstring, add doctests * Add more complete docstring to `DIRECTION` enum Only return Enum variant from `check_compatibility`, not tuple of (bool, variant) * Suggest opening an issue if a suitable version of readfish doesn't exist --------- Co-authored-by: Adoni5 <[email protected]> * Add __futures__ annotation for Py38 compatibility * Deprecation warning on Guppy plugin * Add check for Write permission on Dorado socket --------- Co-authored-by: Adoni5 <[email protected]>
- Loading branch information
Showing
29 changed files
with
557 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""__about__.py | ||
Version of the read until software | ||
""" | ||
__version__ = "2024.1.0" | ||
__version__ = "2024.2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
"""_compatibility.py | ||
Contains utilities for checking readfish compatibility with various versions of MinKNOW. | ||
Checks ranges of `readfish` against the `MinKNOW` version | ||
Attributes: | ||
LATEST_TESTED (str): The latest tested version of MinKNOW. | ||
MINKNOW_COMPATIBILITY_RANGE (tuple): The compatibility range of MinKNOW versions for this version of readfish. | ||
DIRECTION (Enum): An enumeration representing upgrade, downgrade, or no change directions. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
from minknow_api.manager import Manager | ||
from packaging.version import parse as parse_version | ||
from packaging.version import Version | ||
|
||
LATEST_TESTED = "5.9.7" | ||
|
||
# The versions of MinKNOW which this version of readfish can connect to | ||
# Format - (lowest minknow version, highest version of minknow supported as an upper bound) | ||
MINKNOW_COMPATIBILITY_RANGE = ( | ||
Version("5.0.0"), | ||
Version(LATEST_TESTED), | ||
) | ||
|
||
|
||
class DIRECTION(Enum): | ||
""" | ||
Represents the direction in which the version of the readfish software should be changed | ||
to be compatible with the tested version of an external tool (likely MinKNOW). | ||
Attributes: | ||
UPGRADE: Indicates that the readfish software version should be upgraded. | ||
DOWNGRADE: Indicates that the readfish software version should be downgraded. | ||
JUST_RIGHT: Indicates that the readfish software version is already compatible | ||
with the tested version of the external tool. | ||
""" | ||
|
||
UPGRADE = "upgrade" | ||
DOWNGRADE = "downgrade" | ||
JUST_RIGHT = "do nothing" | ||
|
||
|
||
def _get_minknow_version(host: str = "127.0.0.1", port: int = None) -> Version: | ||
""" | ||
Get the version of MinKNOW | ||
:param host: The host the RPC is listening on, defaults to "127.0.0.1" | ||
:param port: The port the RPC is listening on, defaults to None | ||
:return: The version of MinKNOW readfish is connected to | ||
""" | ||
manager = Manager(host=host, port=port) | ||
minknow_version = parse_version(manager.core_version) | ||
return minknow_version | ||
|
||
|
||
def check_compatibility( | ||
comparator: Version, | ||
version_range: tuple[Version, Version] = MINKNOW_COMPATIBILITY_RANGE, | ||
) -> DIRECTION: | ||
""" | ||
Check the compatibility of a given software version, between a given range, | ||
inclusive of the right edge. | ||
:param comparator: Version of the provided software, for example MinKNOW 5.9.7 | ||
:param version_ranges: A tuple of lowest supported version, highest supported version | ||
:return: A direction variant indicating if this version of readfish needs to be changed. | ||
Examples: | ||
>>> from packaging.version import Version | ||
>>> check_compatibility(Version("5.9.5"), (Version("5.0.0"), Version("5.9.7"))) | ||
<DIRECTION.JUST_RIGHT: 'do nothing'> | ||
>>> check_compatibility(Version("5.9.7"), (Version("5.0.0"), Version("5.9.7"))) | ||
<DIRECTION.JUST_RIGHT: 'do nothing'> | ||
>>> check_compatibility(Version("5.9.8"), (Version("5.0.0"), Version("5.9.7"))) | ||
<DIRECTION.UPGRADE: 'upgrade'> | ||
>>> check_compatibility(Version("4.9.0"), (Version("5.0.0"), Version("5.9.7"))) | ||
<DIRECTION.DOWNGRADE: 'downgrade'> | ||
>>> if (action := check_compatibility(Version("6.0.0"), MINKNOW_COMPATIBILITY_RANGE)) in ( | ||
... DIRECTION.UPGRADE, | ||
... DIRECTION.DOWNGRADE, | ||
... ): | ||
... action | ||
<DIRECTION.UPGRADE: 'upgrade'> | ||
""" | ||
( | ||
lowest_supported_version, | ||
highest_supported_version, | ||
) = version_range | ||
if comparator < lowest_supported_version: | ||
return DIRECTION.DOWNGRADE | ||
return ( | ||
DIRECTION.JUST_RIGHT | ||
if comparator <= highest_supported_version | ||
else DIRECTION.UPGRADE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.