Note that Method 1 and 2 have no much difference. Just run one


A. In Unix environment

$ nohup R --no-restore --no-save  < bottom_up_code_method1.R &



B. In R environment

> source("bottom_up_code_method1.R")



You need to install required R packages and their dependent R packages before you can run the methods

library(stats)
library(MASS)
library(lavaan)
library(GeneNet)




C. Explanation of Some results


1. method1_tab_tf_gene_layer_1_bottomup.txt
tf	pwgene/tf	number_interfere
AT1G14440		AT1G27600	18
AT1G14440		AT1G67980	15
AT1G14440		AT4G24520	14
AT1G14440		AT4G30210	14
AT1G14440		AT4G37970	9
AT1G14440		AT2G28110	5
AT1G14440		AT2G37040	5
AT1G14440		AT4G18780	5
AT1G14440		AT4G34050	5
...


The TF, AT1G14440, interferes the pathway gene, AT1G27600, in 18 triple gene combinations.  Gene combination will be explained below 


2. method1_tab_layer_1_bottomUp_no_pairs_corrected_pvalue_intf_tf.txt
TF		 no_interfere
AT1G14440	 64
AT2G45190	 62
AT1G13600	 59
AT1G17950	 59
AT4G32010	 58
AT1G63910	 55
AT5G18830	 52
AT4G29080	 50
AT4G34610	 50
...


What does this result means? 
AT1G1440 interferes the bottom-layered genes (namely pathway genes) in 64 triple gene combinations


3. method1_tab_tf_layer_1_bottomUp_top_TF.txt

Final number of TFs you should keep in the second layer (immediately above bottom layer).  These TFs interferes the pathway layer more frequently and are considered to be the regulators.

In the bottom_up_code_method.R, we set this to 20 TFs (w1=20)


What is in Bottom layer?  It comprises 32 pathway genes provided in PWG32_stem_128sample_exp.txt


4. method1_tab_tf_layer_2_bottomUp_top_TF.txt

Final number of	TFs you	should keep in the third layer. These TFs interferes the second-layered TFs more frequently and thus are considered to regulate the second layer of TFs.  They thus regulate the bottom layer indirectly.

In the program, we set this number to 25 TFs (w2 =25)


We did not get fourth layer of TFs though we set w3 = 30. 

5. method1_tab_tf_layer_1_bottomUp_top_25percent.txt
   method1_tab_tf_layer_2_bottomUp_top_25percent.txt

you can ignore these output files.  This is to keep 25% TFs in each layer, too much than we needed 


5. We have pathway genes(PWGs) at the bottom-layer, and are intended to infer the TFs at the second layer, and then more layers above

What is a triple combination?

 We combine one candidate TF with two pathway genes, known as a triple gene combination, and we then evaluate if the TFs interferes the pathway genes x and y


         AT1G1440
         /     \
        /       \
       /         \
     PWG-X      PWG-y 

for example, if you have n=10 pathway genes (PWG), then the total triple gene combinations with AT1G1440 is n x (n-1)/2 =  45 

Then each candidate is evaluated in 45 combinations and the TFs that interfere the bottom-layer with higher number of interference are more likely to be kept at the second layer. 

You can decide how many TFs to keep at the second layer. 


To build the third layer, the bottom layer is the second layer of TFs. The triple gene combination comprises three TFs. 



In our program, we set w1=20, w2 =25, and w3 ==30, namely


Fourth layer 30 TFs  (we did not get this layer)
Third layer 25 TFs 
Second layer 20 TFs
Bottome layer 32 PWG


6. How to plot a multiple-layered gene regulatory network? 

Once you understand the output files, you need to write a script to extract the all regulatory relationships between any two layers before you can plot a multi-layered GRN.  You can do it in Excel but it is a little bit tedious.  


6. After you get the TFs in the second layer, you can find the TFs in the third-layer, and so on, 


7.  Program may stop when there are no more TFs that interfere with current layer. For example, we could not get the fourth layer with this input data of pathway genes and TFs 

