inif.indexed
The single-file indexed archive (.inif) stores metadata and sequences once, then writes each sample as a separate compressed member. InifDocument.save / InifDocument.load dispatch to this module automatically when the path ends in .inif; the entry points below expose the lower-level options (custom compression level, max preview-text length, partial loads via sample_ids=).
For format-agnostic readers (iter_samples, read_samples, read_info) that work on both .inif and .inif.json files, see inif.io.
See Saving and loading for the narrative overview.
Writer
IndexedInifWriter
Incremental writer for the single-file indexed INIF archive format.
class IndexedInifWriterMethods
- flush
-
Flush the archive so already-written samples are readable.
def flush(self) -> None
save_indexed
Save doc as a single indexed archive.
The archive stores metadata and sequences once, then writes each sample as a separate compressed member. Readers can load the header, summaries, one sample, or all samples without inflating the entire document up front.
def save_indexed(
doc: InifDocument,
path: str | Path,
*,
compact: bool = True,
compression: int = zipfile.ZIP_DEFLATED,
max_preview_chars: int = _DEFAULT_TEXT_PREVIEW_CHARS,
) -> NonedocInifDocumentpathstr | Pathcompactboolcompressionintmax_preview_charsint
Reader
load_indexed
Load an indexed archive, optionally with only selected samples.
def load_indexed(
path: str | Path,
sample_ids: Iterable[str | int] | None = None,
) -> InifDocumentpathstr | Pathsample_idsIterable[str | int] | None