smftools.informatics.pod5_functions#

Functions

basecall_pod5s(config_path)

Basecall POD5 inputs using a configuration file.

extract_pod5_read_metadata(pod5_path_or_dir)

Extract per-read POD5 sequencing + signal metadata into a DataFrame.

fast5_to_pod5(fast5_dir[, output_pod5])

Convert FAST5 inputs into a single POD5 file.

iter_pod5_signals(pod5_path_or_dir[, ...])

Yield (read_id, signal) for selected reads across POD5 file(s).

subsample_pod5(pod5_path, read_name_path, ...)

Write a subsampled POD5 containing selected reads.

subsample_pod5_for_basecalling(input_path, ...)

Randomly sample up to max_reads reads from pod5 inputs and write a temp pod5.

smftools.informatics.pod5_functions.basecall_pod5s(config_path)#

Basecall POD5 inputs using a configuration file.

Parameters:

config_path (str | Path) -- Path to the basecall configuration file.

Return type:

None

smftools.informatics.pod5_functions.fast5_to_pod5(fast5_dir, output_pod5='FAST5s_to_POD5.pod5')#

Convert FAST5 inputs into a single POD5 file.

Parameters:
  • fast5_dir (Union[str, Path, Iterable[str | Path]]) -- FAST5 file path, directory, or iterable of file paths to convert.

  • output_pod5 (str | Path (default: 'FAST5s_to_POD5.pod5')) -- Output POD5 file path.

Raises:

FileNotFoundError -- If no FAST5 files are found or the input path is invalid.

Return type:

None

smftools.informatics.pod5_functions.subsample_pod5(pod5_path, read_name_path, output_directory)#

Write a subsampled POD5 containing selected reads.

Parameters:
  • pod5_path (str | Path) -- POD5 file path or directory of POD5 files to subsample.

  • read_name_path (str | int) -- Path to a text file of read names (one per line) or an integer specifying a random subset size.

  • output_directory (str | Path) -- Directory to write the subsampled POD5 file.

Return type:

None

smftools.informatics.pod5_functions.subsample_pod5_for_basecalling(input_path, max_reads, output_dir, seed=42)#

Randomly sample up to max_reads reads from pod5 inputs and write a temp pod5.

Collects read IDs from all pod5 files first (memory-efficient), then samples, then writes only the selected reads. If the total read count is already <= max_reads the original input_path is returned unchanged.

Parameters:
  • input_path (str | Path) -- A single pod5 file or a directory containing pod5 files.

  • max_reads (int) -- Maximum number of reads to retain.

  • output_dir (str | Path) -- Directory to write the subsampled pod5 file.

  • seed (int (default: 42)) -- Random seed for reproducibility.

Return type:

Path

Returns:

Path to the (possibly new) pod5 file to use for basecalling.

smftools.informatics.pod5_functions.iter_pod5_signals(pod5_path_or_dir, read_ids=None, *, pattern='*.pod5', calibrated=True)#

Yield (read_id, signal) for selected reads across POD5 file(s).

Parameters:
  • pod5_path_or_dir (str | Path) -- A POD5 file or a directory of POD5 files.

  • read_ids (Optional[Iterable[str]] (default: None)) -- Optional read ids to fetch (defaults to all reads).

  • pattern (str (default: '*.pod5')) -- Glob for POD5 files when a directory is given.

  • calibrated (bool (default: True)) -- Yield signal_pa (picoamps) when True, else raw DAC signal.

Yields:

(read_id, numpy.ndarray) one read at a time (bounded memory).

smftools.informatics.pod5_functions.extract_pod5_read_metadata(pod5_path_or_dir, target_ids=None, *, pattern='*.pod5', n_jobs=1, include_current=False, verbose=True)#

Extract per-read POD5 sequencing + signal metadata into a DataFrame.

Links each read to its origin POD5 and captures scalar run/pore/signal metadata (channel, well, calibration, median_before, sample_rate, flow cell, kit, etc.). The full current trace is only included when include_current is True and is left in the returned frame as pod5_current_pa (ragged); it is never promoted to the spine.

Parameters:
  • pod5_path_or_dir (str | Path) -- A POD5 file or a directory of POD5 files.

  • target_ids (Optional[Iterable[str]] (default: None)) -- Optional read ids to keep (defaults to all reads).

  • pattern (str (default: '*.pod5')) -- Glob for POD5 files when a directory is given.

  • n_jobs (int | None (default: 1)) -- Worker processes; <=1 runs serially.

  • include_current (bool (default: False)) -- Also capture the calibrated current trace per read.

  • verbose (bool (default: True)) -- Log progress.

Returns:

pandas.DataFrame indexed by read_id (empty if no reads matched).