Part of #20. Depends on #21.
Constraints
- A
CistopicObject is a Python pickle of pycisTopic.cistopic_class.CistopicObject. Unpickling needs pycistopic installed (and its scipy/pandas stack) and executes arbitrary code from the file.
- Put it behind an optional extra (
pyadata-cli[pycistopic]), import lazily with a clear error when missing, require an explicit --from pycistopic, and document the security caveat.
- Alternative to evaluate: run the unpickling in a subprocess via
uv run --with pycisTopic so the core install stays clean and heavy deps never land in the main environment.
Mapping
| CistopicObject |
AnnData |
fragment_matrix (scipy sparse, regions × cells) |
X as cells × regions CSR |
binary_matrix |
layers["binary"] |
cell_names, cell_data |
obs_names, obs |
region_names, region_data |
var_names, var |
selected_model.cell_topic |
obsm["X_topic"] |
selected_model.topic_region |
varm["topic_region"] |
selected_model metrics / parameters |
uns["pycistopic"]["model"] |
projections |
obsm["X_<name>"] |
project, path_to_fragments |
uns["pycistopic"] |
Plan
Unpickle → write through the elements.write helpers. This path is necessarily in memory (the pickle is); document that clearly.
Tests
Fixture pickled in a uv run --with pycisTopic subprocess under the integration marker; check shapes, names and topic matrices.
Part of #20. Depends on #21.
Constraints
CistopicObjectis a Python pickle ofpycisTopic.cistopic_class.CistopicObject. Unpickling needs pycistopic installed (and its scipy/pandas stack) and executes arbitrary code from the file.pyadata-cli[pycistopic]), import lazily with a clear error when missing, require an explicit--from pycistopic, and document the security caveat.uv run --with pycisTopicso the core install stays clean and heavy deps never land in the main environment.Mapping
fragment_matrix(scipy sparse, regions × cells)Xas cells × regions CSRbinary_matrixlayers["binary"]cell_names,cell_dataobs_names,obsregion_names,region_datavar_names,varselected_model.cell_topicobsm["X_topic"]selected_model.topic_regionvarm["topic_region"]selected_modelmetrics / parametersuns["pycistopic"]["model"]projectionsobsm["X_<name>"]project,path_to_fragmentsuns["pycistopic"]Plan
Unpickle → write through the
elements.writehelpers. This path is necessarily in memory (the pickle is); document that clearly.Tests
Fixture pickled in a
uv run --with pycisTopicsubprocess under theintegrationmarker; check shapes, names and topic matrices.