Skip to content

1.5.0

Latest

Choose a tag to compare

@parashardhapola parashardhapola released this 29 Nov 18:55
3dd2c1b

CyteArc 1.5.0 shuffles the cells of every import so that any block of rows is a random sample, writes exports in the imported file's order, and records which features each source of a merge measured. It adds pausing and resuming of pipeline runs, ATAC doublet scoring, a search for the initial and terminal states of a fate map, and a per-run choice of normalizer. Pipeline runs, imports, merges and metadata refuse more malformed input before they write anything. The memory budget is now an approximate planning budget, and the tutorials describe computed values in words instead of quoting them. This release merges 134 pull requests.

Read the breaking changes before upgrading. Code that passes arrays to ds.cells.insert needs a pandas Series keyed by cell ID, a file imported again gets a new cell order, and several results that 1.4.0 saved are computed again on their next call.

The example stores that the tutorials open were rebuilt with this release, and every tutorial page was executed again on Linux against them.

Compatibility with 1.4.0

  • Stores that 1.4.0 wrote open in 1.5.0 unchanged, and 1.5.0 writes nothing when it opens one. A result whose operation changed is computed again on its next call, with a Recomputing log line that names the saved result. Results computed from it follow without a line of their own: a replayed 1.4.0 RNA run logs the line for its HVG stage and then computes its doublet scores and markers again. On a read-only store, such as an hf:// CyteBase dataset, such a call raises PermissionError, and ds.pipeline.plan(run) lists the stages that a replay would compute. To recompute, mount the store with cytearc.mount_datastore(source, at="local.zarr"), which keeps its counts at the source and writes your results locally.
  • Stored data is not migrated. The next section lists what stays as 1.4.0 stored it and how to rebuild it.
  • Stores that 1.5.0 wrote are not supported in 1.4.0, and no 1.4.x patch follows. Section "What 1.4.0 refuses" lists what it refuses.
  • Stores that a development build between the two releases wrote are not supported.
  • A paused run resumes only under the release that paused it.

The test suite now keeps stores that CyteArc 1.4.0 wrote, and checks that 1.5.0 opens, replays, recomputes, exports and merges them as this section describes.

Data that 1.5.0 reads but does not migrate

What 1.4.0 stored How 1.5.0 reads it How to rebuild it
Cells in the file's order, with no sourceRow Reads them as file-ordered and unshuffled, and exports them in stored order, which is the file's order Import the file again. A default import shuffles and gets a new dataset fingerprint; pass shuffle_cells=False for the earlier order. Mounts and composites that recorded the earlier store refuse the new one
Merged columns holding the text "nan" or "NaT", or float dates Stays as stored, also when the store is merged again Merge the original sources again with 1.5.0, which stores NaN and NaT as missing rows and dates at the finest unit
A union merge of sources that measured different features Counts the zero fills as measured, and a 1.5.0 merge of the store records them as measured Merge the original sources again with 1.5.0, which records which features each source measured
A recorded size factor of 1000 on an assay that a session corrected, merged or composed with sf=None Keeps the 1000, also where the source stored another factor Correct, merge or compose the assay again in 1.5.0, or set sf in the session before you do
countSummaries without rowNonzero Counts unsigned values from rowPositive, and merges and exports of signed and float counts read the counts to count them cytearc.tools.repack_zarr.repack_store writes the array and keeps the saved results
H5AD categoricals whose categories read alike, stored as one level each by 1.3.0 and 1.4.0 Reads each as the first of them, so exports, plots and merges work None needed

Breaking changes

Cell order and per-cell values

  • Every import writer shuffles cells by default: H5adToZarr, CrToZarr, MtxToZarr, TapestriToZarr, CSVtoZarr, SparseToZarr and SeuratToZarr take shuffle_cells=True and shuffle_seed=0. Row r of a new store is not row r of its file, and a file imported again gets another dataset fingerprint, another UMAP layout and other Leiden numbers (#388, #389, #391). Each cell keeps its file row in the protected cell column sourceRow. A shuffled H5AD import takes about 1.5 times as long as one in the file's order, which shuffle_cells=False keeps.
  • Merges and composites interleave their sources' cells at random, so a merge built again from the same sources lists its cells in another order (#588).
  • Exports write cells in the imported file's order by default. to_h5ad, to_mtx, DataStore.to_anndata, export_clones, export_characters and export_airr take cell_order="source" and temp_dir, and cell_order="stored" keeps the store's order. Exports of shuffled stores need temporary disk (#390, #404).
  • ds.cells.insert and update_key take per-cell values only as a pandas Series indexed by cell ID, and raise TypeError for arrays, lists and tuples. Other per-cell inputs, such as reduction.import_coordinates and trajectory.fate(direction=), are keyed by cell ID too (#386).
  • SubsetZarr(cell_idx=) is removed with no alias. Pass cell_ids=, which writes the cells in store order (#386).
  • shuffle_cells=False alone no longer writes the store that 1.4.0 wrote: every new store holds countSummaries/rowNonzero, and an H5AD import also needs categorical_columns=False (#406, #533).

Pipeline runs and results computed again

  • Every HVG selection and doublet score that 1.4.0 saved is superseded. A rerun of a 1.4.0 run computes again from the HVG stage, and on a read-only store it fails (#385, #398, #575, #607).
  • The default HVG min_cells grows with the cube root of the selected cells, so default selections of fewer than 1,901 or more than 8,000 cells pick other genes (#385).
  • Runs record the normalizer they used, normalization={"method": ...} chooses it, and Pearson-residual runs no longer scale features in PCA by default. A 1.4.0 run replays with the normalizer of its saved normalized values (#405).
  • Automatic doublet thresholds take the histogram minimum, else Otsu's threshold, only where it implies at most 50% doublets, and call no cell where neither does. A sample can record threshold None (#575, #607).
  • Pseudotime and lineage feature modules use exact neighbors, so module numbers, sizes and members change, and the HNSW ann_params keys (ef, M, ef_construction, random_seed, num_threads and max_elements) have no effect. Passing one gives a FutureWarning, and CyteArc 1.6.0 stops accepting them (#591).
  • Recipe settings that their method refuses are refused before the first stage runs (#464).

Imports, metadata and merges

  • Imports refuse, before writing anything, NaN, blank or missing IDs, text that is not UTF-8, list-valued metadata and several CSV option combinations that 1.4.0 accepted. The error names the row (#409, #410, #412, #413, #415, #453, #604).
  • H5AD categoricals import as categorical columns, and mounts and composites record relative source paths by default (#406).
  • DataStoreMerge takes features, "union" by default. A merge or composite records which features each source measured, and normalization, HVGs, peaks, scores, markers, the ADT panel, mapping and trajectory and perturbation analyses leave unmeasured features out (#527, #551, #578, #608, #622, #629).
  • Labels that would merge or print alike, such as 1, 1.0 and True, are refused in regulon specificity, Harmony, mapping and the label metrics (#441).

Memory budgets

  • mem_budget is an approximate planning budget. CyteArc estimates the arrays that grow with the data, such as count blocks, coordinates, graphs and per-cell IDs and labels, and 128 KiB for each read of stored arrays in flight, plans each step so that they fit, and refuses a step that cannot fit before it reads or writes. Python, Zarr and NumPy hold a little more of their own, so leave some headroom beside the budget.
  • A memory refusal ends with "Raise mem_budget to at least N MiB", a quarter more than the refused step needs, rounded up to a whole MiB, and a rerun of the same call at that budget passes that step. MemoryBudgetError gains suggested_budget_bytes, remedy and setting, the setting that the closing says to raise; needed_bytes still gives the estimate at the refused step. str() of the error adds that closing sentence, also to an error that your own code builds, while args[0] keeps the message without it (#621).
  • Many steps charge more memory than in 1.4.0 and can refuse a budget that ran there: imports, trajectory graph loads, LocalMAP and reads of selected cells (#414, #423, #446, #457, #562, #587, #625, #630).
  • On Modal, with this release's code, every step of the standard workflow on a 1M-cell CELLxGENE sample stayed within its 24 GiB budget, at most 11.7 GiB, and an import of a 10M-cell H5AD file of 40 GB peaked at 12.1 GiB under a 24 GiB budget, measured as the container's memory every 0.1 s (#427).

What 1.4.0 refuses in a store that 1.5.0 wrote

  • A run that paused, resumed or ended from a pause: list_runs skips it with a warning, and opening it by ID raises ValueError (#537, #550).
  • run.settings(), ds.pipeline.rerun and ds.pipeline.plan(run) of any rna, atac, adt or perturbation run, which record normalization.method, and of an ATAC run that records doublets (#405, #543).
  • An HVG selection at revision 3, a clone, receptor, barcode or allele import at revision 2, and a pseudotime aggregation: explicit reads raise, and 1.4.0 never reuses them (#385, #504, #591).
  • Mapping references built on another normalizer than library size or on a PCA without feature scaling (#555), and fate maps whose sinks are states (#556).
  • sourceRow reads as a plain column, and 1.4.0 merges, subsets and mounts drop the record of measured features, after which 1.5.0 refuses the record until you run ds.feats.drop on its columns (#388, #527, #551).
  • Releases before 1.4.0 also refuse tables that hold a categorical column.

New features

Pause, resume and plan

  • Pause a run after a stage with run_until and continue it under the same run ID with ds.pipeline.resume, on any machine that opens the store. List paused runs with ds.pipeline.list_runs(status="paused") and end one that will not resume with ds.pipeline.end_paused (#537, #550).
  • ds.trajectory.plan() reports what each trajectory call in its block would reuse or compute, without computing it (#572).
  • Several processes can analyze one store at once, start runs together on a store without runs and share one local cache folder (#563).

Trajectories and doublets

  • ds.trajectory.states and ds.trajectory.load_states find the initial and terminal states of the walk that a per-cell score directs, and a labeled state search gives ds.trajectory.fate its sinks. A search that stops before its memberships converge warns and records it in its diagnostics (#556, #619, #620).
  • ds.qc.doublets and ds.pipeline.atac(doublets=True) score the doublets of ATAC cells on the graph's LSI (#543).
  • Doublet scoring and mapping references work on the values of every built-in RNA normalizer and on PCAs without feature scaling (#555).

Imports, exports and merges

  • Shuffled imports convert CSC H5AD and Seurat counts in one pass (#387).
  • Merges keep the first store's category order and colors, store NaN and NaT as missing, keep dates at the finest unit, and decode each source chunk once per run of cells (#520, #532, #539, #545).
  • A merge of merged stores records each nested source, such as inner__left (#566).
  • Plots show unmeasured features as missing, and grouped plots follow stored category order (#491, #509, #551).

Tutorials and example stores

  • Tutorials describe computed results in words, such as "the cluster that expresses CD79A", instead of quoting the cluster numbers, counts and scores of one execution, so their text stays true when a page runs again. The code cells still print the values (#647).
  • The seven example stores that tutorials open with a saved analysis were rebuilt with this release, so their saved runs hold current HVG selections and doublet scores and the reuse tutorial reuses the stages it shows (#426, #650): tenx_5K_pbmc_rnaseq, tenx_8K_pbmc_citeseq, kang_15K_pbmc_rnaseq, kang_14K_ifnb-pbmc_rnaseq, bastidas-ponce_4K_pancreas-d15_rnaseq, swanson_7K_pbmc_teaseq and tabula_sapiens_100k.
  • tenx_5K_pbmc_rnaseq holds a cell_type column that names each Leiden cluster from a panel of marker genes, and the PBMC tutorials read it instead of typed cluster numbers (#650).
  • All 40 tutorial pages were executed on Linux against the rebuilt stores. Their code selects clusters, genes and windows by computed names, and asserts the orders and comparisons that the text states, so an execution stops when one no longer holds (#650).

Republishing the example stores breaks four tutorials of 1.4.0: graph_construction, data_organization, reuse_and_tracing and mapping_and_label_transfer. The stores are published under paths without a version, so 1.4.0's pages download the rebuilt stores, and 1.4.0 refuses the HVG diagnostic that they hold. Use the tutorials of this release with the rebuilt stores. A store that you downloaded before the republish needs overwrite=True in Repository.download_dataset to replace it.

Major bug fixes

  • to_mtx wrote wrong numbers for negative integers of signed counts and now writes them correctly, completely or not at all (#419, #533).
  • HVG trend fits that raised Adaptive variance trend fit failed: ABNORMAL restart once and complete (#385).
  • Categoricals whose categories read alike import, export, plot and merge with one level per label (#408).
  • Guide-call imports on a merged store labeled cells "Negative" when their IDs continued with _ after the first __. They now use the store's column of sources or refuse the IDs (#557).
  • A cancelled read on Zarr's event loop ends the run as interrupted, with its artifact kept (#472).
  • Run reports on Modal overstated the memory, threads and CPU time of H5AD imports and regulon inference, which start child processes: Modal's gVisor sandbox lists every thread of a child as a child of its own, and each was counted with its whole process. Each process now counts once (#651).

Performance

  • Trajectory feature modules find exact neighbors 5 to 6.5 times faster at 100,000 and 200,000 profiles (#591, #624).
  • AIRR exports in the file's order keep their temporary rows uncompressed, which brings them to about 1.3 times the time of store order (#407).
  • Merges decode each source chunk once per run of cells (#545).

Documentation

  • The cell order page explains why imports shuffle, sourceRow, and how to keep the file's order (#391, #403).
  • llms.txt, the README and the agent skill describe 1.5.0, and the skill requires cytearc>=1.5.0.

Miscellaneous

  • Zarr's codec_pipeline.path is set to CyteArc's own pipeline the first time CyteArc decodes; zarr.config.reset() restores Zarr's (#518).
  • A store decodes and encodes on at most its nthreads (#477, #518, #536).
  • Writable Hugging Face stores look keys up afresh, list per page with retries, and each store gets its own file system (#486, #517, #604, #640).
  • The test extra requires pytest>=7.3. Runtime dependencies are unchanged, and CyteArc works with pandas 3.1, huggingface_hub 2.1 and later, and threadpoolctl 3.8 (#592, #611).
  • Many pull requests changed tests, CI and internal structure only. See the full changelog.

Full changelog: 1.4.0...1.5.0