Read causality-network dynamics from Parquet via DuckDB#434
Open
jussty wants to merge 3 commits into
Open
Conversation
convert_dynamics() was a NotImplementedError stub (TODO to port off the old in-database emitter). Read the required listener columns from the Parquet history via DuckDB (dataset_sql / field_metadata / ndlist_to_ndarray), build the timeseries the node readers expect, and keep the existing reshaping + seriesOut.zip writer. Generalize buildCausalityNetwork.py to the vEcoli output layout via --sim_data_path / --out_dir / --id / --seriesout instead of hardcoded wcEcoli-era paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add --max_timepoints to buildCausalityNetwork.py (and a max_timepoints arg to convert_dynamics) to evenly downsample the dynamics read. Some listeners are 2-D per timestep (e.g. TF binding is cistrons x TFs), so full-resolution arrays for a multi-thousand-step simulation can be large; downsampling keeps memory bounded on constrained machines. Separable from the core port and safe to drop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A Causality network is per-cell, but convert_dynamics read the whole experiment's history (fine for a single-cell run, wrong for multi-cell / multi-generation runs where the time-ordered read interleaves cells). Add --variant / --lineage_seed / --generation / --agent_id filters (default: the founder cell) applied to the history and configuration queries. Separable follow-up to the port. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
ecoli/analysis/causality_network/read_dynamics.py::convert_dynamics()was a stub:so
buildCausalityNetwork.pycould not produce aseriesOut.zipfrom current vEcoli (Parquet) output. This ports the dynamics reader to the Parquet/DuckDB backend.Split into two commits so the second is easy to drop:
--max_timepoints) — separable; safe to leave out if you'd rather always read full resolution.Commit 1 — core port
read_dynamics.pybulkfrom the Parquethistorydataset in one time-ordered pass viadataset_sql(); convert list columns withndlist_to_ndarray(); build the nestedtimeseriesdict the existing node readers expect.config["state"][...]["_properties"]["metadata"]lookups (bulk-molecule ids, unprocessed-RNA ids) withfield_metadata(conn, config_sql, ...).seriesOut.zipwriter unchanged.array_timeseries()and itsget_value_from_pathimport (only used by the removed DB path).buildCausalityNetwork.py--sim_data_path,--out_dir,--id(experiment id),--seriesout— replacing the hardcoded wcEcoli-eraout/kb/simData.cPickle/out/seriesOut.Commit 2 — optional downsampling
--max_timepoints(and amax_timepointsarg toconvert_dynamics) to evenly downsample the dynamics read. Some listeners are 2-D per timestep (e.g. TF binding is cistrons × TFs), so full-resolution arrays for a multi-thousand-step run can be large; this keeps memory bounded on constrained machines. Kept as a separate commit so it can be dropped independently.Testing
Ran a single-generation simulation, then:
Produces a valid
seriesOut.zip(nodes.json,edges.json,series.json+ per-nodeseries/*.json).Notes
CovertLab/causality) is a separate repo.max_timepointsvia config or wire this intorunscripts/analysis.pyif you'd prefer.