Skip to content

TruthTable.R

palmerito0 edited this page Apr 29, 2023 · 7 revisions

TruthTable.R

TruthTable.R is a script to simulate a rxncon model (or specific module(s) within a model) under all possible combinations of a given set of inhibitors and activators to see their effect on selected output nodes. Values for selected output nodes range from 0 (never on in attractor) to 1 (always on in attractor)

Running

Run TruthTable.R by sourcing it directly (./TruthTable.R) or with Rscript (Rscript ./TruthTable.R).

Parameters should be set in a config file (TruthTable.R /path/to/config.R, see below for config file format)

Parameters

  • file: Path to master rxncon file.
  • driveFile: Name or URL of master rxncon file on Google Drive (mutually exclusive with file)
  • modules: Comma-separated modules to be loaded from master rxncon file. Omit this argument or leave it blank to load all modules.
  • minQuality: Minimum quality for a rxncon rule to be loaded, default: 0. Rules without a quality tag are always loaded
  • out: Folder to which output files will be written, default: ./
  • inputInhibs: List of nodes to be inhibited (i.e. forcibly set to "on")
  • inputStimuli: List of nodes to be activated (i.e. forcibly set to "off")
  • outputs: List of nodes to be monitored for the effects of inhibitor and activator combinations

Note: * operator for rxncon node matching (outputs, inputInhibs, and inputStimuli)

At times, it may be necessary to match multiple rxncon nodes that are closely related (e.g. when inhibiting a protein kinase that phosphorylates many substrates). In that case, it is possible to use the wildcard (*) operator. This operator matches any string in its place in a non-greedy way (effectively the same as .*? in regex).

Config file

Config files should be .R files following this general format:

config <- list(
	arg1 = "string value",
	arg2 = FALSE,
	arg3 = 23,
        arg4 = c("val1", "val2", "val3")
	...
)

See inst/scripts/examples/.../TruthTableConfig.R for examples.

Output

TruthTable.R will output the following files:

  • Temporary modules* files: These files are generated by rxncon and can be used for manual simulation of the system using BoolNetSim.R
  • truth_table.csv: A csv file showing the results of simulating the system under each possible combination of inputStimuli and inputInhibs. Each row represents a different combination of the inputs. Columns represent output nodes selected in outputs, with an additional two columns, stimuli and inhibitors, containing comma separated lists of the stimuli and inhibitors applied in that simulation.
  • truth_table.pdf: A graphical representation of the results. Thin columns on the left represent the presence or absence of the stimulus/inhibitor, columns on the right represent the values of outputs when simulated under the specific combination of stimuli/inhibitors.