Configuration Reference
TFOpt reads one config.toml per run: the file given with --config (tfopt run, tfopt-local, alias --conf),
else the file named by the environment variable TFOPT_CONFIG, else, in a clone, the repository's config.toml.
Without one, a run stops with an error. tfopt.api.load_config(path, **overrides) reads [paths], [tfopt] and
[tfopt.modes.local] (the mode table overrides [tfopt]) into a RunConfig; library code can also build a
RunConfig directly, without a file. Nothing is read from the configuration at import.
The shipped config.toml points at user-supplied inputs in data/; it does not fall back to the tutorial data.
The tutorials use notebooks/data/toy.toml
(TFOPT_CONFIG=notebooks/data/toy.toml pixi run tfopt-local). No production inputs are bundled.
[paths]
Paths are relative to the folder of config.toml unless absolute.
| Key | Default | Description |
|---|---|---|
data_dir |
data |
Folder with input1, input3 and input4 |
results_dir |
results |
Output folder of a run (workbook, multistart files, plots, report, bundle, logs) |
logs_dir |
results/logs |
Log folder of tools that run outside a fit; a run logs to <results_dir>/logs, so the log belongs to the run and goes into its bundle |
ode_data_dir |
data/ode (results/ode in the shipped file) |
Target of the optional workbook copy (copy_to_ode_data_dir) |
Use a new results_dir for each run: outputs in an existing folder are overwritten.
[tfopt]
| Key | Default | Description |
|---|---|---|
input1 |
input1.csv |
TF protein and phosphosite series: GeneID, Psite (empty for the protein row; S_/T_/Y_ for sites), then one column per MS time point |
input3 |
input3.csv |
mRNA series: GeneID, then one column per RNA time point. The targets, and the mRNA fallback of a TF without a protein row |
input4 |
input4.csv |
Regulation edges: Source (TF), Target (mRNA) |
out_file |
tfopt_results.xlsx |
Results workbook name |
time_points |
required, no default | RNA times (minutes) of input3's columns; these are the fit times |
ms_time_points |
required, no default | MS times (minutes) of input1's columns; their count must equal input1's number of time columns |
ms_alignment |
by_time |
How input1 series are taken at the RNA times: by_time (copied where the MS grid has the time, PCHIP-interpolated over the MS grid otherwise) or legacy_position (the last columns, positionally; control runs only, logged with a warning) |
tf_protein_source |
protein_then_mrna |
The base series $X_i$ of each TF: protein_then_mrna (its input1 protein row, else its input3 mRNA), mrna, or legacy_first_site (its first phosphosite row, the behaviour before T6; control runs only). See TF Base Series |
lower_bound, upper_bound |
-4.0, 4.0 | Bounds of β (α is always between 0 and 1) |
loss_type |
5 | 0 MSE, 1 MAE, 2 soft L1, 3 Cauchy, 4 arctan, 5 elastic net, 6 Tikhonov (see Metrics) |
prediction_transform |
clip |
Transform of the summed prediction, in the objective and in Estimated: clip (max(0, x); its gradient is zero where the prediction is below zero), none (predictions may be negative) or softplus (log(1 + exp(x)), smooth and positive). Recorded in the Optimization Results sheet ("Prediction transform"), diagnostics.json and the run bundle; fit-analysis applies the transform a workbook records (clip for older workbooks) |
start_seed |
0 | Seed of the starting values (α, β) drawn before the multistart; recorded in diagnostics.json |
copy_to_ode_data_dir |
false |
Also copy the results workbook into paths.ode_data_dir; an existing file there is never overwritten |
TFOpt has no built-in time grid: a configuration without time_points and ms_time_points stops with an error that
names the missing keys. The shipped config.toml sets both for its data; set them for yours. No normalization of the
series is applied.
[tfopt.modes.local]
| Key | Default | Description |
|---|---|---|
method |
scipy-slsqp |
Solver (see below) |
n_starts |
64 | Number of multistart starts |
jitter_scale |
0.10 | Jitter of the starting values as a fraction of each bound's span (jitter_frac is accepted as the earlier name; not both) |
seed |
123 | Seed of the multistart draws |
p_random |
0.3 | Probability that a start is drawn uniformly within the bounds instead of jittered |
maxiter |
20000 | Solver iteration cap |
tol |
1e-10 | Solver tolerance (SLSQP ftol) |
feasibility_tol |
1e-8 | Constraint residual up to which a fit counts as feasible |
acceptance_tol |
1e-10 | Constraint residual up to which a start is accepted |
n_jobs |
-1 | Parallel worker processes for the starts (-1: all cores; 1: sequential in this process) |
threads_per_worker |
1 | XLA/OpenMP/BLAS threads per worker |
allow_nonsmooth |
false |
Allow the quasi-Newton methods (lbfgsb, unconstrained) on the nonsmooth losses 1 and 5 |
The defaults above are those of RunConfig and of the shipped config.toml. A config.toml that does not set
method, n_starts, jitter_scale, seed, maxiter, tol or n_jobs gets the values in effect before these
keys existed (tfopt.api.LEGACY_DEFAULTS: lbfgsb, 4 starts, 0.05, seed 0, 1000 iterations, tol 1e-7, one job), so
older configurations keep their behaviour.
Solver methods (method)
| Method | Constraints | Notes |
|---|---|---|
scipy-slsqp (default) |
Exact: Σα = 1 per target over its real edges, Σβ = 1 per TF, and the bounds | SciPy SLSQP with the objective gradient from JAX and the exact Jacobian of the linear constraints; no finite differences |
lbfgsb |
Exact, by a feasible box parameterization (sequential bounded allocation) | JAXopt LBFGSB; success also requires original-parameter projected stationarity, with a ProjectedGradient refinement where the box solver stops at a collapsed stick |
projected-gradient |
Exact, by projection on each bounded affine-sum group | JAXopt ProjectedGradient; supports signed β; projected subgradient behaviour for nonsmooth losses |
non-negative |
As projected-gradient, with β restricted to ≥ 0 |
JAXopt |
unconstrained |
None; feasibility is measured and reported | JAXopt LBFGS |
Aliases: l-bfgs-b → lbfgsb, projectedgradient → projected-gradient, lbfgs → unconstrained. Bare SLSQP
and trust-constr are rejected with an error (the SciPy driver is named scipy-slsqp); there are no silent
substitutions and no evolutionary methods.
The JAXopt methods are approximate for the production problem: it is ill-conditioned (condition number about 6.5e5
on the feasible directions), and projected-gradient, accelerated projected-gradient and L-BFGS-B did not converge at
tol 1e-7 on the shipped inputs, while scipy-slsqp converged with the KKT conditions verified (see
TF Optimization). MAE (1) and elastic net (5) are nonsmooth: the quasi-Newton methods
refuse them unless allow_nonsmooth = true.
Multistart
The first start is the starting values (drawn with start_seed); every further start is drawn from one generator
seeded with seed: with probability p_random uniformly within the bounds, otherwise by jittering the starting
values (jitter_scale), then projected onto the feasible set. Starts run in parallel worker processes (n_jobs,
threads_per_worker); each start keeps its draw, so parallel results are identical to sequential ones.
A start is accepted if it succeeded, its measured constraint residual is ≤ acceptance_tol and its KKT verdict
passes. The workbook holds the best start: accepted starts first, by objective; then the rest (feasible before
infeasible, successful before failed). Each start's accepted flag, seed label and KKT residuals are in
multistart_summary.csv; diagnostics.json has them for the selected start.
Command-line options
tfopt run takes the settings with hyphens (--n-starts, --loss-type, …); tfopt-local keeps the underscore
options of earlier versions (--lower_bound, --upper_bound, --loss_type, --prediction_transform, --method,
--copy_to_ode_data_dir). Both take --config PATH. See Command line.
Configuration Consumers
| Section or file | Consumer |
|---|---|
config.toml |
config_loader.py (finds it), tfopt.api.load_config (reads it into a RunConfig) |
[paths], [tfopt], [tfopt.modes.local] |
tfopt.api.load_config (used by tfopt run, tfopt validate, tfopt-local and the GUI); tfopt.local.config.constants (read on first use) |
run_config.json of a results folder |
tfopt.analysis.load_run and the readout subcommands (inputs, time grids, β bounds, alignment of the run) |
config.logconf, tfopt.local.config.logconf |
Logger setup |