seismicrna.core.io package

Subpackages

Submodules

class seismicrna.core.io.batch.MutsBatchIO(*args, region: Region, **kwargs)

Bases: MutsBatch, ReadBatchIO, ABC

Pickled file of a batch of mutational data.

class seismicrna.core.io.batch.ReadBatchIO(*, batch: int)

Bases: ReadBatch, BrickleIO, ABC

Pickled file of a batch of data.

classmethod btype()
exception seismicrna.core.io.brickle.WrongChecksumError

Bases: ValueError

A file or piece of data has the wrong checksum.

seismicrna.core.io.brickle.digest_data(data: bytes)

Compute the MD5 digest of the data as a hexadecimal number.

seismicrna.core.io.brickle.digest_file(file: Path | str)
seismicrna.core.io.brickle.load_brickle(file: Path | str, data_type: type, checksum: str)

Unpickle and return an object from a Brotli-compressed file.

seismicrna.core.io.brickle.save_brickle(item: Any, file: Path, brotli_level: int = 10, force: bool = False)

Pickle an object, compress with Brotli, and save to a file.

class seismicrna.core.io.file.BrickleIO

Bases: FileIO, ABC

Brotli-compressed file of a Pickled object (Brickle).

classmethod load(file: Path, **kwargs)

Load from a compressed pickle file.

save(top: Path, *args, **kwargs)

Save to a pickle file compressed with Brotli.

class seismicrna.core.io.file.FileIO

Bases: ABC

Any file saved by SEISMIC-RNA, rather than by a dependency.

classmethod auto_fields() dict[str, Any]

Names and automatic values of selected fields.

classmethod build_path(**path_fields)

Build the file path from the given field values.

abstract classmethod dir_seg_types() tuple[Segment, ...]

Types of the directory segments in the path.

abstract classmethod file_seg_type() Segment

Type of the last segment in the path.

get_path(top: Path)

Return the file path.

abstract classmethod load(file: Path)

Load an object from a file.

classmethod parse_path(file: Path)

Parse a file path to determine the field values.

path_field_values(top: Path | None = None, exclude: Iterable[str] = ())

Path field values as a dict.

classmethod path_fields()

Path fields for the file type.

abstract save(top: Path, **kwargs)

Save the object to a file.

classmethod seg_types()

Types of the segments in the path.

class seismicrna.core.io.file.RefIO(*, sample: str, ref: str, **kwargs)

Bases: FileIO, ABC

Saved file with a sample, command, and reference.

classmethod dir_seg_types()

Types of the directory segments in the path.

class seismicrna.core.io.file.RegIO(*, reg: str, **kwargs)

Bases: RefIO, ABC

File with a region of a reference.

classmethod dir_seg_types()

Types of the directory segments in the path.

seismicrna.core.io.file.recast_file_path(input_path: Path, input_type: type[FileIO], output_type: type[FileIO], **override: Any)

Recast input_path from input_type to output_type.

Parameters:
  • input_path (Path) – Input path from which to take the path fields.

  • input_type (type[FileIO]) – Type of file to use to determine the fields in input_path.

  • output_type (type[FileIO]) – Type of file to use for fitting the path fields and building a new path.

  • **override (Any) – Override fields in input_path (but not output_type).

Returns:

Path for file of output_type made from fields in input_path (as determined by the file of input_type).

Return type:

Path

class seismicrna.core.io.seq.RefseqIO(*args, refseq: DNA, **kwargs)

Bases: RefIO, BrickleIO

classmethod auto_fields()

Names and automatic values of selected fields.

classmethod file_seg_type()

Type of the last segment in the path.

property refseq