Command line
TFOpt installs three commands. tfopt has subcommands for every task; tfopt-local is the fit with the options of
earlier versions; tfopt-app starts the guided GUI. In a clone without installing, use pixi run tfopt … and
pixi run tfopt-local …, or python -m tfopt …, python -m tfopt.local … and python -m tfopt.app ….
Every subcommand calls the library functions of tfopt.api and the other tfopt modules: the
command line, the library and the GUI give identical results.
| Command | What it does | Library |
|---|---|---|
tfopt example FOLDER [--n-starts N] |
Writes the synthetic example project: config.toml, data/input1.csv, data/input3.csv, data/input4.csv (generated from a fixed seed) |
tfopt.examples.write_example |
tfopt validate [--config PATH] [--input1 F --input3 F --input4 F] |
Checks the inputs against the configured time grids (columns, values, duplicates, Psite labels, TFs without a series, targets a run drops, coverage); exit status 1 on an error | tfopt.api.validate_inputs |
tfopt run [--config PATH] [overrides] |
Fits the model and writes the results folder and its run bundle; exit status 1 if the selected fit did not succeed | tfopt.api.load_config, tfopt.api.run |
tfopt bundle RESULTS_DIR [--out DIR] [--zip] [--max-input-mb MB] |
Writes a run bundle from a results folder | tfopt.bundle.make_bundle |
tfopt bundle --check BUNDLE |
Validates a bundle (folder or zip) against the contract and its hashes; exit status 1 if invalid | tfopt.bundle.check_bundle |
tfopt readout RESULTS_DIR [--out DIR] [options] |
Writes every regulatory readout table (edge contributions, TF removal effects, dominance, load, β bound pressure, ...) as CSV | tfopt.analysis.network_readout |
tfopt figures RESULTS_DIR [--out DIR] [--readout-dir DIR] [--formats png svg pdf] |
Draws the readout figures (TF load, dominance, removal effects, signed edges, fit quality) | tfopt.fitanalysis.figures.make_figures |
tfopt network RESULTS_DIR [--out HTML] [--mode contribution\|alpha\|knockout] |
Writes the TF → mRNA network as a self-contained interactive HTML page (needs gravis: pixi run -e viz) |
tfopt.fitanalysis.networks |
tfopt similarity RESULTS_DIR [--out CSV] [--raw-time] |
Writes the discrete Fréchet distance between observed and estimated series per target, and a summary | tfopt.analysis.curve_similarity |
tfopt diagram [--config PATH] [--out DIR] [--psites 0,2] [--format png] |
Draws the model diagram and the constraint diagram with the configured β bounds (needs Graphviz and pydot: pixi run -e viz) |
tfopt.analysis.diagrams |
tfopt app [options] |
Starts the GUI (as tfopt-app) |
tfopt.app |
tfopt --version |
Prints the version | tfopt.__version__ |
The readout subcommands (readout, figures, network) take the inputs the run recorded in run_config.json;
--input1 and --input3 override them. Further options: --early N and --late N (time points of the early and
late windows, default 3), --bound-tol (tolerance of the at-bound flags, default 1e-6) and --renormalize-alpha
(redistribute the remaining α after removing a TF; off by default). None of them refits the model.
tfopt run
Reads a config.toml (the file given with --config; else TFOPT_CONFIG; else, in a clone, the repository's) and
applies the options given on the command line:
| Option | Overrides | Values |
|---|---|---|
--input1, --input3, --input4 |
the input files | paths |
--results-dir |
the results folder | path |
--method |
method |
scipy-slsqp (default) or an approximate JAXopt method: lbfgsb, projected-gradient, non-negative, unconstrained; see Configuration |
--n-starts |
n_starts |
integer |
--jitter-scale |
jitter_scale |
fraction of each bound's span |
--start-seed |
start_seed |
integer (seed of the starting values) |
--seed |
seed |
integer (first seed of the multistart; start i uses seed + i) |
--loss-type |
loss_type |
0 … 6 (see Metrics) |
--lower-bound, --upper-bound |
bounds of β | numbers |
--prediction-transform |
prediction_transform |
clip (default), none, softplus |
--tf-protein-source |
tf_protein_source |
protein_then_mrna (default), mrna, legacy_first_site (control only) |
--ms-alignment |
ms_alignment |
by_time (default), legacy_position (control only) |
--n-jobs |
parallel workers | integer (-1: all cores) |
--no-plots, --no-fit-analysis, --no-report, --no-bundle |
skip the plots, the fit-analysis figures, the report and LaTeX tables, the run bundle |
The time grids (time_points, ms_time_points) have no command-line option and no default: they come from the
configuration, and a configuration without them stops with an error.
The results folder holds the workbook (tfopt_results.xlsx: Alpha Values, Beta Values, Residuals, Observed,
Estimated, Optimization Results, KKT Diagnostics, KKT Multipliers, Prediction Check), multistart_summary.csv,
multistart_params.npz, diagnostics.json, run_config.json (the resolved configuration, seeds, versions, git
commit and input sha256s), the plots, report.html, the logs, and <results folder name>.tfopt.zip (the
run bundle).
tfopt-local
The fit with the options of earlier versions (underscores): --lower_bound, --upper_bound, --loss_type,
--prediction_transform, --method, --copy_to_ode_data_dir, and --config PATH (alias --conf PATH). The other
settings come from that config.toml. It runs tfopt.api.run like tfopt run and raises an error if the selected fit
did not succeed. See the Configuration Reference.
TFOPT_CONFIG=notebooks/data/toy.toml pixi run tfopt-local # the tutorial dataset, in a clone
pixi run tfopt-local --config /path/to/config.toml
python -m tfopt.fitanalysis --conf PATH (task pixi run tfopt-fitanalysis) draws the fit-analysis figures again
from the workbook of an existing results folder.
tfopt-app
| Option | Default | Meaning |
|---|---|---|
--workdir DIR |
./tfopt-app |
Working folder: uploads, runs and their results stay inside it |
--port N |
a free port | Port on 127.0.0.1 |
--max-upload-mb MB |
50 | Largest accepted upload |
--config PATH |
TFOPT_CONFIG, or the clone's config.toml |
Its settings (time grids included, not its paths) pre-fill the configuration |
--no-browser |
Only print the URL |
See The TFOpt app.
From the former scripts
The repository's scripts/ folder and the Streamlit dashboard were removed; their tasks are tfopt subcommands:
| Before | Now |
|---|---|
pixi run tfopt-network-readout --conf C --out-dir D |
tfopt readout RESULTS_DIR --out D |
pixi run tfopt-curve-similarity --conf C --out-dir D |
tfopt similarity RESULTS_DIR --out D/curve_similarity.csv |
pixi run tfopt-network-viz --readout-dir R --out-dir D --formats png svg pdf |
tfopt figures RESULTS_DIR --readout-dir R --out D --formats png svg pdf |
pixi run -e viz tfopt-diagrams --conf C --out-dir D |
tfopt diagram --config C --out D |
pixi run -e viz tfopt-dashboard |
tfopt-app (or tfopt network for the interactive network) |
Development tasks
From the repository root:
pixi run -e dev check-import
pixi run -e dev test
pixi run -e dev test-cov
pixi run -e docs docs-build # renders the tutorials, then builds the site into site/
pixi run -e docs docs-serve
pixi run changelog # docs/CHANGELOG.md from the local Git history (no GitHub API)
Supply the same configuration for analysis as for the optimization. Review generated changelog changes before committing them.
Docker
The Dockerfile uses the Pixi image and the frozen lockfile. Build with docker build -t tfopt . and run the
tutorial dataset with docker run --rm -e TFOPT_CONFIG=notebooks/data/toy.toml tfopt. Mount production data and
configuration explicitly. Behind a TLS-intercepting proxy, pass its CA bundle as a build secret:
docker build --secret id=proxy_ca,src=/etc/ssl/certs/ca-certificates.crt -t tfopt .; the mount is temporary and
certificate verification stays enabled. A container build is validated separately from the native Pixi
environments.