Artifacts, lineage, and summaries API reference#
An artifact is an immutable persisted result. Its provenance lets CyteArc verify its
inputs, inspect its lineage, and reuse a completed match. Analysis code normally creates and
consumes artifacts through DataStore methods.
See Why CyteArc records provenance, Analysis pipeline API reference, and Build a neighbor graph stage by stage.
Types#
A machine-readable failure to resolve or validate an artifact. |
|
A snapshot of the upstream lineage of artifact outputs. |
|
The per-cell values of one cell-aligned artifact or cell column, aligned to cells. |
|
One exact artifact held by another datastore. |
|
One released change to what an operation computes. |
|
Build an immutable unordered collection of unique elements. |
- class cytearc.ArtifactRef(scope, kind, artifact_id, assay=None)#
- class cytearc.ArtifactResolutionError(message, *, code, context)#
A machine-readable failure to resolve or validate an artifact.
- class cytearc.ArtifactStatus(ref, path, exists, complete, provenance=None, execution_options=None, created_at_ns=None, cytearc_version=None, stored_diagnostics=<factory>)#
- property current_revision: int | None#
The revision this CyteArc release records for the same provenance.
- property diagnostics: dict[str, Any]#
The diagnostics that the artifact’s operation saved, by name.
They are the numbers that the operation recorded about what it read, kept, dropped and expected, empty when the operation records none or the artifact does not exist. A diagnostic that a later revision of the operation added is None when the artifact predates it.
- Raises:
ValueError – If the operation records diagnostics and the artifact holds none, as artifacts saved before CyteArc recorded them, or other ones; the message names the call that computes it anew.
- input_ref(name)#
Return the exact artifact reference recorded as input
name.- Raises:
ArtifactResolutionError – With code
corrupt_payloadwhen the input is missing or is not an exact artifact reference.- Return type:
- property is_current: bool#
Whether the artifact records the revision this release records.
Only the artifact’s own revision is judged, never its inputs.
- property revision: int | None#
The operation revision the artifact records, or None if unknown.
- stored_diagnostics: Mapping[str, Any]#
The attributes that hold the artifact’s saved diagnostics, as stored, empty when it holds none.
- property superseded_by: tuple[OperationRevision, ...]#
Released revisions newer than the recorded one that apply, oldest first.
- class cytearc.ArtifactLineage(graph, outputs)#
A snapshot of the upstream lineage of artifact outputs.
- class cytearc.DataStoreSummary(zarr_mode, workspace, default_assay, cytearc_version, resources, total_cells, active_cells, cell_columns, assays, artifacts, pipeline_run_counts, labeled_pipeline_runs)#
- to_dict()#
Return a deterministic representation containing JSON-safe values.
- Return type:
dict[str,Any]
- class cytearc.metadata.CellValues(source, value, values, cell_ids, cell_idx, cell_selection, missing, categorical)#
The per-cell values of one cell-aligned artifact or cell column, aligned to cells.
- source#
The artifact, or the
CellFieldof the cell column, that holds the values.
- value#
The name of the array or column that was read.
- values#
One value, or one row of values, per cell.
- cell_ids#
The
idsof the cells, aligned tovalues, or None when the read left them out withcell_ids=False.
- cell_idx#
The row of each cell in the cell table, in ascending order.
- cell_selection#
The cell selection that the rows follow.
- missing#
True for each cell whose value is missing, or None.
- categorical#
Whether the values are labels that group cells.
- to_pandas()#
Return the values indexed by cell id, showing missing rows as missing.
- Raises:
ValueError – If the read left out the cell ids, or the values have more than two dimensions.
- Return type:
Series|DataFrame
- class cytearc.storage.refs.ExternalArtifactRef(dataset_fingerprint, ref, anchor_assay=None)#
One exact artifact held by another datastore.
dataset_fingerprintnames the dataset whose axes the artifact is aligned to: the prepared dataset fingerprint of one of its assays, the anchor assay. It names a dataset, not a datastore, so a mount and its source share it, and the caller supplies the datastore that holds the artifact. The anchor is the artifact’s own assay unlessanchor_assaynames another one, which a datastore-scoped artifact, or an artifact of a different assay, must do.- property fingerprint_assay: str#
The assay of the other datastore that
dataset_fingerprintdescribes.
- class cytearc.storage.operation_revisions.OperationRevision(revision, release, change, applies, added_diagnostics=())#
One released change to what an operation computes.
- revision#
The revision number; an operation’s first change is 2.
- release#
The first CyteArc release that records it, such as
"1.0.0".
- change#
One line that says what changed.
- applies#
A pure predicate that selects the affected artifacts, or None for all.
- added_diagnostics#
The diagnostics that the operation saves from this revision on. An artifact of an earlier revision that lacks one reads it as None, not measured. Only a revision that applies to every artifact adds diagnostics.
An ArtifactRef is a location-free name: a scope, a kind, an assay for assay-scoped artifacts,
and a random 256-bit artifact_id. Provenance, pipeline records, and lineage store refs, never
paths or store locations, so the datastore decides which stores resolve a ref. A datastore
resolves its own artifacts; a mounted target resolves its own and then, read only, its source’s
(see Mounted targets).
Supported artifact kind names are listed in cytearc.storage.ARTIFACT_KINDS.
- cytearc.storage.ARTIFACT_KINDS#
Build an immutable unordered collection of unique elements.
Selections and summaries#
Cell and feature selections are immutable Boolean artifacts aligned to a complete stored axis. Their integrity includes the values and the exact ordered row identities. A live metadata column may be the source of a selection, but changing that column does not change or invalidate the historical artifact. Replacing, reordering, adding, or removing axis IDs fails closed; CyteArc does not remap a stored result by matching IDs.
Feature summaries hold sufficient statistics for one exact cell selection and can be reused by
detected-feature, HVG, prevalent-peak, and cell-cycle producers. New code does not create or read
mounted summary_stats_* groups. RNA summaries persist normed_tot, normed_n, and sigmas;
ATAC summaries persist prevalence and document_frequency.
Producer |
Artifact inputs |
Scientific identity |
|---|---|---|
assay universe |
none |
dataset and ordered feature IDs |
manual selection |
|
supplied values fingerprint |
RNA or ATAC summary |
|
normalizer settings |
detected features |
|
|
highly variable genes |
|
resolved variability settings, including the resolved |
prevalent peaks |
|
|
mapping overlap |
mapping reference and query |
exact inputs |
features.hvgs, features.prevalent_peaks, features.detected, and
features.snapshot return exact feature-selection refs. They do not create metadata columns.
features.resolve accepts an explicit compatible ref.
Graph lineage#
Graph-derived analyses follow named artifact inputs:
connectivity_map -> neighbors -> coordinates and ann_index
ann_index -> the same coordinates
batch_correction -> reduction -> normalized -> feature_selection
Native graphs project one feature selection. Imported-coordinate graphs project none. Integrated
graphs follow their ordered source_i refs and can project zero, one, or several distinct
selections. Graph and neighbor consumers require their exact refs. Analytical producers return
artifacts and leave metadata unchanged.
Inspect and trace results#
Use public datastore methods rather than reading private Zarr paths:
refs = ds.artifacts.list(kind="reduction", complete_only=True)
status = ds.artifacts.inspect(refs[0])
status.operation
status.parameters
status.inputs
status.execution_options
status.created_at_ns
status.cytearc_version
status.revision
status.current_revision
status.is_current
status.superseded_by
status.diagnostics
artifacts.list uses the default assay unless another assay is supplied. Store-level outputs can
be listed with scope="datastore". artifacts.load(ref) opens the payload only after CyteArc confirms
that the artifact exists and is complete, and artifacts.load_values(ref) reads the per-cell values of a
cell-aligned artifact, or of a cell column over a cell selection, aligned to their cells (Read per-cell values).
A producer makes its artifact complete with one final write. A write that fails with an error
before that write removes its incomplete artifact. An interruption, such as Ctrl-C, a cancelled
task, or a shutdown request, keeps the artifact, marked incomplete, and logs how to remove it,
because Zarr may still be running the write that the interruption stopped waiting for, and a removed
artifact would collect its late chunks. Once the final write is issued, CyteArc never removes the
artifact, because the write can persist even when it reports an error. A process that is killed
(SIGKILL, the out-of-memory killer, a kernel restart) leaves its incomplete artifact too, and a write
that lands after its artifact was removed leaves chunks without an artifact record. Nothing reuses
this residue, and artifacts.list(complete_only=False) shows the incomplete artifacts.
ds.artifacts.prune_incomplete() lists the residue below the datastore’s artifacts and those of
every assay: the incomplete artifacts and the directories of chunks without a record.
ds.artifacts.prune_incomplete(dry_run=False) removes it and returns what it removed. It never
removes a complete artifact, an artifact whose record cannot be read, an unknown kind, or anything
whose name is not an artifact ID, and a mounted store removes only its own artifacts. An artifact
that another process is writing is incomplete until it finishes, so remove the residue only after
confirming that no process is writing to the store; removing needs zarr_mode='r+'.
ds.artifacts.prune_incomplete() # list what interrupted or killed writes left
ds.artifacts.prune_incomplete(dry_run=False) # remove it, once no process writes
A listing reads each artifact’s record. An artifact whose record cannot be read, such as a torn
zarr.json, and a kind that this release does not know, such as one a newer release wrote, are
skipped with a warning that names them, so the other artifacts are still listed, found, and reused.
Results whose values must be finite are checked while they are written: normalized values, reduced
coordinates, loadings, and centers, Harmony corrections and their fitted state, embedding
initializations, embeddings, neighbor distances, and connectivity-map and integrated-graph
weights. A NaN or infinite value, or a finite value too large for the stored dtype, raises
ValueError naming the operation, the array, and the first row that holds it; no artifact is
published.
Diagnostics and their warnings#
Diagnostics are the numbers that an operation records about what it read, kept, dropped and expected, so that you can judge a result without reading its arrays: the barcodes of an imported file that match no cell of the store, say, or the share of cells in the largest clone. ds.artifacts.inspect(ref).diagnostics returns them for any artifact as a flat mapping of camelCase names, empty when the operation records none. A count is the plural noun of what it counts (unmatchedBarcodes), a share between 0 and 1 ends in Share, a model’s expectation starts with expected, and up to five examples end in Examples. Values are integers, finite floats, text, or None for a number that was not measured; a key that ends in PerFile holds a count for each file of an import, in the canonical order of its files, which its provenance’s sources list. The artifact saves them with its last write, so a reused artifact reports the numbers of its computation, and they never enter its identity.
Each operation records a fixed set of names, and shared steps add theirs:
Step |
Diagnostics |
|---|---|
Joining a file’s barcodes to cells, in every importer |
|
Saving clones, in every clone source, clonotypes among them |
|
Grouping cells for a summary of clones: |
|
Each operation’s own names follow these; the API reference of each domain lists them beside the operation. A summary that saves nothing holds its diagnostics in its record’s diagnostics, and the exports of clones, character matrices and AIRR contigs return theirs in an ExportSummary, with the path written and the rows, the cells or contigs written.
An operation warns from its saved diagnostics after it computes or reuses its artifact, so a reused artifact gives the warning that its computation gave, and those exports warn from the diagnostics they return. Barcodes that name no cell of the store warn, and those of cells outside the selection do not. A diagnostic never refuses a call: one that cannot be measured is saved as None, as barcode clones save their expected chance matches beyond 8 edits. These warnings are DiagnosticWarnings, a UserWarning that names the operation, the diagnostic and its value, so filter the category to leave CyteArc’s own warnings out and apply the thresholds of your study to the numbers:
import warnings
from cytearc import DiagnosticWarning
with warnings.catch_warnings():
# Leave CyteArc's own warnings out and apply this study's thresholds.
warnings.simplefilter("ignore", DiagnosticWarning)
clones = ds.clones.import_clones("clones.csv", cell_selection=cells)
numbers = ds.artifacts.inspect(clones).diagnostics
if numbers["unselectedBarcodes"] > 0.1 * numbers["fileBarcodes"]:
print("A tenth of the clone file's barcodes are cells that the selection leaves out")
An artifact that an earlier CyteArc saved without the diagnostics its operation now records is not reused: the next call computes it anew and leaves the old one in the store. Reading the old artifact, through inspect(ref).diagnostics or a loader, raises ValueError with the call that computes it anew. A diagnostic that an operation gained in a later release is the exception: an artifact saved before it reads it as None, not measured, as an HVG selection that CyteArc 1.4.0 saved reads selectedDetectionRatio, and an import of clones, receptors, lineage barcodes or recorder alleles reads rowsPerFile or contigsPerFile. Such an artifact still serves the calls that read it, and the call that saved it computes it anew instead of reusing it (Diagnostics added after a release).
- class cytearc.DiagnosticWarning(message, operation=None, diagnostic=None, value=None)#
A warning that an operation gives from a diagnostic it saved with its artifact.
An operation gives the warning after it computes its artifact and again whenever it reuses it, from the diagnostics the artifact holds. Filter this category to leave CyteArc’s own warnings out, and read the numbers from
ds.artifacts.inspect(ref).diagnosticsto apply other thresholds.- operation#
The operation that saved the artifact, such as
"import_clones", or None for a warning that Python’swarnings.warnmakes from text alone.
- diagnostic#
The diagnostic that the warning reports, such as
"unmatchedBarcodes", or None.
- value#
The diagnostic’s saved value, or None.
- class cytearc.ExportSummary(path, rows, diagnostics)#
What an export wrote: its file, its rows and its diagnostics.
- path#
The file or folder that the export wrote.
- rows#
The rows written: the cells of a clone or character table, the contigs of an AIRR table.
- diagnostics#
The export’s diagnostics, by name, in the order that it declares them.
Operation revisions and stale results#
Provenance records an operation revision when it is 2 or more; an artifact without one is revision 1.
A CyteArc release that changes what an operation computes adds a revision
(Operation revisions), and reuse requires the revision that the running
release records, so results of an older revision are computed again. status.revision is the
recorded revision, status.current_revision the revision that the running release records for the
same provenance, and status.is_current whether they agree. is_current judges only the
artifact’s own revision: an artifact built from a superseded input is current itself.
status.superseded_by lists the released revisions after the recorded one that apply to the
artifact, each with the change it made. The cytearc_version attribute names the release that
wrote an artifact for diagnostics and never affects reuse.
A superseded artifact is never reused but stays listable, loadable, and traceable. When planning
finds one and no exact match, it logs one INFO line that names it and the changes since its revision.
Payload validation still applies: marker-table readers require fold_change_policy metadata
and refuse a table that does not record it.
DataStore.artifacts.lineage reports show a superseded artifact with the status stale. Results built on
it keep their own current revision, but once it is computed again it has a new reference, so the
results built on it are computed again too. Passing a superseded artifact explicitly as an input
is allowed and records it in lineage as usual.
Reuse of imports#
Beside its inputs and arguments, an import such as clones.import_clones or variants.import_counts is identified by the files it reads and the names it takes from them, never by the folders that hold them. Each file counts by the SHA-256 of its bytes: the file that a path names, the files read beside it, such as a CARLIN pair’s annotations or a clone matrix’s lists of cells and clones, the files that a reader takes from a tool’s folder, by their roles, and every file of a Zarr store, with its path below the store. The names are the options that turn barcodes into cell IDs, barcode_prefix, barcode_suffix and barcode_pattern, and those that an import takes from a file, such as the namespace of a clone file’s labels, a lineage barcode file’s library or the name a tree takes from its file. A file moved or copied to another folder therefore reuses the saved import, the same files listed in another order give the same import, and an edited file gives a new one. A file listed twice with the same prefix and suffix raises ValueError.
Find one saved result#
ds.artifacts.find locates a graph, embedding, or clustering without requiring its storage kind
or producing-operation name. By default it searches computed results. It reads complete saved
results and requires exactly one match. No match or more than one match raises
ArtifactResolutionError, a ValueError; it never computes a result or chooses the newest one.
layout = ds.artifacts.find("embedding", graph=graph_ref, method="umap")
clusters = ds.artifacts.find("clusters", graph=graph_ref, method="leiden", resolution=0.5)
coordinates = ds.artifacts.load_values(layout)
Computed result |
Methods |
|---|---|
|
|
|
|
|
|
Omitting method includes all methods for the requested computed result.
Use from_assay= to restrict an assay, or graph= to match that exact graph and its scope.
Without either, the search includes the default assay and datastore-scoped results. Extra
keywords such as resolution= match saved parameters. Float parameters use the producer’s
numeric conversion, so resolution=1 and resolution=1.0 find the same results. Other
parameter types retain exact matching. Superseded results remain candidates.
For example, a graph clustered at one resolution both with backend="igraph", the Leiden default
of earlier releases, and with the current default backend="cytearc" has two matches; add
backend= to choose one.
To find an imported embedding by its original source key, pass imported=:
imported_layout = ds.artifacts.find("embedding", imported="X_umap", from_assay="RNA")
imported must be a nonempty string and is available only for "embedding". It searches imported
results separately from computed results, using the same assay scope rules. It cannot be combined
with method=, graph=, or dimreduc_key=. Other recorded parameter filters remain available.
The cytebase.embedding and cytebase.embeddings helpers, now in the separate cytebase package,
remain supported.
For other kinds or arbitrary provenance filters, use ds.artifacts.list.
Exact provenance filters#
DataStore.artifacts.list can match the operation, parameters, and inputs that provenance
records. The recorded revision is not a filter, so a listing includes superseded artifacts:
Filter |
Match rule |
|---|---|
|
Exact operation name, such as |
|
Exact values for each supplied top-level parameter after provenance serialization |
|
Exact values for each supplied top-level input after provenance serialization |
Supplied filters are combined with AND. Mapping key order does not matter, and an ArtifactRef
matches its serialized to_dict() form. Each supplied top-level entry must match exactly, while
the stored provenance may contain other top-level entries. A supplied nested mapping is compared
as a complete value, not as another partial query. Passing {} matches an empty mapping; passing
None leaves that field unfiltered.
Any operation, parameters, or inputs filter returns only complete artifacts with valid
provenance, even when complete_only=False. To search with every top-level provenance entry
available from a known result, inspect it and pass those complete fields back unchanged:
refs = ds.artifacts.list(kind="reduction", complete_only=True)
known = ds.artifacts.inspect(refs[0])
matching_refs = ds.artifacts.list(
kind=known.ref.kind,
from_assay=known.ref.assay,
operation=known.operation,
parameters=known.parameters,
inputs=known.inputs,
)
This still uses containment matching. A stored artifact with the same supplied entries plus additional top-level entries also matches.
DataStore.artifacts.lineage follows artifact inputs upstream:
lineage = ds.artifacts.lineage(
{
"baselineGraph": baseline_graph,
"alternativeGraph": alternative_graph,
}
)
markdown_report = lineage.to_markdown()
mermaid_source = lineage.to_mermaid()
This identifies the exact selections, normalization, coordinates, and graph behind a result and
shows where branches diverge. Each artifact in the report has one status: complete; stale when
a later operation revision supersedes it; incomplete; missing; corrupt when its record cannot
be read, such as an artifact_id attribute that names another artifact or a malformed recorded
input, which the report names and does not follow further; or unresolved external for an input in
another datastore that was not supplied. Lineage of any depth is traced.
An input stored in another datastore, such as the mapping reference behind a query projection, is
recorded as an ExternalArtifactRef. It names the artifact’s dataset by the prepared dataset
fingerprint of one of its assays; anchor_assay names that assay when the artifact is
datastore-scoped or belongs to another assay. The fingerprint names a dataset, not a store, and a
mount shares its source’s. Pass the mapping references to
DataStore.artifacts.lineage(target, references=...) to follow such inputs into their datastores; without
them, an external input is shown as unresolved. A mount records the source artifacts it uses as
plain refs, because it resolves them itself.
ArtifactResolutionError is a ValueError with a machine-readable code and JSON-safe
context. Failures distinguish missing or incomplete artifacts, wrong kind/scope/assay, changed
row identity or selection values, corrupt payloads, and incompatible artifact contracts. The error
explains what failed; it does not choose a replacement result.
Read per-cell values#
artifacts.load_values(ref) reads the per-cell values of a cell-aligned artifact and returns a
cytearc.metadata.CellValues aligned to the ids of its cells. A cell-aligned artifact
holds a row for each cell of the cell selection that its provenance records as its cell_selection
input. The table lists these kinds, the canonical array that artifacts.load_values reads by default,
whether that array holds labels that group cells or measurements, and the other per-cell arrays
that value= may name. Every other kind is refused, among them cell selections, reference labels,
graphs, and per-feature results. Reductions and Harmony corrections hold a row per cell too, but
their rows follow the cell selection of their lineage rather than a recorded input; open them with
artifacts.load.
Kind |
Canonical array |
Holds |
Other label arrays |
Other measurement arrays |
|---|---|---|---|---|
|
|
measurements |
|
|
|
|
measurements |
|
|
|
|
labels |
|
|
|
|
labels |
|
|
|
|
labels |
|
|
|
|
labels |
|
|
|
|
labels |
|
|
|
|
labels |
||
|
|
labels |
||
|
|
measurements |
|
|
|
|
measurements |
||
|
|
measurements |
||
|
|
measurements |
|
|
|
|
labels |
|
|
|
|
labels |
|
|
|
|
labels |
|
|
|
|
measurements |
||
|
|
labels |
|
|
|
|
measurements |
|
|
|
|
measurements |
|
|
|
|
measurements |
|
|
|
|
labels |
|
|
|
|
measurements |
||
|
|
measurements |
||
|
|
labels |
|
|
|
|
labels |
|
|
|
|
measurements |
|
|
|
|
measurements |
||
|
|
labels |
||
|
|
measurements |
|
|
|
|
measurements |
|
The guide_codes and guide_umis arrays of a guide_calls artifact hold one row per cell and one column per called guide: the called guides’ positions among the artifact’s guides, most UMIs first and padded with -1, and their UMIs, padded with 0. artifacts.load_values reads them as tables, while select_cells reads only one-dimensional arrays, as with the vote arrays of label_transfer.
A guide_calls artifact comes from perturbation.import_guide_calls, which saves Cell Ranger’s calls, or from perturbation.call_guides, which calls guides from the guide counts; the artifact’s operation, "import_guide_calls" or "call_guides", names its source. The fitted methods of call_guides also save an assay-scoped guide_thresholds artifact, which the calls record as an input: one fit for each sample and guide, with its status, threshold and parameters, and each guide’s histogram of UMI counts. Its rows are samples and guides, not cells, so select_cells and artifacts.load_values do not read it; perturbation.load_guide_thresholds reads it as a table.
A clones artifact comes from clones.import_clones, which reads the clones that a lineage tracing tool assigned, from clones.from_column, which reads them from a cell metadata column, from clones.barcode_clones, which calls them from lineage barcodes, from variants.frequency_clones, which calls them from the allele frequencies of informative variants, from variants.genotype_clones, which calls them from the combinations of mutations that genotype calls show, by likelihood or by exact agreement, from clones.allele_clones, which calls them from rare recorder alleles, or from clones.phylogeny_clones, which cuts them from a cell phylogeny; the artifact’s operation, "import_clones", "import_clones_from_column", "call_barcode_clones", "call_frequency_clones", "call_genotype_clones", "call_allele_clones" or "cut_phylogeny_clones", names its source. Clones that CyteArc calls, from barcodes, allele frequencies, genotypes or alleles, are labeled clone_1 and on by size over every within group, ties by their first cell; imported and cut clones keep the labels of their sources. Its canonical values hold each cell’s clone label, empty for a cell without one. codes gives each cell’s clone as its position among the clones, which are ordered by size, largest first, then by label, -1 for none, and clone_size the cells of each cell’s clone, 0 for none. clone_probability, each cell’s probability of its clone, is stored only when the source gives one, such as Numbat’s posteriors or the likelihood of genotype clones. clone_ids and clone_sizes hold one row per clone rather than per cell, so neither select_cells nor artifacts.load_values reads them; clones.load_clones turns them into the clones table of a Clones record. Every source’s clones save the clone writer’s diagnostics, and imported ones the join’s, which count the files’ barcodes; an imported artifact’s n_clones attribute counts the clones, and its fileRows, rowsPerFile and cellsInSeveralClones diagnostics the files’ rows, those of each file and the cells that multiple="drop" left without a clone. Barcode clones label the cells of their lineage_barcodes input: n_barcodes holds each cell’s barcodes after the pair filters and doublet whether TREX’s rule removed the cell, their library_units attribute holds each library’s count unit, and their diagnostics add the numbers that show when correction merges unrelated barcodes and what each rule removed, which clones.load_clones returns as the record’s diagnostics. Genotype clones label the cells of their variant_genotypes input: ambiguous marks the cells left out, by the likelihood because no clone reached min_posterior and by the exact rule because their calls agree with two clones that disagree, clone_probability holds the likelihood’s posterior of each cell’s clone, and their diagnostics count the sites (sites), the cells with a mutant call (mutantCells), the ambiguous cells (ambiguousCells), the cells of clones below min_size (cellsInSmallClones), and the searches that stopped splitting at the most clones a fit holds (cappedSearches) with their cells (cellsInCappedSearches), and record the pooled dropoutProbability and errorProbability that the fit used, None under the exact rule. The likelihood also saves site_labels and each group’s dropout_probability and error_probability at each site. Allele clones label the cells of their lineage_alleles input: n_alleles holds each cell’s distinct rare alleles, their diagnostics what each rule removed, and their bank_coverage attribute, for each character with a bank, its alleles, the cells and alleles that hold them, and how many of each the bank lists. Phylogeny clones label the cells of their cell_phylogeny input, and their cellsBeforeCut diagnostic counts the cells whose leaves end before the cut.
A cell_phylogeny artifact holds one row per node rather than per cell, so artifacts.load_values refuses it, and clones.load_phylogeny reads it.
A clonal_expansion artifact comes from clones.expansion, which records a clones or clonotypes artifact as its clones input and labels the cells of its own cell_selection input, the selection given or the clones’ cells, with their expansion category, empty for a cell without a clone or a group. group_codes gives each cell’s group, -1 for none, as a position among the n_groups attribute’s groups, whose labels the group_labels array holds group by group, one for each column of the key_columns attribute, so opening the artifact reads none of them; without key columns the one group has no labels and no array. The labels attribute names the categories, smallest clones first. clones.load_expansion turns them into the tables of a ClonalExpansion record.
A clone_fate_bias artifact comes from clones.fate_bias, which records a clones artifact and a late cell selection as inputs and labels the early cells of its own cell_selection input with their dominant fate, empty for none. codes gives each early cell’s clone, -1 for none, fate_codes its dominant fate as a position in the group_keys attribute, -1 for none, n_late_cells its clone’s late cells, and fractions, one row per cell and one column per fate, the share of those cells in each fate, NaN without late cells. Its diagnostics count the late cells that the fates leave out, the groups, the early cells whose clone has no late cell or whose late cells tie between fates, and the clones tested. clone_codes, clone_early_cells, clone_fate_cells, clone_p_values and clone_q_values hold one row per clone with late cells, and fate_cells one row per fate, so neither select_cells nor artifacts.load_values reads them; clones.load_fate_bias turns them into the tables of a CloneFateBias record.
An immune_receptors artifact comes from repertoire.import_receptors, which reads the receptor contigs of a cell selection from Cell Ranger’s contig annotations or AIRR Rearrangement files. Its canonical values hold each cell’s receptor type. Its chain_slots array holds one row per cell and four columns, the positions of the cell’s VJ_1, VJ_2, VDJ_1 and VDJ_2 chains among the contigs, padded with -1, and its other arrays hold one row per contig rather than per cell, so neither select_cells nor artifacts.load_values reads them: contig_cells gives each contig’s cell, contig_sources its file, contig_chain whether it counts as a chain, and contig_<field> each field, with the distinct values of a text field in contig_<field>_values and contig_<field>_offsets. repertoire.load_receptors turns them into the tables of an ImmuneReceptors record. The artifact’s fields attribute lists the stored fields; its diagnostics hold the join’s counts of the barcodes, fileContigs, contigsPerFile and unmatchedContigs, the files’ contigs, those of each file and those that match no selected cell, and cellsWithChain.
A clonotypes artifact comes from repertoire.clonotypes, which records an immune_receptors artifact as an input and labels the same cells with their clonotype, empty for a cell without one; its metric and max_distance parameters say whether identical junctions or junctions within a distance linked the cells, and clonotype clusters have the same arrays. codes gives each cell’s clonotype as its position among the clonotypes, largest first, -1 for none, and clone_size the cells of each cell’s clonotype, 0 for none. Its arrays clonotype_ids, clonotype_sizes, representatives, n_configurations and clonotype_within hold one row per clonotype rather than per cell, so neither select_cells nor artifacts.load_values reads them; repertoire.load_clonotypes turns them into the clonotypes table of a Clonotypes record. The n_clonotypes attribute counts the clonotypes, and the diagnostics hold cellsWithClone and largestCloneShare, as every source’s clones do. With within columns, the array within_labels holds each combination’s label in each column, row by row in the order of the columns, and clonotype_within numbers the combinations in the natural order of their labels; opening the artifact reads none of them. Clonotypes defined across receptor types also store codes_within_type, each cell’s clonotype within its receptor type as within_receptor_type=True numbers them, -1 for none, and representatives_within_type, the representative cell of each of those, as within_receptor_type=True chooses it, which figures name it by. The clone summaries of ds.clones read the artifact as they read clones, with each cell’s receptor type, the canonical values of its receptors, as a key column of their groups, and read clonotypes across receptor types by codes_within_type.
A lineage_alleles artifact comes from clones.import_alleles, which reads the alleles of a lineage recorder’s target arrays for a cell selection from the files of recorder pipelines. Its canonical n_edits holds each cell’s sites with a mark or an unknown mark, n_integrations its integrations with a site read and n_records its records. Its other arrays hold one row per record, a site of an integration of one allele row of a cell, ordered by cell, file and the row’s line, so neither select_cells nor artifacts.load_values reads them: record_cells gives each record’s cell, record_sources its file as a position in the files attribute, record_integration, record_site and record_allele its integration, site and allele as codes among their sorted distinct values in record_integration_values, record_site_values and record_allele_values with their _offsets, -1 for the allele of a state other than a mark or an unknown mark, record_state its state as an int8 position in the states attribute, unedited, mark, unknown_mark, missing and not_applicable, record_umis and record_reads its allele row’s UMIs and reads, -1 where unknown, and record_row the row’s line in its file. clones.load_alleles turns them into the tables of a LineageAlleles record. The files attribute names each file’s format, tool, the pipeline whose notation its alleles follow, the kind of its sites, its one integration where it holds one, whether its rows_hold_sites, the lengths of shorter ordered integrations, and its rows and records; its diagnostics hold the join’s counts of the cell barcodes, fileRows, rowsPerFile and unmatchedRows, the rows read, those of each file and those whose cell barcode matches no selected cell, slotsBeyondLength, the slots beyond a contracted integration that hold an insertion, and rowsWithoutIntegration, the rows that name no integration.
A lineage_barcodes artifact comes from clones.import_barcodes, which reads the expressed lineage barcodes of a cell selection from the files of extraction tools or from an assay’s counts. Its canonical n_barcodes holds each cell’s distinct barcodes, n_umis and n_reads its UMIs and reads, -1 where a library of the cell counts none, and n_records its records. Its other arrays hold one row per record, a molecule or a pair of a cell and a barcode, ordered by cell, library, barcode and UMI, so neither select_cells nor artifacts.load_values reads them: record_cells gives each record’s cell, record_sources its library as a position in the libraries attribute, record_barcode and record_umi its barcode and UMI as codes among their sorted distinct values in record_barcode_values and record_umi_values with their _offsets, -1 for a pair’s UMI, and record_umis and record_reads its UMIs, 1 for a molecule, and reads, -1 where unknown. clones.load_barcodes turns them into the tables of a LineageBarcodes record. The libraries attribute names each library with its level, "molecules" or "pairs", its records, and whether they count UMIs and reads; its diagnostics hold the join’s counts of the cell barcodes and fileRows, rowsPerFile, unmatchedRows and emptyRows, the rows read, one for each item of a list field and for each nonzero count of a merged table or a matrix, those of each file, empty for an assay’s counts, those whose cell barcode matches no selected cell and those that hold no barcode.
A variant_counts artifact comes from variants.import_counts, which reads each cell’s counts of each allele at variant sites from the files of mitochondrial and targeted genotyping tools. Its canonical mean_depth holds each cell’s depth summed over the sites and divided by their number, NaN for a cell that no file names; n_covered_sites counts the sites with depth above 0, and listed marks the cells a file names. Its other arrays hold one row per site, allele or entry rather than per cell, so neither select_cells nor artifacts.load_values reads them; variants.load_counts turns them into the tables of a VariantCounts record.
Sites:
site_contigs(int32, the contig’s position in thecontigsattribute, -1 for a named site),site_positions(int64, 1-based, -1 for a named site),site_namesandsite_channels(text; a named site has no coordinates, and its channel keeps apart the evidence channels of one target, such as GoT-Multi’s), andsite_depthandsite_cells(int64, the depth summed over all cells and the cells covered). Sites with coordinates come first, by contig name in natural order and position, then named sites by name and channel.Alleles:
allele_sites(int32, ascending),alleles(text: a base, a sequence, a gapfill or a call class such as"WT", in text order within a site) andallele_roles("reference","alternative"or"other").Depth:
depth_sites(int32) anddepth(uint32), one row per cell and site with depth above 0; the rows of the cell at positioniaredepth_offsets[i]todepth_offsets[i + 1], sorted by site. A cell and site without a row was not covered there, so an allele frequency is undefined rather than 0.Counts:
count_alleles(int32) andcounts(uint32), one row per cell and allele with a count above 0, betweencount_offsets[i]andcount_offsets[i + 1]and sorted by allele, and where the source has themcounts_forwardandcounts_reverse(uint32),counts_quality_forwardandcounts_quality_reverse(float32, NaN where the strand count is 0),counts_reads(uint32) andcounts_support(float32). A stored depth counts every stored allele of its site, and an allele that a source does not count, such as MiTo’s reference base, adds to the depth only. Tapestri’s alternatives of one position may share reads, as its allele frequencies of one position may add up to more than 100%, so their depth bounds each count rather than their sum.Calls:
call_alleles(int32),call_sourcesandcall_values(int32 codes of the text incall_source_namesandcall_value_names, both sorted), andcall_quality(float32, the call’s quality, NaN for a call without one) only where the source gives qualities, as Tapestri’s and DAb-seq’s genotype qualityGQ, betweencall_offsets[i]andcall_offsets[i + 1], sorted by allele and source.
Clones that variants.frequency_clones calls hold the same arrays as other clones. Their inputs are the variant_selection artifact, as informative, and the cells of its counts. Their diagnostics count the informative variants, the cellsScored that the statistics covered, cellsWithClone, those given a clone, cellsWithoutCoverage, cellsWithoutAlternative and cellsWithoutNeighbors, the cells left without one and why, and the edges, the joins of the shared-neighbor graphs.
A variant_selection artifact comes from variants.informative, which scores every variant that a chosen cell shows. It is datastore-scoped and not cell-aligned, so neither select_cells nor artifacts.load_values reads it; variants.load_informative turns it into the table of a VariantSelection record. Its arrays hold one row per variant, in the counts’ order of sites and alleles: variant_alleles (int32, the variant’s position among the counts’ alleles), informative and masked (bool), n_cells_covered, n_cells_over_5, n_cells_over_10, n_cells_over_20 and n_cells_over_95 (int64), mean, variance, vmr, max_heteroplasmy and mean_coverage (float64), n_cells_conf_detected (int64) and strand_correlation (float64) for counts with strands, and mean_quality (float64) for counts with base qualities. Its diagnostics count the cells scored (cells) and the variants (variants, informativeVariants, maskedVariants), and its attributes record whether the counts held strands and qualities (stranded, qualities); the preset, each threshold as applied and the masks are its provenance parameters. Its inputs are the counts and the cell_selection given, or None.
A variant_genotypes artifact comes from variants.genotypes, which calls each cell’s genotype at targeted sites. It is datastore-scoped and cell-aligned over the counts’ cells: its canonical n_mutant_sites (int32) counts each cell’s sites called heterozygous, homozygous alternative or alternative present, and n_called_sites (int32) those and the sites called wild type, which select_cells and artifacts.load_values read; variants.load_genotypes turns the other arrays into the tables of a VariantGenotypes record. The calls form a long table sorted by cell, whose rows call_offsets (int64, one more than the cells) delimit: call_sites (int32, the site’s position among the genotyped sites), calls (int8, the call’s position in cytearc.variants.CALLS), call_labels (int32, the source’s label’s position among call_label_names), call_reference and call_alternative (int32, the UMIs of the two alleles, -1 for adopted calls), and posterior_wild_type, posterior_heterozygous and posterior_homozygous_alternative (float32, NaN unless the method is "gift"). One row per genotyped site holds genotype_sites (int32, the site’s position among the counts’ sites), and the text arrays site_labels, site_reference, site_alternative and site_sources; with "source", a site with coordinates is genotyped once per alternative that holds calls, so its position repeats, each row labeled by the site and its alleles, such as chr1:115256513:G/A, which is Tapestri’s name of the variant unless its reference was extended, with the site’s reference and the alternative. Its attributes record the sites genotyped (n_sites) and the counts’ count_unit, and its diagnostics the rows of each call (wildTypeCalls to filteredCalls) and alternativesNotShown; the method and its rules as applied, among them "source"’s min_quality and min_depth, are its provenance parameters. Its inputs are the counts and their cell selection.
The long arrays are chunked in row bands of at most 1,048,576 rows, and a shorter array is one chunk of about its own size, so a reader takes a band of cells at a time from the offsets and decompresses little beyond its rows. Its attributes are format, count_unit ("reads", "umis" or "molecules"), depth_definition ("all" or "reference_and_alternative"), stranded, count_fields, call_fields (["quality"] where the source gives the calls’ quality, else empty), contigs (each contig’s name, length and the SHA-256 of its uppercased sequence, None where the files do not give them), and the counts n_sites and n_alleles; its diagnostics hold the join’s counts of the files’ barcodes, listedCells, sortedRuns, repeatedCalls (calls that a source repeated, kept once), and the variants that Tapestri and DAb-seq sources skip.
A perturbation_labels artifact comes from perturbation.labels, which records a guide_calls artifact as an input and labels the same cells by the genes that their called guides target. Its target_codes array holds one row per cell and one column per gene: the positions of the cell’s genes among the artifact’s targets, in ascending order and padded with -1, with control targets left out. artifacts.load_values reads target_codes as a table, while select_cells reads only the one-dimensional arrays: values, guide_label, is_control and n_targets. The artifact’s other arrays hold one row per target or per guide rather than per cell, so neither reader reads them: targets names the distinct targets, sorted and controls included, target_is_control marks the control targets, and guide_target_codes gives each guide’s position in targets, -1 for a guide without a target. perturbation.load_labels turns them into the targets and guides tables of a PerturbationLabels record.
A perturbation_efficiency artifact comes from perturbation.efficiency, which records a perturbation_labels artifact as an input and compares each target gene’s expression in the cells of its perturbation with the control cells of the labels. The artifact belongs to the expression assay that the comparison reads, not to the guide assay of the labels. Its rows are target genes or guides, not cells, so select_cells and artifacts.load_values do not read it; perturbation.load_efficiency reads it as a table of each row’s matched feature, status, cells, mean UMIs and scaled expression in each group, remaining fraction, log2 fold change and p-values.
A perturbation_edistance artifact comes from perturbation.edistance, which records a perturbation_labels artifact and a coordinate artifact, such as a PCA, as inputs and measures how far the cells of each perturbation sit from the control cells of the labels in those coordinates. The artifact belongs to the assay of the coordinates. Its rows are target genes or guides, not cells, so select_cells and artifacts.load_values do not read it; perturbation.load_edistance reads it as a table of each row’s status, cells, E-distance and p-values.
A perturbation_signature artifact comes from perturbation.signature, which records a perturbation_labels artifact, a coordinate artifact and a feature selection as inputs, and holds the perturbation signature of every cell of the coordinates: its values array has one row per cell and one column per feature, neighbors gives each cell’s nearest control cells as positions among the artifact’s cells, nearest first, and is_control and samples describe each cell. The artifact belongs to the assay of the features and records the coordinates’ cell selection, but it is not cell-aligned: select_cells and artifacts.load_values do not read it, and perturbation.load_signature reads it as tables indexed by cell ID.
A mixscape_classes artifact comes from perturbation.mixscape, which records a perturbation_signature artifact as an input and holds one Mixscape class per cell of the signature, so select_cells(classes, include=["GENE1 KO"]) selects the knocked-out cells of a target and plots color cells by class. Its per-cell arrays are values, the class, global_class, posterior and score, which are NaN for cells outside a fitted target. Its other arrays hold one row per target and split rather than per cell, with each fit’s status, cells, DE genes and mixture, and the DE genes of each row as offsets into de_features; perturbation.load_mixscape reads them as tables.
A perturbation_associations artifact comes from perturbation.associations, which records a perturbation_labels artifact and, for trans pairs, a feature selection as inputs, and holds one row per pair of a target and a feature: the discovery pairs, the negative-control pairs of the calibration check and the positive-control pairs, each with its cells, QC counts, statistic, p-values, fold change and the skew-normal fit that gave its p-value. Each pair names its group of treatment cells, a tested target or guide or a calibration group, and the artifact stores the target and guides of each group once. The artifact belongs to the expression assay that the tests read. Its rows are pairs, not cells, so select_cells and artifacts.load_values do not read it; perturbation.load_associations reads it as one table per set of pairs, with the calibration check’s false discoveries and grade.
A perturbation_profiles artifact comes from perturbation.profiles, which records a perturbation_labels or mixscape_classes artifact and a feature selection as inputs, and holds one row per profiled target or guide rather than per cell: its mean z-normalized expression in each feature, float32, with its name, target, control flag, cells and masked feature, and the perturbations left out with their cells. It also holds each sample’s control cells and the control mean and standard deviation of each feature, and the number of samples in which each feature’s control cells hold one value. The artifact belongs to the expression assay of the feature selection. Its rows are perturbations, not cells, so select_cells and artifacts.load_values do not read it; perturbation.load_profiles reads it as tables.
A perturbation_clusters artifact comes from perturbation.cluster, which records a perturbation_profiles artifact as an input, and holds one row per clustered perturbation: its name, its HDBSCAN cluster (-1 when unassigned) and strength of membership, its position in the leaf order of average linkage, and its place in a two-dimensional layout. It belongs to the assay of the profiles and is not cell-aligned; perturbation.load_clusters reads it with the distances between the clustered profiles, computed again from the profiles.
A metadata snapshot is cell-aligned when it records a cell selection, as the custom source and sink
vector of pseudotime scoring does. The metadata snapshot of a pipeline run records none: it holds
whole metadata columns, one row for each row of the cell or feature table, and is valid but not
cell-aligned. artifacts.load_values, plot groupings and colors, and the other readers refuse it with a
ValueError that says its rows are not aligned to a recorded cell selection and points to the
run’s frozen fields, such as run.cells.fetch(column). Only a snapshot whose recorded cell
selection is malformed raises ArtifactResolutionError with code corrupt_payload.
The canonical array of each kind is part of the identity of the results that read it. Consumers
such as select_cells record the artifact that they read but not that they read its canonical
array, so changing a kind’s canonical array in this table would change what they compute from the
same recorded inputs. Such a change needs an operation revision for each consumer
(Operation revisions). select_cells(value=...) reads another
per-cell array of the table and records its name, so a selection of the canonical array keeps its
identity.
cell_selection= reads the cells of a selection that the artifact’s own selection contains; any
other selection raises ValueError. Values come back in cell table order. A row that the artifact
records as missing keeps its stored placeholder and is flagged in missing. to_pandas() returns
the values indexed by cell id, as a Series, or as a DataFrame with a column for each position of a
row, and shows missing rows as missing. Before it reads anything, the read is charged against the
datastore memory budget, and it raises MemoryError when it does not fit: the values and their
missing mask, the cell ids, and the int64 cell rows and positions that it builds, each read chunk
by chunk.
The cell ids are text at 4 bytes a character, so they often take most of that budget: 18 characters take 72 bytes a cell, where two float32 coordinates take 8. A caller that needs only the values, such as one that draws an embedding or colors cells by their labels, passes cell_ids=False, which leaves the ids out of the read and of its budget. The result holds the values, missing and cell_idx (each cell’s row of the cell table) of a read with ids, cell_ids is None, and to_pandas() raises ValueError, since it indexes the values by cell id. A refusal of a read with ids names cell_ids=False beside cell_selection.
phase = ds.artifacts.load_values(cell_cycle_ref) # canonical "phase" labels
s_score = ds.artifacts.load_values(cell_cycle_ref, value="s_score")
phase.to_pandas() # Series indexed by cell id
coordinates = ds.artifacts.load_values(umap_ref).to_pandas() # one column per dimension
xy = ds.artifacts.load_values(umap_ref, cell_ids=False).values # no cell ids read
subset = ds.artifacts.load_values(clusters_ref, cell_selection=t_cells)
donors = ds.artifacts.load_values(CellField("donor"), cell_selection=t_cells)
A CellField names a cell metadata column instead of an artifact. artifacts.load_values(CellField("donor"), cell_selection=t_cells) reads the column at the cells of the selection, with the rows that its linked missing mask flags in missing, as compare.compute_bulk and the plots read a grouping column over cells, so a caller reads any grouping over any frozen selection through one call. A column has no cells of its own, so cell_selection is required and may be any cell selection of the store; value must stay None. CellField(..., kind="continuous") reads measurements, and the other kinds read labels, as categorical records. The read is charged against the datastore memory budget as an artifact’s is, and the store’s cell table must hold the column, or KeyError is raised.
select_cells, artifact groupings and colors in plots, and pseudotime source and sink labels read
the same canonical arrays, select_cells another one when value= names it, and every reader
refuses a kind that the table does not list, whichever array it is asked for. For example,
ds.select_cells(doublet_ref, value="predicted_doublets", include=[False]) keeps the cells that
doublet detection did not call doublets. Label consumers, such as snapshot_cluster_labels, compare.compute_bulk, and
clusters.relabel_by_overlap, accept the kinds whose canonical array holds labels.
- cytearc.metadata.selection.CELL_VALUE_NAMES#
The per-cell arrays of every cell-aligned artifact kind, a read-only mapping from each kind to its
CellValueSpec: the canonical array, whether it holds labels, and the kind’s other per-cell arrays. A kind is cell-aligned exactly when it is listed, and readers refuse every other kind, whatever array they are asked for. Reductions and Harmony corrections hold a row per cell too, but their cells follow the cell selection of their lineage rather than acell_selectioninput, so they are not listed.The canonical array names are part of the identity of the results that read them:
select_cells, plot groupings, and other consumers record the artifact that they read but not that they read its canonical array;select_cellsnames only another array thatvalueselects. Changing a kind’s canonical array therefore changes what those consumers compute from the same recorded inputs, and needs an operation revision for each of them.
DataStore summary#
summary() scans literal live I cell and feature columns in blocks and omits store locations and
credentials. It reports artifact inventories, pipeline-run counts by status, and completed labeled
runs. It never selects a pipeline run. Each assay’s assay_type is the type that the open resolved,
Assay.assayType (Assay types), so a read-only open, which cannot record a type,
reports the type of a preset-named assay that the store’s assayTypes record lacks.
Use summary.to_dict() for a deterministic JSON-safe record.
Return a read-only, metadata-only summary of this datastore. |
|
List every artifact ref matching the exact provenance predicates. |
|
|
Inspect a logical artifact without mutating the store. |
Open a complete artifact through a read-only Zarr group. |
|
|
Read the per-cell values of a cell-aligned artifact or a cell column. |
|
Build a read-only upstream lineage report for artifact outputs. |
|
List, or remove, what interrupted and killed artifact writes left behind. |
Validate and return one exact feature-selection reference. |
- DataStore.summary()#
Return a read-only, metadata-only summary of this datastore.
- Return type:
- ArtifactAccessor.list(*, kind=None, from_assay=None, scope='assay', complete_only=False, operation=None, parameters=None, inputs=None)#
List every artifact ref matching the exact provenance predicates.
- Return type:
- ArtifactAccessor.inspect(ref)#
Inspect a logical artifact without mutating the store.
- Return type:
- Returns:
Its status, whose
existsandcompletesay whether the store holds it and whether its write finished.- Raises:
TypeError – If
refis not an ArtifactRef.
- ArtifactAccessor.load(ref)#
Open a complete artifact through a read-only Zarr group.
- Raises:
TypeError – If
refis not an ArtifactRef.KeyError – If the store holds no such artifact.
RuntimeError – If the artifact is incomplete, as a call that stopped before it finished leaves it.
- Return type:
Group
- ArtifactAccessor.load_values(ref, *, value=None, cell_selection=None, cell_ids=True)#
Read the per-cell values of a cell-aligned artifact or a cell column.
A
CellFieldnames a cell metadata column, which is read over the cells ofcell_selectionwith its linked missing mask, ascompare.compute_bulkand the plots read a grouping column. A column ofkind="continuous"holds measurements, and any other kind holds labels.A caller that needs only the values, such as one that draws an embedding or colors cells by their labels, passes
cell_ids=False: the cells’ ids, text that often outweighs the values, are left out of the read and of its memory budget, andcell_idxstill names each cell’s row of the cell table.- Parameters:
ref (
ArtifactRef|CellField) – A cell-aligned artifact, such as a clustering or an embedding, or aCellFieldthat names a cell column.value (
str|None) – Name of the per-cell array of an artifact to read, or None for the canonical one. ACellFieldtakes None.cell_selection (
ArtifactRef|None) – A subset of the artifact’s cell selection, or None for all of its cells. ACellFieldneeds one: the cells whose values are read.cell_ids (
bool) – Read the cells’idswith the values, the default. False leaves them out of the read and of its memory budget, andCellValues.cell_idsis None.
- Return type:
- Returns:
The values with their missing mask, and with their cell ids unless
cell_idsis False, asCellValues.- Raises:
TypeError – If an argument has the wrong type.
KeyError – If the store holds no cell column that a
CellFieldnames.ValueError – If
refis not of a cell-aligned kind,valuenames no per-cell array of its kind, the store holds no such artifact or it is incomplete, as a call that stopped before it finished leaves it, orcell_selectionis not within its cells; or ifrefis aCellFieldandvalueis given orcell_selectionis not.ArtifactResolutionError – If
cell_selectionis not a cell selection of this store.MemoryError – If the read does not fit the datastore memory budget.
- ArtifactAccessor.lineage(target, *, references=None)#
Build a read-only upstream lineage report for artifact outputs.
targetis one ref or a mapping of names to refs, such as a pipeline run. A tuple of refs, such as a run’sleidencandidates, names each ref by its position:leiden[0],leiden[1].- Return type:
- ArtifactAccessor.prune_incomplete(*, dry_run=True)#
List, or remove, what interrupted and killed artifact writes left behind.
An interrupted write (Ctrl-C, a cancelled task) keeps its artifact, marked incomplete, because Zarr may still be running the write. A killed process (SIGKILL, the out-of-memory killer, a kernel restart) leaves its incomplete artifact too, and a write that lands after its group was removed leaves chunks without a group. Nothing reuses this residue, but it takes space. This lists the incomplete artifact groups and the directories of chunks without a group below the datastore’s artifacts and those of every assay; with
dry_run=Falseit removes them. Complete artifacts are never removed, nor anything that CyteArc did not write. A mounted store is pruned of its own artifacts only.An artifact that another process is writing is incomplete until it finishes. Pass
dry_run=Falseonly after confirming that no process is writing to this store.- Parameters:
dry_run (
bool) – List the residue without removing it, the default.- Return type:
list[str]- Returns:
The paths below the datastore that were found, or removed, sorted.
- Raises:
TypeError – If
dry_runis not a bool.PermissionError – If
dry_runis False and the store was opened withzarr_mode='r'.
- FeaturesAccessor.resolve(assay, features)#
Validate and return one exact feature-selection reference.
- Return type:
Module-level helpers#
These functions accept a Zarr root group and are useful in tooling. Analysis notebooks should use
the datastore methods above. The functions inspect exactly the group they are given: the zw
group of a mounted datastore also resolves its source’s artifacts, while a target group opened
directly with zarr.open_group holds only the target’s own.
- cytearc.storage.list_artifacts(root, *, scope, assay=None, kind=None, complete_only=False, operation=None, parameters=None, inputs=None)#
- Return type:
list[ArtifactRef]
- cytearc.storage.inspect_artifact(root, ref)#
- Return type: