Skip to content

Data Processing

The tfopt.processing package checks TFOpt's input tables, maps TF → target edges and selects each TF's series. The top-level processing package of a clone is an alias of it (the same modules, kept for scripts in the repository; the distribution ships tfopt.processing).


Package Structure

tfopt/processing/
├── __init__.py
├── cleanup.py
├── map.py
└── tfseries.py

Inputs

File Columns Content
input1 GeneID, Psite, one column per MS time point TF protein and phosphosite series. The row with an empty Psite is the TF's protein series; rows with S_/T_/Y_ sites are its phosphosites
input3 GeneID, one column per RNA time point mRNA series: the targets, and the mRNA fallback of a TF without a protein row
input4 Source, Target Regulation edges: TF → target mRNA

The column times are given by ms_time_points (input1) and time_points (input3) of the configuration; TFOpt has no built-in time grid. tfopt validate (library: tfopt.api.validate_inputs) checks the three files against them before a run. Use the tutorial data (notebooks/data/) or tfopt example as schema examples.


tfopt.processing.cleanup

validate_timeseries(frame, metadata) checks the metadata columns and that the time-series values are numeric and finite, and returns the time columns. It never rescales or normalizes the data.


tfopt.processing.map

regulation_map(frame) maps Source TFs to Target genes, keeping the input edge order and dropping duplicate edges. Targets without a measured valid regulator are excluded by the filtering stage (tfopt.local.optcon.filter) before the padded arrays are built, and logged.


tfopt.processing.tfseries

Selects each TF's base series and sites (T6, design note) and aligns input1 to the RNA times (T6c):

  • build_tf_series uses the TF's input1 protein row (empty Psite) as its base series; without one, the TF's input3 mRNA, which is logged. A TF with neither is excluded together with its edges, also logged. The TF's own S_/T_/Y_ rows are its sites. A TF without sites has a single TF-level β fixed at 1.
  • align_to_rna takes an input1 series at the RNA times by actual time: copied where the MS grid has the time, PCHIP-interpolated over the full MS grid otherwise (ms_alignment = "by_time"); "legacy_position" keeps the earlier positional pairing of the last columns, for control runs only.
  • log_tf_sources logs the source of every TF's series and the edges dropped.

Outputs

tfopt.processing writes no files: it returns tables and arrays to tfopt.local and tfopt.api.