
####This Script has been written by Marco Antonio Mendoza-Parra with the aim of propagating the transcriptional regulatory cascades from a defined list of
starting nodes. This custom version has been designed in the context of P19/F9 RA-driven cell differentiation, thus it is rather limited to be applied on
other cases. Please note that a cytoscape plugin is currently on development for the generalization of this approach.#########################


# First of all, define the list of nodes to evaluate as potential "master regulators" as following:

#batch mode: provide a list of target nodes:

targets.P19program <- read.table("clipboard", header=T, colClasses="character")

# or, in case you have only one node to evaluate, then write it on excel and copy as following:

target <- read.table("clipboard", header=F, colClasses="character")

# then load the following R packages (R 2.18 version) for taking advantage of a multicore strategy (or install them first :) ).

library(foreach)

library(doParallel)

#  Load the script in R as following:

source("Transcriptional_propagation_Rscript.txt")

# TO run the script the user needs to define the nodes to evaluate on their capacity to drive the program towards one of the programs; P19 or F9-specific
but also the common program (cue=); then define the temporal transcriptome to be used for the propagation (nodes.state=). The KO.node parametter can also
be used for defining a node to inactivate, thus to evaluate its relevance during signal propagation. The gene regulatory network is loaded with the TF.TGs=
parametter (three columns format: "TF	Interaction	TG"). Taken in consideration that the signal propagation can become extremely heavy due to the size
of the GRN, the script has been made in a multicore format. In that sense the number of cores to be used can be defined by "cores=". Finally, the list of
genes defining each of the programs are defined under the parametter "common=", "p19.genes=" and "f9.genes=".


SIGTrans.batch (cue=targets.P19program, nodes.state=p19.exp, KO.node ="NULL", TF.TGs=clean.edges, trans.flow="transcription-response", cores=8, common=clean.common, p19.genes=clean.P19.specific, f9.genes=clean.f9.specific)