writer

Tools for writing POD5 data

class Writer(path: Union[PathLike, str], software_name: str = 'Python API')[source]

Bases: object

Pod5 File Writer

__init__(path: Union[PathLike, str], software_name: str = 'Python API')[source]

Open a pod5 file for Writing.

Parameters:
  • path (os.PathLike, str) – The path to the pod5 file to create

  • software_name (str) – The name of the application used to create this pod5 file

add(obj: Union[EndReason, str, RunInfo]) int[source]

Add a EndReason, PoreType, or RunInfo object to the Pod5 file (if it doesn’t already exist) and return the index of this object in the Pod5 file.

Parameters:

obj (EndReason, PoreType, RunInfo) – Object to find in this Pod5 file, adding it if it doesn’t exist already

Returns:

index – The index of the object in the Pod5 file

Return type:

int

add_read(read: Union[Read, CompressedRead]) None[source]

Add a record to the open POD5 file with either compressed or uncompressed signal data depending on the given type of Read.

Parameters:

read (Read, CompressedRead) – POD5 Read or CompressedRead object to add as a record to the POD5 file.

add_reads(reads: Sequence[Union[Read, CompressedRead]]) None[source]

Add Read objects (with uncompressed signal data) as records in the open POD5 file.

Parameters:

reads (Sequence of Read or CompressedRead exclusively) – List of Read object to be added to this POD5 file

close() None[source]

Close the FileWriter handle

contains(obj: Union[EndReason, RunInfo]) bool[source]

Test if this Pod5 file contains the given object.

Parameters:

obj (EndReason, RunInfo) – Object to find in this Pod5 file

Return type:

True if obj has already been added to this file

find(obj: Union[EndReason, RunInfo]) int[source]

Returns the index of obj in this Pod5 file raising a KeyError if it is missing.

Parameters:

obj (EndReason, RunInfo) – Obj instance to find in this Pod5 file

Return type:

The index of the object in this Pod5 file

Raises:

KeyError – If the object is not in this file

property path: Path

Return the path to the pod5 file

property software_name: str

Return the software name used to open this file

force_type_and_default(value, dtype, count, default_value=None)[source]
map_to_tuples(info_map: Any) List[Tuple[str, str]][source]

Convert a fast5 property map (e.g. context_tags and tracking_id) to a tuple or string pairs to pass to pod5 C API

timestamp_to_int(time_stamp: Union[datetime, int]) int[source]

Convert a datetime timestamp to an integer if it’s not already an integer