Skip to content

POD5 API Utils Reference

Utility functions for the pod5 API

Pod5ApiException

Bases: Exception

Generic Pod5 API Exception

deprecation_warning

deprecation_warning(deprecated: str, alternate: str) -> None

Issue a FutureWarning warning that deprecated has been deprecated in favour of alternate.

Parameters:

Name Type Description Default
deprecated str

The module path to the deprecated item

required
alternate str

The module path to the alternate item

required

format_read_ids

format_read_ids(read_ids: Union[NDArray[uint8], FixedSizeBinaryArray]) -> List[str]

Convert a packed array of read_ids and convert them to a list of strings.

Parameters:

Name Type Description Default
read_ids (ndarray[uint8], FixedSizeBinaryArray)

Packed read_ids from a numpy.ndarray or read directly from pod5 file

required

Returns:

Name Type Description
read_ids list[str]

A list of converted read_ids as strings

pack_read_ids

pack_read_ids(read_ids: Collection[str], invalid_ok: bool = False) -> NDArray[uint8]

Convert a Collection of read_id strings to a numpy.ndarray in preparation for writing to pod5 files.

Parameters:

Name Type Description Default
read_ids Collection[str]

Collection of well-formatted read_id strings

required

Returns:

Name Type Description
packed_read_ids ndarray[uint8]

Repacked read_ids ready for writing to pod5 files.

safe_close

safe_close(obj: Any, attr: str) -> None

Try to close() an object's attribute ignoring any exceptions raised. This is used to safely handle closing potentially unassigned attributes while calling close() in del()