Skip to content

The TFOpt app

tfopt-app is a guided GUI in the browser: it takes you from three CSV files to the fitted α and β, their checks and the run bundle, one step at a time. It calls the same library functions as the command line (tfopt.api), so a run in the app gives the same results as tfopt run with the same settings. It mirrors KinOpt's kinopt-app, with TFOpt's inputs, settings and outputs.

Start

tfopt-app --workdir ~/tfopt-app          # in a clone: pixi run tfopt-app --workdir ~/tfopt-app
tfopt app --workdir ~/tfopt-app          # the same, through the tfopt command

The command prints a link such as http://127.0.0.1:43517/?token=… and opens it in the browser (--no-browser only prints it). Stop the app with Ctrl+C (a running fit is cancelled).

  • Working folder (--workdir, default ./tfopt-app): uploads are stored in inputs/, the example project in example/, every run in runs/<run id>/. The app reads and writes nothing outside this folder.
  • Local only. The app listens on 127.0.0.1 on a free port (--port to choose one). The link carries a random token for this session; every request without it is refused, so other users of the same machine cannot use your app. Do not share the link.
  • Uploads: only .csv for the three inputs and .toml for the optional configuration, at most 50 MB each (--max-upload-mb).
  • Settings from a configuration (--config config.toml; by default TFOPT_CONFIG, or in a clone the repository's config.toml): its settings, the time grids included, pre-fill the configuration step and are used for every setting you leave unchanged. Its paths are not used. Without one, enter the time grids.

1. Inputs

Choose the three inputs, or click Use the example (the synthetic project of tfopt example: random values that show every case of the model, for trying the app):

File Columns Content
input1 GeneID, Psite, x1 … TF protein rows (empty Psite) and phosphosites (S_, T_, Y_) on the MS grid
input3 GeneID, x1 … mRNA on the RNA grid: the targets, and the mRNA of a TF without a protein row
input4 Source, Target TF → target mRNA edges

The files are copied to inputs/input1.csv, inputs/input3.csv and inputs/input4.csv in the working folder; files already there are offered again when the app restarts.

Time grids. TFOpt has no built-in time grid. Give the MS grid (one time in minutes per input1 column) and the RNA grid (one per input3 column), comma-separated, or upload a config.toml: its [tfopt] and [tfopt.modes.local] settings, time grids included, are read with tfopt.api.load_config, as tfopt run --config reads them (keys it does not set get the same values as on the command line); its paths are ignored. A config.toml without both grids is refused. The example sets both grids.

2. Validation

The checks of tfopt validate: required columns, time columns against the two grids, numeric and finite values, duplicated input1 rows, input1 Psite labels, duplicated input3 rows, empty identifiers in input4, TFs without any series (excluded with their edges), targets a run would drop, and the coverage: targets to fit, TFs by the source of their base series (protein row, mRNA or first site) and the edges used. The edges and targets a run would drop are listed. An error must be fixed (in the files or the grids) before the run can be configured.

3. Configuration

The settings start at the defaults of tfopt.api.RunConfig, replaced by those of an uploaded config.toml or of the example (Reset returns to these). The main ones are shown first: the two time grids (required), solver, number of starts, loss (0 MSE, 1 MAE, 2 soft L1, 3 Cauchy, 4 arctan, 5 elastic net, 6 Tikhonov), prediction transform, the bounds of β and the TF protein source. The rest are under Advanced options: MS alignment, jitter, seeds and share of uniform starts of the multistart, iteration cap and tolerance, parallel workers and threads, the feasibility and acceptance tolerances, and whether to draw plots, run the fit analysis and write the HTML report. Paths cannot be set here: the run always reads inputs/ and writes to runs/<run id>/ in the working folder. When the run starts, the inputs are validated again with these settings, and a run whose inputs fail is refused.

4. Run

The run starts in its own process. The page shows how many starts have finished, the best objective so far, the time and the end of the run's log (the working folder appears as <workdir>; the console output of the run is kept in runs/<run id>/logs/console.txt). Cancel the run stops it and its worker processes. When it finishes, the page states the selected start and whether it is accepted (converged, feasible and passing the KKT check), not only converged.

5. Results

The objective of the selected start (with its loss type), SSE and R², whether the fit converged, its constraint violation and whether it is accepted, how many starts succeeded, were feasible and were accepted, how many constraint checks and KKT conditions passed, and the number of TFs by base-series source. The results are read from the run's folder with tfopt.api.read_results. The tables:

Tab Content Source
Objective and metrics losses, fit metrics, convergence and KKT summary of the selected fit diagnostics.json
Convergence per start, ranked as the selection ranks them (accepted first, then objective): objective, distance from the best, success, feasibility, constraint violation, KKT verdict, accepted, iterations, runtime multistart_summary.csv
Starts per start, as written by the run multistart_summary.csv
Constraint checks |Σα − 1| and α in [0, 1] per target; |Σβ − 1| and β in [lower_bound, upper_bound] per TF; passed if at most feasibility_tol workbook (Alpha Values, Beta Values)
α (TF → target) one row per TF → target edge workbook, Alpha Values
β (TF and sites) the TF-level β and the β of each site, with the Source column (protein, mRNA or site) workbook, Beta Values
TF sources number of TFs whose base series is the protein row, the mRNA or the first site run_config.json
KKT stationarity, primal and dual feasibility, complementary slackness workbook, KKT Diagnostics
KKT multipliers equality and active-bound multipliers workbook, KKT Multipliers
Negative predictions per target, the smallest summed prediction before the transform and its negative time points workbook, Prediction Check

Download saves the run bundle (<run id>.tfopt.zip), when the run wrote one: the run's tables, the workbook, the inputs, the resolved configuration and the log; check it with tfopt bundle --check. When no bundle was written the download is not offered and the results stay in runs/<run id>/. The app draws no figures; with plots enabled the run writes them to its folder as tfopt run does.