about summary refs log tree commit diff
diff options
context:
space:
mode:
authorziejd22019-01-28 16:31:54 -0600
committerziejd22019-01-28 16:31:54 -0600
commitbb9d93322abf825368dedaafc2376ef8fdfc1e2f (patch)
tree10b9b3dd405d8a73aa4784e313525159cade3f3b
parentc4949358bfeecdac35802f8369f4f97a21e5fddb (diff)
downloadBNW-bb9d93322abf825368dedaafc2376ef8fdfc1e2f.tar.gz
Jan 28 2019 update
-rw-r--r--sourcecodes/BNW_workflow_net1.htm28
-rw-r--r--sourcecodes/BNW_workflow_sci.htm12
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_best_structure.jpgbin72920 -> 73502 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_file_upload.jpgbin84140 -> 66635 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpgbin75146 -> 81853 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpgbin71078 -> 77206 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpgbin68817 -> 76253 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/sci_5node_network1.jpgbin78402 -> 88789 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/sci_5node_upload.jpgbin46463 -> 55195 bytes
-rw-r--r--sourcecodes/add_evd.php2
-rw-r--r--sourcecodes/add_evd_example.php2
-rw-r--r--sourcecodes/add_inv.php2
-rw-r--r--sourcecodes/add_inv_example.php2
-rw-r--r--sourcecodes/bn_after_upload_gom.php191
-rw-r--r--sourcecodes/bn_file_load_gom.php5
-rw-r--r--sourcecodes/create_tiers_gom.php13
-rw-r--r--sourcecodes/cross_valid.php16
-rw-r--r--sourcecodes/cross_valid_example.php2
-rw-r--r--sourcecodes/cv_plotly.py153
-rw-r--r--sourcecodes/execute_bn_gom.php2
-rw-r--r--sourcecodes/graphviz_structure.php2
-rw-r--r--sourcecodes/help.php15
-rw-r--r--sourcecodes/input_validate.php2
-rw-r--r--sourcecodes/kfold_cv.php12
-rw-r--r--sourcecodes/kfold_cv_example.php2
-rw-r--r--sourcecodes/kfold_plotly.py151
-rw-r--r--sourcecodes/layout.php4
-rw-r--r--sourcecodes/layout.php~123
-rw-r--r--sourcecodes/layout_example.php2
-rw-r--r--sourcecodes/modify_edges.php950
-rw-r--r--sourcecodes/modify_edges_processing.php234
-rw-r--r--sourcecodes/modify_structure_learning.php233
-rw-r--r--sourcecodes/remove_variables.php978
-rw-r--r--sourcecodes/remove_variables.php~977
-rw-r--r--sourcecodes/remove_variables_processing.php232
-rw-r--r--sourcecodes/remove_variables_processing_default.php232
-rw-r--r--sourcecodes/structuremap.php81
-rw-r--r--sourcecodes/test_set_predictions.php12
-rw-r--r--sourcecodes/test_set_predictions_example.php2
-rw-r--r--sourcecodes/ts_plotly.py157
-rw-r--r--sourcecodes/upload_structure_file.php2
41 files changed, 4697 insertions, 136 deletions
diff --git a/sourcecodes/BNW_workflow_net1.htm b/sourcecodes/BNW_workflow_net1.htm
index 318dd5c2..aafab31f 100644
--- a/sourcecodes/BNW_workflow_net1.htm
+++ b/sourcecodes/BNW_workflow_net1.htm
@@ -292,27 +292,27 @@ ul
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif"'>
-**Recent updates to BNW may result in slight differences between what is described/shown below and what would currently be experienced in BNW.**<br><br>
+<br>
 This tutorial provides
-an overview of using BNW to build a Bayesian network model from a dataset and use the network to make predictions. The dataset used in this tutorial is a synthetic example of a genetic dataset that has a total of 8 variables. Two of the variables are genotypes labeled Geno1 and Geno2, and the remaining 6 variables are gene expression levels or other quantitative traits that are labeled Trait1 to Trait6. The dataset is available <a href="example_datasets/example_data_8nodes.txt">here</a>.<br><br>The data file is formatted according to the guidelines on the <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/help.php#file_format>BNW help page</a>. The first row of the file contains the names of the variables and the remaining rows contain the data for each sample of the dataset. The genotypes (Geno1 and Geno2), which are the only discrete variables in the network, are the leftmost variables in the input file and are integer values (1 and 2) for all of the samples. The quantitative traits are continuous variables, and, therefore, all contain a "." in at least one of the samples.<o:p></o:p></span></p>
+an overview of using BNW to build a Bayesian network model from a dataset and use the network to make predictions. The dataset used in this tutorial is a synthetic example of a genetic dataset that has a total of 8 variables. Two of the variables are genotypes labeled Geno1 and Geno2, and the remaining 6 variables are gene expression levels or other quantitative traits that are labeled Trait1 to Trait6. The dataset is available <a href="example_datasets/example_data_8nodes.txt">here</a>.<br><br>The data file is formatted according to the guidelines on the <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/help.php#file_format>BNW help page</a>. The first row of the file contains the names of the variables and the remaining rows contain the data for each sample of the dataset. The genotypes (Geno1 and Geno2), which have two possible states (1 and 2), are the only discrete variables in the network and are the leftmost variables in the input file. The quantitative traits are continuous variables.<o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-right:107.5pt'><b style='mso-bidi-font-weight:
 normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>1. Structure learning using default options<o:p></o:p></span></b></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>We do not know the network structure of this datasets, so we will use BNW to learn the structure that best explains the data. To begin, select <u>Learn a network model from data</u> from the BNW home page. Next, click <u>Choose File</u> at the top of the file upload page, navigate to and select the data file, and click <u>Upload</u>. The contents of the uploaded file should now be visible as shown below.<br><br><o:p></o:p></span></p>
+line-height:115%;font-family:"Arial","sans-serif"'>We do not know the network structure that underlies the relationships between the variables in this dataset, so we will use BNW to learn the structure that best explains the data. To begin, select <u>Learn a network model from data</u> from the BNW home page. Next, click <u>Choose File</u> at the top of the file upload page, navigate to and select the data file, and click <u>Upload</u>. A screen similar to image shown below should be displayed.<br><br><o:p></o:p></span></p>
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><![if !vml]><img width=621 height=218
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><![if !vml]><img width=1128 height=499
 src="BNW_workflow_test_files/8node_file_upload.jpg" v:shapes="Picture_x0020_2"><![endif]></span><span
 style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>Initially, we will perform structure learning using default options in BNW. By default, BNW limits the maximum number of parents for any node in the network to 4 and presents the structure of the single highest scoring network. To perform structure learning using the default settings and view the network structure, click <u>Perform Bayesian network modeling using default settings</u>. The structure below should be displayed and the network is available <a href="example.php?My_key=example1|Bqx" target="_blank">here</a>.<br><br>
+line-height:115%;font-family:"Arial","sans-serif"'>Clicking on the <u>View uploaded variables and data</u> on the left menu will bring up a pop-up window that displays the uploaded data file or information about the data set, such whether variables were classified as discrete or continuous. This information can be used to ensure that the input file was uploaded and properly interpreted in BNW.<br><br> Other options on the left menu will continue with structure learning. Initially, we will perform structure learning using default options in BNW and click on the <u>Perform Bayesian network modeling using default settings</u> button. By default, BNW limits the maximum number of parents for any node in the network to 4 and presents the structure of the single highest scoring network. Structure learning can take a significant amount of time for larger networks. For this dataset, structure learning should take only a few seconds, and the structure below will soon be displayed. The network can be also be accessed <a href="example.php?My_key=example1|Bqx" target="_blank">here</a>.<br><br>
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<img width=548 height=479
+<img width=908 height=842
 src="BNW_workflow_test_files/8node_best_structure.jpg" v:shapes="Picture_x0020_5"><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
@@ -324,7 +324,7 @@ normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>In order to test if edges present the single best scoring network are conserved across high scoring networks. We can modify the structure learning settings to get identify the structures of many high scoring networks and perform <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/help.php#learn_details>model averaging</a> over these structures. To do this, return to the BNW home page, select <u>Learn a network model from data</u>, and upload the datafile. Instead of using the default settings, select <u>Go to structure learning settings and the BNW structural constraint interface</u>. A more detailed overview of use of the structural constraint interface is provided in <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/BNW_workflow_2.htm>another tutorial</a>, but, here, we will investigate the impact of modifying some of the structure learning settings shown below:<br><o:p></o:p></span></p><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>In order to test if edges present the single best scoring network are conserved across high scoring networks. We can modify the structure learning settings to get identify the structures of many high scoring networks and perform <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/help.php#learn_details>model averaging</a> over these structures. To do this, return to the BNW home page, select <u>Learn a network model from data</u>, and upload the data file. Instead of using the default settings, select <u>Go to structure learning settings and the BNW structural constraint interface</u>. A more detailed overview of use of the structural constraint interface is provided in <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/BNW_workflow_2.htm>another tutorial</a>, but, here, we will investigate the impact of modifying some of the structure learning settings shown below:<br><o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
@@ -333,11 +333,11 @@ src="BNW_workflow_test_files/8node_global_settings.jpg" v:shapes="Picture_x0020_
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>Change the <u>Number of networks to include in model averaging</u> to 100 and select <u>Perform Bayesian network modeling</u>. Now, instead of displaying the single highest scoring network, BNW will determine the 100 highest scoring networks, perform model averaing over these networks, and display the structure after model averaging that includes all features with a <u>Model averaging edge selection threshold</u> greater than 0.5. Model averaging over the 100 highest scoring structures has resulted in a change in the network structure as shown below and available <a href="example.php?My_key=example2|hQG" target="blank_">here</a>.<br><o:p></o:p></span></p><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>Change the <u>Number of networks to include in model averaging</u> to 100 and select <u>Perform Bayesian network modeling</u>. Now, instead of displaying the single highest scoring network, BNW will determine the 100 highest scoring networks, perform model averaing over these networks, and display the structure after model averaging that includes all features with a <u>Model averaging edge selection threshold</u> greater than 0.5. Model averaging over the 100 highest scoring structures has resulted in a change in the network structure as shown below and is available <a href="example.php?My_key=example2|hQG" target="blank_">here</a>.<br><o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=558 height=475
+<![if !vml]><img width=1034 height=802
 src="BNW_workflow_test_files/8node_model_avg_struct.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
@@ -358,21 +358,23 @@ normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>To make predictions with the network, we will use the structure learned after model averaging of the top 100 highest scoring networks. First, we will use the model to compare the expected values for nodes in the network based on observed genotypes. For these predictions, we will keep the prediction in evidence mode. The difference between evidence and intervention modes is discussed in the <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/faq.php#evid_inter>BNW FAQ page</a>. To use the model to make predictions based on Geno1, click on one of the blue bars in the Geno1 node and enter 1 or 2 to indicate which genotype value should be used to predict the values of the other network nodes. In the figure below, Geno1 is outlined in red and state 2 has a 100% probability, indicating that the value of this node has been entered as evidence. The red lines in the figure show the predicted distributions of the nodes after this evidence is known and can be compared with the blue lines which show the distributions for variables using the original data.<o:p></o:p></span></p><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>To make predictions with the network, we will use the structure learned after model averaging of the top 100 highest scoring networks. First, we will use the model to compare the expected values for nodes in the network based on observed genotypes. For these predictions, we will use evidence mode when making predictions, which is the default behavior in BNW. The difference between evidence and intervention modes is discussed in the <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/faq.php#evid_inter>BNW FAQ page</a>. To use the model to make predictions based on Geno1, click on one of the blue bars in the Geno1 node and enter 1 or 2 to indicate which genotype value should be used to predict the values of the other network nodes. In the figure below, Geno1 is outlined in red and state 2 has a 100% probability, indicating that the value of this node has been entered as evidence. The red lines in the figure show the predicted distributions of the nodes after this evidence is known and can be compared with the blue lines which show the distributions for variables using the original data.<o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=558 height=475
+<![if !vml]><img width=1086 height=866
 src="BNW_workflow_test_files/8node_geno1_2.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>If Geno1 has genotype 2, the value of Traits 1, 2, and 4 are expected to increase compared with the distribution for all data. Specifically, the mean value of Trait2 is expected to be near 1 for Geno1=2 data, while it is close to 0 when this evidence is not known. Traits 1 and 4 are also expected to increase, but the magnitude of this increase is not expected to be as large. Predicted distributions for the other nodes in the network, which are not descendants of Geno1, are expected to be close to the same as their original distributions, and, the red line covers the blue line for some nodes.  Evidence for multiple nodes can be considered at the same time by clicking on a new node in the network and entering a value. Alternatively, users can select <u>Clear evidence</u> to reset the network to show the orignial distributions in a new tab.<br><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>If Geno1 has genotype 2, the value of Traits 1, 2, and 4 are expected to increase compared with the distribution for all data. Specifically, the mean value of Trait2 is expected to be near 1 for Geno1=2 data, while it is close to 0 when this evidence is not known. Traits 1 and 4 are also expected to increase, but the magnitude of this increase is not expected to be as large. Predicted distributions for the other nodes in the network, which are not descendants of Geno1, are expected to be close to the same as their original distributions, and, the red line covers the blue line for some nodes.<br><br>
+To quantitatively assess the impact of this evidence on the network predictions, the <u>View parameters</u> button on the left menu can be selected. Clicking this button brings up a pop-up window with the network parameters (i.e., the probability distributions of the states of discrete nodes and the means and standard deviations of the Gaussian distributions for continuous nodes) for both the original data set and the data when considering the entered evidence. <br><br>
+Evidence for multiple nodes can be considered at the same time by clicking on a new node in the network and entering a value. Alternatively, users can select <u>Clear evidence</u> to reset the network to show the orignial distributions in a new tab.<br><br>
 Next, we will make predictions using the intervention mode. To use the prediction mode, click the button next to <u>Intervention</u> at the top of the page. The <u>Selected mode</u> tab on the left of the screan should now display Intervention. The effects of experimental intervention on Trait2 can be predicted by clicking on the blue line in the Trait2 node and entering a value for the variable. The figure below shows the network after setting Trait2 to a value of 1.5.<o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=558 height=475
+<![if !vml]><img width=1036 height=864
 src="BNW_workflow_test_files/8node_trait2_15.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
diff --git a/sourcecodes/BNW_workflow_sci.htm b/sourcecodes/BNW_workflow_sci.htm
index 8adbc7b7..1e56bb11 100644
--- a/sourcecodes/BNW_workflow_sci.htm
+++ b/sourcecodes/BNW_workflow_sci.htm
@@ -315,22 +315,16 @@ ul
 
 <div class=WordSection1>
 
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>
-**Recent updates to BNW may result in slight differences between what is described/shown below and what would currently be experienced in BNW.**
-<br><br><o:p></o:p></span></p>
-
 <p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
 normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>1.
 A genetic network linking genotype and phenotype<o:p></o:p></span></b></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>In this example, we will use the structural constraint interface to create a genetic network linking a genotype with gene expression traits and a higher-order phenotype. There are 5 nodes in the network: Genotype, Gene1, Gene2, Gene3, and Phenotype. The input datafile is available <a href="example_datasets/sci_5node_input_data2.txt">here</a>. To begin, select <u>Learn a network model from data</u> on the BNW homepage and load the data file, displaying what is shown below:<br><br><o:p></o:p></span></p>
+line-height:115%;font-family:"Arial","sans-serif"'>In this example, we will use the structural constraint interface to create a genetic network linking a genotype with gene expression traits and a higher-order phenotype. There are 5 nodes in the network: Genotype, Gene1, Gene2, Gene3, and Phenotype. The input data file is available <a href="example_datasets/sci_5node_input_data2.txt">here</a>. To begin, select <u>Learn a network model from data</u> on the BNW homepage and load the data file, displaying what is shown below:<br><br><o:p></o:p></span></p>
 
 
-<img width=515 height=180 src="BNW_workflow_test_files/sci_5node_upload.jpg" v:shapes="Picture_x0020_2"></img>
+<img width=1076 height=404 src="BNW_workflow_test_files/sci_5node_upload.jpg" v:shapes="Picture_x0020_2"></img>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
@@ -354,7 +348,7 @@ line-height:115%;font-family:"Arial","sans-serif"'><br>The third section of the
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif"'><br>In this example, we will not specify any additional constraints in the fourth section of the structural constraint interface, and we can click <u>Perform Bayesian network modeling</u> on the upper left corner of the page. The figure below shows the network with the model average network of the 1000 highest scoring networks and this network is available <a href="example.php?My_key=example_sci|Llu" target="_blank">here</a>. Genotype directly influences two of the genes (Gene1 and Gene3), and two of the genes (Gene2 and Gene3) directly influence the Phenotype. In this case, although we did not prevent the Genotype from directly influencing the Phenotype, the highest scoring networks did not include this directed edge. The right side of the figure shows the predictions of the network with Genotype=1 used as evidence. If Genotype is known to be in state 1, the values of all other variables in the network are expected to decrease compared to the distributions learned using all phenotypes. A more complete description of using BNW to make predictions with network models can be found in a <a href="BNW_workflow_net1.htm">separate tutorial</a>.<br><br><o:p></o:p></span></p>
 
-<img width=700 height=450 src="BNW_workflow_test_files/sci_5node_network1.jpg" v:shapes="Picture_x0020_2"></img>
+<img width=1117 height=846 src="BNW_workflow_test_files/sci_5node_network1.jpg" v:shapes="Picture_x0020_2"></img>
 
 
 <p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
diff --git a/sourcecodes/BNW_workflow_test_files/8node_best_structure.jpg b/sourcecodes/BNW_workflow_test_files/8node_best_structure.jpg
index a6f1ff3e..3fce7f95 100644
--- a/sourcecodes/BNW_workflow_test_files/8node_best_structure.jpg
+++ b/sourcecodes/BNW_workflow_test_files/8node_best_structure.jpg
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_file_upload.jpg b/sourcecodes/BNW_workflow_test_files/8node_file_upload.jpg
index 0e5bf4aa..7a40cdae 100644
--- a/sourcecodes/BNW_workflow_test_files/8node_file_upload.jpg
+++ b/sourcecodes/BNW_workflow_test_files/8node_file_upload.jpg
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpg b/sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpg
index 7e07f1aa..849caf65 100644
--- a/sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpg
+++ b/sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpg
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpg b/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpg
index 034b1a6a..20b4d73b 100644
--- a/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpg
+++ b/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpg
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpg b/sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpg
index 887af1fd..33ea13cf 100644
--- a/sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpg
+++ b/sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpg
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/sci_5node_network1.jpg b/sourcecodes/BNW_workflow_test_files/sci_5node_network1.jpg
index f0f9e662..ed710d68 100644
--- a/sourcecodes/BNW_workflow_test_files/sci_5node_network1.jpg
+++ b/sourcecodes/BNW_workflow_test_files/sci_5node_network1.jpg
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/sci_5node_upload.jpg b/sourcecodes/BNW_workflow_test_files/sci_5node_upload.jpg
index 3dd7c3cc..caa75e13 100644
--- a/sourcecodes/BNW_workflow_test_files/sci_5node_upload.jpg
+++ b/sourcecodes/BNW_workflow_test_files/sci_5node_upload.jpg
Binary files differdiff --git a/sourcecodes/add_evd.php b/sourcecodes/add_evd.php
index 346aba04..c031ead6 100644
--- a/sourcecodes/add_evd.php
+++ b/sourcecodes/add_evd.php
@@ -192,7 +192,7 @@ else
 
   //execute shell script for matlab
   $keyval = valid_keyval($keyval);
-  shell_exec('./run_octave_evd '.$keyval);
+  shell_exec('./run_scripts/run_octave_evd '.$keyval);
 
 ?>
 <script>
diff --git a/sourcecodes/add_evd_example.php b/sourcecodes/add_evd_example.php
index 29465fae..cc393c0b 100644
--- a/sourcecodes/add_evd_example.php
+++ b/sourcecodes/add_evd_example.php
@@ -187,7 +187,7 @@ else
  
   //execute shell script for matlab
   $keyval = valid_keyval($keyval);
-  shell_exec('./run_octave_evd '.$keyval);
+  shell_exec('./run_scripts/run_octave_evd '.$keyval);
 
 ?>
 <script>
diff --git a/sourcecodes/add_inv.php b/sourcecodes/add_inv.php
index 25b7b7ba..4fe0fa10 100644
--- a/sourcecodes/add_inv.php
+++ b/sourcecodes/add_inv.php
@@ -200,7 +200,7 @@ structure_change($keyval);
  // $cmd="./runmat_inv.sh $keyval";
 //  system($cmd);
 
-shell_exec('./run_octave_inv '.$keyval);
+shell_exec('./run_scripts/run_octave_inv '.$keyval);
 
 
 
diff --git a/sourcecodes/add_inv_example.php b/sourcecodes/add_inv_example.php
index a3e0f87d..74c8547c 100644
--- a/sourcecodes/add_inv_example.php
+++ b/sourcecodes/add_inv_example.php
@@ -201,7 +201,7 @@ structure_change($keyval);
   //execute shell script for matlab
  // $cmd="./runmat_inv.sh $keyval";
 //  system($cmd);
-shell_exec('./run_octave_inv '.$keyval);
+shell_exec('./run_scripts/run_octave_inv '.$keyval);
 
 
 
diff --git a/sourcecodes/bn_after_upload_gom.php b/sourcecodes/bn_after_upload_gom.php
new file mode 100644
index 00000000..d7435cfd
--- /dev/null
+++ b/sourcecodes/bn_after_upload_gom.php
@@ -0,0 +1,191 @@
+<?php
+  //Going to modify this so it just writes the uploaded data to a file.
+  //Standardization and determining other factors will be performed in
+  //  a Matlab/Octave script.
+
+include("header_new.inc");
+include("header_batchsearch.inc");
+include("runtime_check.php");
+include("input_validate.php");
+//$searchID="";
+$searchID="YES";
+$UploadValue="NO";
+$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+
+
+/////////////Generate a random key/////////////////////
+//$alphas=array();
+//$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
+
+//$al1=rand(0,51);
+//$al2=rand(0,51);
+//$al3=rand(0,51);
+
+//$alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
+//$keyval=$alpha;
+
+
+//if($_POST["My_key"]!="")
+//  $keyval=$_POST["My_key"];
+//  $keyval=valid_keyval($keyval);
+
+//$sid=$keyval."continuous_input";
+//$dir="./data/";
+
+//$TextinFile=$dir.$sid."_orig.txt";
+
+
+if(isset($HTTP_POST_VARS["searchkey"]))
+{
+   $searchID=$HTTP_POST_VARS["searchkey"];
+
+}
+
+if($searchID=="")
+{
+?>
+
+<!-- Site navigation menu -->
+<ul class="navbar">
+  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+<?php
+}
+
+
+if(isset($HTTP_POST_VARS["MyUpload"]))
+{
+   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   if ($UploadValue=="YES")
+   {
+        if($TextFile!="")
+        {
+	  //	  $TextFile = valid_input($TextFile);
+            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+            if(!$sta)
+            {
+                 echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>";
+                 flush();
+                 exit();
+            }
+            else
+            {
+                $searchID=file_get_contents("$TextinFile");
+		//unlink($TextinFile);
+
+            }
+
+        }
+
+       else
+       {
+           echo "<script type='text/javascript'> window.alert ('Sorry, please select upload file.')</script>";
+       }
+   }
+}
+
+?>
+<div id="outernew">
+<h2><font color=#33339f>Upload data file for structure learning search</font></h2>
+<FORM name="key_search" enctype="multipart/form-data" ACTION="bn_file_load_gom.php" METHOD=POST>
+
+<table align="left" cellspacing="3" cellpadding="1" border="0"  width="60%">
+<tr>
+<td>
+<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 > 
+<INPUT TYPE="submit" value="  Upload  " onclick="return Upload();">
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+<INPUT TYPE="hidden" name="MyUpload" value="NO"> 
+</td>
+</tr>
+<tr>
+<td align="left"><font color=#33339f><br>Content of uploaded data file:</font><br>
+          <textarea name="searchkey" rows="8" cols="100"><?PHP print($searchID)?> </textarea>
+</td>
+</tr>
+<tr>
+<td>
+<INPUT TYPE="submit" value="  Load example data of immune responses to infection with Chlamydia psittaci  " onclick="return demochl();">&nbsp&nbsp&nbsp
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+</td>
+</tr>
+<tr>
+<td>
+<INPUT TYPE="submit" value="  Load example data of a synthetic genetic network with 2 genotypes and 6 traits  " onclick="return demo8nodes();">&nbsp&nbsp&nbsp
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+</td>
+</tr>
+<tr>
+<td>
+<INPUT TYPE="submit" value="  Load example data of immune-related gene in the spleens of BXD mice  " onclick="return demospnl();">&nbsp&nbsp&nbsp
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+</td>
+</tr>
+<tr>
+<td>
+<INPUT TYPE="submit" value="  Load the ksl dataset from deal  " onclick="return demoksl();">&nbsp&nbsp&nbsp
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+</td>
+</tr>
+<tr>
+<td>
+<INPUT TYPE="submit" value="  Load the rat dataset from deal  " onclick="return demorat();">&nbsp&nbsp&nbsp
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+</td>
+</tr>
+</table>
+</FORM>
+</div>
+
+<?php
+
+if($searchID!="")
+{
+  //if ($UploadValue=="NO")
+  //{
+  //    $fpdata = fopen($dir.$keyval."continuous_input_orig.txt","w");
+  //    fwrite($fpdata,$searchID);
+  //}  
+  //$keyval = valid_keyval($keyval);
+  //shell_exec('./run_scripts/run_prep_input '.$keyval);
+  $keyval=valid_keyval($_GET["My_key"]);
+  $parent_number=4;
+  $k_number=1;
+  $runtime=exe_time($keyval,$parent_number,$k_number);
+?>
+<ul class="navbar2">
+  <li><a href="executionprogress.php?My_key=<?php print($keyval);?>">Perform Bayesian network modeling using default settings</a>
+  <li><a href="create_tiers_gom.php?My_key=<?php print($keyval);?>">Go to structure learning settings and the BNW structural constraint interface</a>  
+  <li><a href="remove_variables.php?My_key=<?php print($keyval);?>">Remove variables from data set</a>  
+  <li><a href="javascript:void(0);"
+NAME="InputCheck" title="InputCheck"
+    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
+</ul>
+<ul class="navbar">
+<li><a href="help.php" target="_blank">Help</a>
+<li><a href="home.php">Home</a>
+</ul>
+<div id="outernew">
+<p><h3><?php 
+print("Estimated run time for current dataset using default settings: $runtime seconds");
+?>
+<br><br><br><br></h3>
+</p>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</div>
+<?php
+}
+?>
+
+</body>
+</html>
+
+
diff --git a/sourcecodes/bn_file_load_gom.php b/sourcecodes/bn_file_load_gom.php
index eb3ac454..3f3ef195 100644
--- a/sourcecodes/bn_file_load_gom.php
+++ b/sourcecodes/bn_file_load_gom.php
@@ -61,7 +61,7 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
    {
         if($TextFile!="")
         {
-	  $TextFile = valid_input($TextFile);
+	  //	  $TextFile = valid_input($TextFile);
             $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
             if(!$sta)
             {
@@ -148,7 +148,7 @@ if($searchID!="")
       fwrite($fpdata,$searchID);
   }  
   $keyval = valid_keyval($keyval);
-  shell_exec('./run_prep_input '.$keyval);
+  shell_exec('./run_scripts/run_prep_input '.$keyval);
   $parent_number=4;
   $k_number=1;
   $runtime=exe_time($keyval,$parent_number,$k_number);
@@ -156,6 +156,7 @@ if($searchID!="")
 <ul class="navbar2">
   <li><a href="executionprogress.php?My_key=<?php print($keyval);?>">Perform Bayesian network modeling using default settings</a>
   <li><a href="create_tiers_gom.php?My_key=<?php print($keyval);?>">Go to structure learning settings and the BNW structural constraint interface</a>  
+  <li><a href="remove_variables.php?My_key=<?php print($keyval);?>">Remove variables from data set</a>  
   <li><a href="javascript:void(0);"
 NAME="InputCheck" title="InputCheck"
     onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
diff --git a/sourcecodes/create_tiers_gom.php b/sourcecodes/create_tiers_gom.php
index b830f529..5f59ab5b 100644
--- a/sourcecodes/create_tiers_gom.php
+++ b/sourcecodes/create_tiers_gom.php
@@ -9,8 +9,6 @@ $keyval=$_GET["My_key"];
 
 $dir="./data/";
 
-
-
 $type_n=array();
 
 //Get number of tier data and key value for changes in number of tier
@@ -120,7 +118,16 @@ Maximum number of parents for any node:
 <td align="left"> 
      <form method="post" action="create_tiers_gom.php" name="form">
       <SELECT NAME="nm_parent"  onchange="form.submit();">
-      <?php if($node<=10) 
+      <?php if($node<=5) 
+            {
+               for($i=1;$i<=4;$i++)
+              {
+            ?>
+              <option value=<?php $combined=$i."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $i) {print "selected";}?>><?php print($i)?></option>
+            <?php
+              }
+            }
+            else if($node<=10) 
             {
                for($i=1;$i<$node;$i++)
               {
diff --git a/sourcecodes/cross_valid.php b/sourcecodes/cross_valid.php
index 8c402283..c3c8bd55 100644
--- a/sourcecodes/cross_valid.php
+++ b/sourcecodes/cross_valid.php
@@ -70,8 +70,17 @@ if(file_exists($filename2))
  }
  else if(file_exists($filename1))
  {?>
-<br>
-    <h2> <a href=<?php $d="./data/".$keyval."looCV.txt"; print($d);?>>View cross-validation results</a></h2>
+    <h2> <a href=<?php $d="./data/".$keyval."looCV.txt"; print($d);?>>Download cross-validation results</a></h2>   
+<?php
+   $plotly_file="./data/".$keyval."loo_plotly.html";
+   if(file_exists($plotly_file))
+     {?>
+     <div>
+	 <object type="text/html" data=<?php print($plotly_file);?> width="800" height="500" >
+         </object>
+     </div>
+ <?php
+      }?>    
 <br>
 <h3>Perform leave-one-out cross-validation of another network variable<br></h3>
 <p align="justify"> 
@@ -108,7 +117,8 @@ display: block; height: 30px; width: 300px;"><span class="error"> <?php if($varN
 
 if($varNameErr=="1")
 {
-  $command = './run_loo '.$keyval.' '.$varName;
+  $command = './run_scripts/run_loo '.$keyval.' '.$varName;
+  //  $command = 'sh plotly_loo.sh'
   $output = shell_exec("$command > /dev/null 2 > /dev/null &");
   $pred_link='cv_predictions.php?My_key='.$keyval;
   sleep(1);
diff --git a/sourcecodes/cross_valid_example.php b/sourcecodes/cross_valid_example.php
index a4bbe043..041df913 100644
--- a/sourcecodes/cross_valid_example.php
+++ b/sourcecodes/cross_valid_example.php
@@ -108,7 +108,7 @@ display: block; height: 30px; width: 300px;"><span class="error"> <?php if($varN
 
 if($varNameErr=="1")
 {
-  $command = './run_loo '.$keyval.' '.$varName;
+  $command = './run_scripts/run_loo '.$keyval.' '.$varName;
   $output = shell_exec("$command > /dev/null 2 > /dev/null &");
   $pred_link='cv_predictions_example.php?My_key='.$keyval;
   sleep(1);
diff --git a/sourcecodes/cv_plotly.py b/sourcecodes/cv_plotly.py
new file mode 100644
index 00000000..9ee49634
--- /dev/null
+++ b/sourcecodes/cv_plotly.py
@@ -0,0 +1,153 @@
+#!/home/jziebart/python/Python-2.7.15/python
+import os
+import sys
+
+#sys.path.append('/home/jziebart/.local/bin')
+#sys.path.append('/home/jziebart/.local/lib')
+
+import plotly
+import plotly.graph_objs as go
+import csv
+import string
+
+netID = sys.argv[-1]
+outfile = netID+"loo_plotly.html"
+
+ 
+filename=netID+"looCV.txt"
+f=open(filename,"r")
+#Read the first line to get the variable name
+line=f.readline()
+line = map(string.strip,line.strip().split(" "))
+varName = line[-1]
+
+
+#Read type file to determine if it is continuous or discrete
+typefile = netID+"type.txt"
+tf=open(typefile,"r")
+line=tf.readline()
+varnames = map(string.strip,line.strip().split("\t"))
+line=tf.readline()
+vartypes = map(string.strip,line.strip().split("\t"))
+varindex = varnames.index(varName)
+cd_type = int(vartypes[varindex])
+
+
+if cd_type == 1:
+    #Make scatterplot for continuous_data
+    #Read introductory lines from file
+    for i in range(6):
+        line = f.readline()
+    #Read the data
+    x = []
+    y = []
+    line = f.readline()
+    while line:
+        line = map(string.strip,line.strip().split("\t"))
+        x.append(float(line[1]))
+        y.append(float(line[2]))
+        line=f.readline()
+
+    data = [go.Scatter(x=x,y=y,mode='markers')]
+    layout = go.Layout(
+        xaxis=dict(
+            autorange=True,
+            title='Actual values',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            ),
+        yaxis=dict(
+            autorange=True,
+            title='Predicted values',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            )
+        )
+    fig = go.Figure(data=data, layout = layout)
+    plotly.offline.plot(fig,filename=outfile)
+
+else:
+    #Make bar chart for discrete data
+    #Read introductory lines from file
+    for i in range(5):
+        line = f.readline()
+    #Get names of states
+    line = map(string.strip,line.strip().split("\t"))
+    states = line[2:]
+    #Read the data
+    actual = []
+    predicted = []
+    line = f.readline()
+    while line:
+        line = map(string.strip,line.strip().split("\t"))
+        actual.append(line[1])
+        predict_x = line[2:]
+        predict_x = [float(x) for x in predict_x]
+        max_value = max(predict_x)
+        max_index = predict_x.index(max_value)
+        predicted.append(states[max_index])
+        #check if multiple states are equally likely to be predicted states
+        #I am not going to count these as being predicted here
+        max_items = [x for x in predict_x if (abs(x-max_value) < 0.000001)]
+        if len(max_items) > 1:
+            predicted.pop()
+            actual.pop()
+        line=f.readline()
+    
+    #Go through states and get number of true positives, false positives, and false negatives
+    tp_all = []
+    fp_all = []
+    fn_all = []
+    for state in states:
+        tp = 0
+        fp = 0
+        fn = 0
+        for i in range(len(actual)):
+            actual_i = actual[i]
+            predicted_i = predicted[i]
+            if actual_i == state:
+                if predicted_i == state:
+                    tp = tp + 1
+                else:
+                    fn = fn + 1
+            elif predicted_i == state:
+                fp = fp + 1
+        tp_all.append(tp)
+        fn_all.append(fn)
+        fp_all.append(fp)
+    print tp_all
+    print fn_all
+    print fp_all
+    trace1 = go.Bar(x=states,y=tp_all,name="True Positives")
+    trace2 = go.Bar(x=states,y=fn_all,name="False Negatives")
+    trace3 = go.Bar(x=states,y=fp_all,name="False Positives")
+    data = [trace1,trace2,trace3]
+    layout = go.Layout(
+        barmode='group',
+        xaxis=dict(
+            autorange=True,
+            title='State',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            ),
+        yaxis=dict(
+            autorange=True,
+            title='Number of cases',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            )
+    )
+    fig = go.Figure(data=data, layout = layout)
+    plotly.offline.plot(fig,filename=outfile)
diff --git a/sourcecodes/execute_bn_gom.php b/sourcecodes/execute_bn_gom.php
index 266bff70..78ba0810 100644
--- a/sourcecodes/execute_bn_gom.php
+++ b/sourcecodes/execute_bn_gom.php
@@ -84,7 +84,7 @@ fwrite($fout,"$endstring");
 fclose($fout);
 
 
-shell_exec('./run_octave '.$keyval);
+shell_exec('./run_scripts/run_octave '.$keyval);
 
 ?>
 <script>
diff --git a/sourcecodes/graphviz_structure.php b/sourcecodes/graphviz_structure.php
index 2e39e268..c708a25c 100644
--- a/sourcecodes/graphviz_structure.php
+++ b/sourcecodes/graphviz_structure.php
@@ -88,7 +88,7 @@ fclose($fp);
 //prepare and execute shell script for matlab with a write lock
 //$cmd="./runmat.sh $keyval";
 //system($cmd);
-shell_exec('./run_octave '.$keyval);
+shell_exec('./run_scripts/run_octave '.$keyval);
 ?>
 <script>
 window.open("layout.php?My_key=<?php print($keyval);?>",'_self',false);
diff --git a/sourcecodes/help.php b/sourcecodes/help.php
index 92e44d67..8ed4a009 100644
--- a/sourcecodes/help.php
+++ b/sourcecodes/help.php
@@ -218,17 +218,16 @@ If users have made predictions using either the evidence or intervention modes,
 <br>
 <br><b>5)</b> Added a "Use a network ID to return to a network" on the BNW home page. This button allows users to enter a network ID to return to a previously generated network model. The network ID can also be used to share the network model with collaborators. The network ID is a three character string that is listed in left menu of a BNW network page.
 <br> 
-<!-- 
-<br><b>6)</b> Added a "Cross validation" feature to test networks using leave-one-out cross-validation. This button is available on the left menu of a network page. <br><br>
- Clicking "Cross validation" will open a pop-up window. Users can then enter the name of the variable that they want to test. After submitting the variable, the pop-up window will close. Users can then click the "Cross validation" button on the network page again to determine if their cross-validation calculation has completed.
-If it has completed, the cross-validation output contains the following information:<br><br>
+<br><b>6)</b> BNW is now able to perform cross-validation and make predictions on a test data set using the "Cross validation and predictions" button on the left menu of the network page. Clicking this button presents three options: leave-one-out cross validation, k-fold cross validation, and uploading a test data set to make predictions using the network model.<br><br> 
+<b>Leave-one-out cross validation: </b>Users should enter the name of a network variable that they want to investigate. These calculations can take up to 3 minutes for large data sets.
+After the calculation is complete, the cross-validation output contains the following information:<br><br>
 For discrete variables, the predicted likelihood of each state for the left-out case, given the values of its parent variables in the network, is provided.<br><br>
-For continuous variables, the predicted mean and standard deviation of the left-out variable, given the values of its parent variables in the network, is provided.<br>
-<br><b>7)</b> Added a method to make predictions on a test data set that can be accessed using the "Make predictions on test data set" button on the left menu of a network page. <br><br>
-Clicking this button will open a pop-up window. Users can then upload a file containing a test data set. The format of the file should follow the format of the input data file with two exceptions:<br><br>
+For continuous variables, the predicted mean and standard deviation of the left-out variable, given the values of its parent variables in the network, is provided.<br><br>
+<b>k-fold cross validation: </b>Users should enter the name of the variable that should be predicted as well as the number of folds into which the data set should be split.
+The output file contains similar information as what is produced using leave-one-out cross-validation.<br><br>
+<b>Predictions on a test data set: </b>Users can then upload a file containing a test data set. The format of the file should follow the format of the input data file with two exceptions:<br><br>
 <b>a)</b> The first line of the file should containing the name of the variable that should be predicted.<br><br>
 <b>b)</b> "NA" can be used for missing data. The test data file can contain missing data. If data for a variable of a given sample or case is not known, an "NA" can be entered in the input file. Data can be missing for the variable that is to be predicted or for the variables that are to be used as predictors.<br><br>
- -->
 <br>
 </table>
 
diff --git a/sourcecodes/input_validate.php b/sourcecodes/input_validate.php
index 7c9dbe60..f5d5a4fc 100644
--- a/sourcecodes/input_validate.php
+++ b/sourcecodes/input_validate.php
@@ -23,7 +23,7 @@ function valid_input($input)
   $input = stripslashes($input);
   $input = htmlspecialchars($input);
   //check if keyval contains only letters, numbers, hyphens, underscore, periods, or whitespace.
-  if (!preg_match('/^[-A-Za-z\d\ \t\r\n_\.]+$/',$input)) {
+  if (!preg_match('/^[-A-Za-z\d\ \t\r\n_\.\-]+$/',$input)) {
     header("Location: input_error.php");
   }
   return $input;
diff --git a/sourcecodes/kfold_cv.php b/sourcecodes/kfold_cv.php
index 6cae9538..b168254a 100644
--- a/sourcecodes/kfold_cv.php
+++ b/sourcecodes/kfold_cv.php
@@ -74,6 +74,16 @@ if(file_exists($filename2))
  {?>
 <br>
     <h2> <a href=<?php $d="./data/".$keyval."kfoldCV.txt"; print($d);?>>View cross-validation results</a></h2>
+<?php
+   $plotly_file="./data/".$keyval."kfold_plotly.html";
+   if(file_exists($plotly_file))
+     {?>
+     <div>
+	 <object type="text/html" data=<?php print($plotly_file);?> width="800" height="500" >
+         </object>
+     </div>
+ <?php
+      }?>    
 <br>
 <h3>Perform k-fold cross-validation of another network variable</h3>
 <p align="justify"> 
@@ -133,7 +143,7 @@ if(file_exists($filename2))
 
 if($nm_folds!="")
 {
-  $command = './run_kfold '.$keyval.' '.$varName.' '.$nm_folds;
+  $command = './run_scripts/run_kfold '.$keyval.' '.$varName.' '.$nm_folds;
   $output = shell_exec("$command > /dev/null 2 > /dev/null &");
   $pred_link='cv_predictions.php?My_key='.$keyval;
   sleep(1);
diff --git a/sourcecodes/kfold_cv_example.php b/sourcecodes/kfold_cv_example.php
index 44b56fa5..68c1a3bf 100644
--- a/sourcecodes/kfold_cv_example.php
+++ b/sourcecodes/kfold_cv_example.php
@@ -133,7 +133,7 @@ if(file_exists($filename2))
 
 if($nm_folds!="")
 {
-  $command = './run_kfold '.$keyval.' '.$varName.' '.$nm_folds;
+  $command = './run_scripts/run_kfold '.$keyval.' '.$varName.' '.$nm_folds;
   $output = shell_exec("$command > /dev/null 2 > /dev/null &");
   $pred_link='cv_predictions_example.php?My_key='.$keyval;
   sleep(1);
diff --git a/sourcecodes/kfold_plotly.py b/sourcecodes/kfold_plotly.py
new file mode 100644
index 00000000..e038c796
--- /dev/null
+++ b/sourcecodes/kfold_plotly.py
@@ -0,0 +1,151 @@
+#!/home/jziebart/python/Python-2.7.15/python
+import os
+import sys
+
+#sys.path.append('/home/jziebart/.local/bin')
+#sys.path.append('/home/jziebart/.local/lib')
+
+import plotly
+import plotly.graph_objs as go
+import csv
+import string
+
+netID = sys.argv[-1]
+
+outfile = netID+"kfold_plotly.html"
+ 
+filename=netID+"kfoldCV.txt"
+f=open(filename,"r")
+#Read the first line to get the variable name
+line=f.readline()
+line = map(string.strip,line.strip().split(" "))
+print line
+varName = line[-1]
+print varName
+
+#Read type file to determine if it is continuous or discrete
+typefile = netID+"type.txt"
+tf=open(typefile,"r")
+line=tf.readline()
+varnames = map(string.strip,line.strip().split("\t"))
+line=tf.readline()
+vartypes = map(string.strip,line.strip().split("\t"))
+varindex = varnames.index(varName)
+cd_type = int(vartypes[varindex])
+
+
+if cd_type == 1:
+    #Make scatterplot for continuous_data
+    #Read introductory lines from file
+    for i in range(6):
+        line = f.readline()
+    #Read the data
+    x = []
+    y = []
+    line = f.readline()
+    while line:
+        line = map(string.strip,line.strip().split("\t"))
+        x.append(float(line[2]))
+        y.append(float(line[3]))
+        line=f.readline()
+
+    data = [go.Scatter(x=x,y=y,mode='markers')]
+    layout = go.Layout(
+        xaxis=dict(
+            autorange=True,
+            title='Actual values',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            ),
+        yaxis=dict(
+            autorange=True,
+            title='Predicted values',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            )
+        )
+    fig = go.Figure(data=data, layout = layout)
+    plotly.offline.plot(fig,filename=outfile)
+
+else:
+    #Make bar chart for discrete data
+    #Read introductory lines from file
+    for i in range(5):
+        line = f.readline()
+    #Get names of states
+    line = map(string.strip,line.strip().split("\t"))
+    states = line[3:]
+    #Read the data
+    actual = []
+    predicted = []
+    line = f.readline()
+    while line:
+        line = map(string.strip,line.strip().split("\t"))
+        actual.append(line[2])
+        predict_x = line[3:]
+        predict_x = [float(x) for x in predict_x]
+        max_value = max(predict_x)
+        max_index = predict_x.index(max_value)
+        predicted.append(states[max_index])
+        #check if multiple states are equally likely to be predicted states
+        #I am not going to count these as being predicted here
+        max_items = [x for x in predict_x if (abs(x-max_value) < 0.000001)]
+        if len(max_items) > 1:
+            predicted.pop()
+            actual.pop()
+        line=f.readline()
+    
+    #Go through states and get number of true positives, false positives, and false negatives
+    tp_all = []
+    fp_all = []
+    fn_all = []
+    for state in states:
+        tp = 0
+        fp = 0
+        fn = 0
+        for i in range(len(actual)):
+            actual_i = actual[i]
+            predicted_i = predicted[i]
+            if actual_i == state:
+                if predicted_i == state:
+                    tp = tp + 1
+                else:
+                    fn = fn + 1
+            elif predicted_i == state:
+                fp = fp + 1
+        tp_all.append(tp)
+        fn_all.append(fn)
+        fp_all.append(fp)
+    trace1 = go.Bar(x=states,y=tp_all,name="True Positives")
+    trace2 = go.Bar(x=states,y=fn_all,name="False Negatives")
+    trace3 = go.Bar(x=states,y=fp_all,name="False Positives")
+    data = [trace1,trace2,trace3]
+    layout = go.Layout(
+        barmode='group',
+        xaxis=dict(
+            autorange=True,
+            title='State',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            ),
+        yaxis=dict(
+            autorange=True,
+            title='Number of cases',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            )
+    )
+    fig = go.Figure(data=data, layout = layout)
+    plotly.offline.plot(fig,filename=outfile)
diff --git a/sourcecodes/layout.php b/sourcecodes/layout.php
index 75748639..6c50a561 100644
--- a/sourcecodes/layout.php
+++ b/sourcecodes/layout.php
@@ -77,15 +77,15 @@ function calcHeight()
 
 <ul class="navbar">
  <li><a href="clear.php?My_key=<?php print($keyval);?>" target='_blank'>Clear evidence</a>
-<!---
 <li><a href="cv_predictions.php?My_key=<?php print($keyval);?>";>Cross validation and predictions</a>
---->
+<li><a href="modify_edges.php?My_key=<?php print($keyval);?>" target='_blank'>Modify network structure</a>
   <li><a href="javascript:void(0);"
 NAME="Model Averaging Matrix" title="Model Averaging Matrix"
 onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
   <li><a href="javascript:void(0);"
 NAME="Parameters" title="Parameters"
 onClick=window.open("parameter_display.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>View parameters</a>  
+<li><a href="modify_structure_learning.php?My_key=<?php print($keyval);?>" target='_blank';>Modify structure learning settings</a>
  <li><a href="help.php" target='_blank'>Help</a> 
  <li><a href="../home.php">Home</a>
 </ul>
diff --git a/sourcecodes/layout.php~ b/sourcecodes/layout.php~
new file mode 100644
index 00000000..c9b86997
--- /dev/null
+++ b/sourcecodes/layout.php~
@@ -0,0 +1,123 @@
+<?php
+
+include("header_new.inc");
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+
+$dir="./data/";
+
+$vf1=$dir.$keyval."var.txt";
+$vf2=$dir.$keyval."varname.txt";
+$vf3=$dir.$keyval."vardata.txt";
+unlink($vf1);
+unlink($vf2);
+unlink($vf3);
+
+
+$radiovalue="Evidence";
+$valcompare="Evidence";
+
+
+  if(isset($_POST["Datatype"])) 
+ {
+
+ $radiovalue=$_POST["Datatype"];
+ if($radiovalue=="Evidence") $S1="checked=\"checked\"";
+ if($radiovalue=="Intervention") $S2="checked=\"checked\"";
+ }
+ else
+ {
+   $radiovalue="Evidence";
+   $S1="checked=\"checked\"";
+ }
+
+
+
+?>
+<script language="JavaScript">
+<!--
+function calcHeight()
+{
+  //find the height of the internal page
+  var the_height=
+    document.getElementById('the_iframe').contentWindow.
+      document.body.scrollHeight;
+
+  //change the height of the iframe
+  document.getElementById('the_iframe').height=
+      the_height;
+}
+//-->
+</script>
+<form  method="post" name="form"> 
+<table width="100%" align="center" style="background-color:" bordercolor=white border=0.5 cellspacing="0" cellpadding="0">
+ <tr valign=top>
+      <td colspan=4><hr size=3></td>
+  </tr>
+<tr >
+<th align=right> <h3>Prediction Mode:&nbsp</h3></th>
+  <td align=left>
+      <input name="Datatype" type="radio" value=<?php $radioval="Evidence"; echo $radioval; ?> checked <?php echo $S1; ?>" onClick="javascript:this.form.submit();">Evidence&nbsp;&nbsp;&nbsp;
+      <input name="Datatype" type="radio" value=<?php $radioval="Intervention"; echo $radioval; ?> <?php echo $S2; ?>" onClick="javascript:this.form.submit();"> Intervention
+      
+  </td>
+</tr>
+  <tr valign=top>
+      <td colspan=4><hr size=3></td>
+  </tr>
+
+</table>
+</form>
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+   <li><p>Selected mode:<br><?php print($radiovalue);?></p></li>
+   <li><p>Network ID:<br><?php print($keyval);?></p></li>
+</ul>
+
+<ul class="navbar">
+ <li><a href="clear.php?My_key=<?php print($keyval);?>" target='_blank'>Clear evidence</a>
+<li><a href="cv_predictions.php?My_key=<?php print($keyval);?>";>Cross validation and predictions</a>
+<li><a href="modify_edges.php?My_key=<?php print($keyval);?>" target='_blank'>Modify network structure</a>
+  <li><a href="javascript:void(0);"
+NAME="Model Averaging Matrix" title="Model Averaging Matrix"
+onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
+  <li><a href="javascript:void(0);"
+NAME="Parameters" title="Parameters"
+onClick=window.open("parameter_display.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>View parameters</a>  
+<li><a href="modify_structure_learning.php?My_key=<?php print($keyval);?>";>Modify structure learning settings</a>
+ <li><a href="help.php" target='_blank'>Help</a> 
+ <li><a href="../home.php">Home</a>
+</ul>
+
+<?php
+    //echo "Selected mode:";
+    //echo $radiovalue;
+
+
+
+if($radiovalue==$valcompare)
+{
+?>
+<div  id="outernew">
+
+<object type="text/html" data="network_layout_evd.php?My_key=<?php print($keyval);?>" style="width:3000; height:3000">
+<p>Error: Try again</p>
+</object>
+
+</div>
+<?php
+}
+else
+{
+?>
+<div  id="outernew">
+<object type="text/html" data="network_layout_inv.php?My_key=<?php print($keyval);?>" style="width:3000; height:3000">
+<p>Error: Try again</p>
+</object>
+
+</div>
+<?php
+}
+?>
+
diff --git a/sourcecodes/layout_example.php b/sourcecodes/layout_example.php
index a675da8c..ce2cb7ef 100644
--- a/sourcecodes/layout_example.php
+++ b/sourcecodes/layout_example.php
@@ -78,9 +78,7 @@ function calcHeight()
 
 <ul class="navbar">
  <li><a href="clear_example.php?My_key=<?php print($keyval);?>" target='_blank'>Clear evidence</a>
-<!---
 <li><a href="cv_predictions_example.php?My_key=<?php print($keyval);?>";>Cross validation and predictions</a>
---->
   <li><a href="javascript:void(0);"
 NAME="Model Averaging Matrix" title="Model Averaging Matrix"
 onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
diff --git a/sourcecodes/modify_edges.php b/sourcecodes/modify_edges.php
new file mode 100644
index 00000000..6d0c7838
--- /dev/null
+++ b/sourcecodes/modify_edges.php
@@ -0,0 +1,950 @@
+<?php 
+
+///////This code will allow users to group variables in tier. getcombineDescription() function combined all data and take you to "tier_description_processing_gom.php" for preparation of ban and whitelist //////////
+
+include("header_new.inc");
+include("runtime_check.php");
+include("input_validate.php");
+$keyval=$_GET["My_key"];
+
+$dir="./data/";
+
+$type_n=array();
+
+//Get number of tier data and key value for changes in number of tier
+
+if(isset($_POST["nm_tier"]))
+{
+   $type_n=explode("|",$_POST["nm_tier"]);
+}
+else if(isset($_POST["nm_parent"]))
+{
+   $type_n=explode("|",$_POST["nm_parent"]);
+}
+else if(isset($_POST["nm_k"]))
+{
+   $type_n=explode("|",$_POST["nm_k"]);
+}
+else if(isset($_POST["nm_thr"]))
+{
+    $type_n=explode("|",$_POST["nm_thr"]);
+}
+
+$parent_number=trim($type_n[0]);   
+$k_number=trim($type_n[1]);   
+$tier_number=trim($type_n[2]);   
+$structure_thr=trim($type_n[3]);   
+
+
+if($keyval=="")
+  $keyval=$type_n[4];
+
+
+if($parent_number=="")
+{
+   $parent_number=4;
+}
+
+if($k_number=="")
+{
+   $k_number=1;
+}
+
+if($tier_number=="")
+{
+  $tier_number=3;
+}
+if($structure_thr=="")
+{
+  $structure_thr=0.5;
+}
+
+
+
+$nf=$dir.$keyval."nnode.txt";
+$node=trim(file_get_contents("$nf"));
+$maxplist=$node-1;
+
+//print default number of parents
+$pfile=$dir.$keyval."parent.txt";
+$parentf=fopen($pfile,"w");
+fwrite($parentf,"$parent_number\n");
+
+//print default number of k for model averaging
+$kfile=$dir.$keyval."k.txt";
+$kf=fopen($kfile,"w");
+fwrite($kf,"$k_number\n");
+
+//print model averaging threshold
+$thrfile=$dir.$keyval."thr.txt";
+$kf=fopen($thrfile,"w");
+fwrite($kf,"$structure_thr\n");
+
+//////////////////Check execution time//////////////////////////////////////////////
+$keyval=valid_keyval($keyval);
+$runtime=exe_time($keyval,$parent_number,$k_number);
+
+//print("Runtime is $runtime");
+
+?>
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><p onClick="getcombineDescription(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a href="javascript:void(0)" >View modified structure </p>
+  <li><a href="javascript:void(0);"
+NAME="InputCheck" title="InputCheck"
+    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
+</ul>
+<ul class="navbar">
+  <li><a href="help.php#constraint_interface" target="_blank">How to use this page</a>
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+
+</ul>
+
+
+
+<div id="outernew">
+
+
+
+<?php
+
+
+if(isset($HTTP_POST_VARS["bantext"]))
+{
+   $ban_search=$HTTP_POST_VARS["searchkey"];
+}
+
+if(isset($HTTP_POST_VARS["whitetext"]))
+{
+   $white_search=$HTTP_POST_VARS["searchkey"];
+}
+
+?>
+
+<!DOCTYPE html> 
+<html> 
+<head> 
+<title>Drag and Drop test</title> 
+<style type="text/css"> 
+	#nodelist{
+		width:200px;
+		font-weight:bold;
+                border: 2px solid;
+		}
+        #tiers{
+                position:absolute;
+                left:215px;
+                white-space: nowrap; 
+                min-width: 3000px;
+                float:top;
+                }
+
+        #int_box1{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box2{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box3{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box4{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+
+        #outer_tier_desc{
+                margin-top: 100px;
+                }
+
+        #outer_tier_desc1{
+                width:2000px;
+                margin-top: 20px;
+                }
+
+	#outer_box_lists{
+                margin-top: 100px;
+		}
+	#nodelist2{
+		width:200px;
+		font-weight:bold;
+                border: 2px solid;
+                float:left;
+		}
+	#ban_outer {
+                position:absolute;
+                left: 215px;
+                width:449px;
+		border: 2px solid;
+                background-color:#C0C0C0;
+		font-weight:bold;
+                margin-left:15px;
+	}
+        #ban_from {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+        #ban_to {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+	#white_outer {
+                position:absolute;
+                left:700px;
+                width:449px;
+		border: 2px solid;
+                background-color:#C0C0C0;
+		font-weight:bold;
+	}
+        #white_from {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+        #white_to {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+
+
+	.tier {
+		width:200px;
+		border: 2px solid;
+		font-weight:bold;
+                float:left;
+                background-color:#FFFFFF;
+                margin-left:5px;
+	        display: inline-block;
+	}
+	.int {
+		border: 2px solid;
+		font-weight:bold;
+                float:left;
+                background-color:#FFFFFF;
+                margin-left:0px;
+	        display: inline-block;
+	}
+	.int1 {
+		border: 2px solid;
+                background-color:#FFFFFF;
+	        clear: left;
+	        float:left;
+                margin-left:0px;
+	        display: inline-block;
+	}
+	.node1 {
+		width:150px;
+		height:30px;
+		float:left;	
+		margin-left:10px;
+		margin-top:10px;
+		border: 2px dashed;
+                background-color:#C0C0C0;
+	}
+	.node2 {
+		width:150px;
+		height:30px;
+		float:left;	
+		margin-left:10px;
+		margin-top:10px;
+		border: 2px dashed;
+                background-color:#EAE822;
+	}
+
+</style> 
+
+<script type="text/javascript">
+
+//There are three groups of functions here:
+//The first group is involved with dragging and dropping nodes
+// between different locations.
+//The second group is involved with creating the divs that are needed
+// based on the number of nodes and number of tiers and organizing
+// them on the webpage.
+//The third group determines which divs the nodes are located in
+// to group the nodes into tiers and make ban and white lists.
+
+
+//Drag and drop functions:
+function drag(drop_target, e) {
+		e.dataTransfer.setData('Text', drop_target.id);
+		}
+
+function drop(drop_target, e) {
+		var id = e.dataTransfer.getData('Text');
+		drop_target.appendChild(document.getElementById(id));
+		e.preventDefault();
+	        } 
+
+function dropCopy(ev) {
+           ev.stopPropagation();
+           ev.preventDefault();
+           var src = ev.dataTransfer.getData("Text");
+           var orig = document.getElementById(src);
+           var pid = orig.parentNode.id;
+           var target_id = ev.target.id;
+           //document.write(pid);
+           if (pid != target_id){
+                var origclone = orig.cloneNode(true);
+                var newid = src+"a";
+                origclone.setAttribute('id',newid);
+                document.getElementById(pid).appendChild(origclone);
+                ev.target.appendChild(orig);
+           }
+           else {
+                document.write(pid,target_id);
+           }
+           return false; 
+}
+
+
+
+
+function loadFunction(nnodes,ntiers) {
+  //             makeNodeList(nnodes,'nodelist','tr');
+  //           makeNodes(nnodes,'nodelist');
+  //           makeTiers(nnodes,ntiers);
+             makeNodes(nnodes,'nodelist2','bw');
+	     //           makeTierDesc1(ntiers);
+	     //  makeTierDesc2(ntiers);
+             //makeTierDesc3(ntiers);
+             //makeTierDesc4(ntiers);
+             makeBWLists(nnodes);
+}
+
+
+//Function to make the NodeList. It is similar to the above function.
+function makeNodeList(nnodes,nlist) {
+               var element1 = document.createElement('div');
+               var newheight = 45*nnodes + 40;
+               newheight = newheight+'px'; 
+               element1.setAttribute('id',nlist);
+               element1.setAttribute('ondrop','drop(this, event)');
+               element1.setAttribute('ondragenter','return false');
+               element1.setAttribute('ondragover','return false');
+               element1.style.height=(newheight);
+               element1.innerHTML = "Nodes<br>";
+               document.getElementById('tier_box').appendChild(element1);
+}
+
+
+//This is the function that makes the nodes. It is called when the
+// page loads. The nodes are placed in the "nodelist" div.
+//Will need to mofidy this function to pass it a list of the node
+// names. The inner html is what is used in the later functions
+// that make the tier list, banlist, and white list.
+function makeNodes(nnodes,nlist,suffix) {
+
+<?php $xyz=1;
+$nm=$dir."$keyval"."name.txt";
+
+$namelist=file_get_contents("$nm");
+$str_arrname=array();
+$str_arrname=explode("\n",$namelist);
+$dataname=array();
+$dataname=explode("\t",$str_arrname[0]);
+             for ($i=1;$i<=$node;$i++){
+$ii=$i-1;
+$npr=trim($dataname[$ii]);
+?>             
+               i="<?php print($i);?>";
+               var newname = 'node'+i;
+               var element1 = document.createElement('div');
+               element1.setAttribute('draggable','true');
+               element1.setAttribute('class','node1');
+               element1.setAttribute('ondragstart','drag(this, event)');
+               element1.setAttribute('id',newname+suffix);
+               element1.setAttribute('ondragover','return false');
+               element1.innerHTML = "<?php print($npr);?>";
+               document.getElementById(nlist).appendChild(element1);
+           <?php  }
+          ?>
+     }
+
+
+//Function to make the Tiers. It is similar to the above function.
+function makeTiers(nnodes,ntiers) {
+           for (i=1;i<=ntiers;i++){
+               var newname = 'Tier'+i;
+               var element1 = document.createElement('div');
+               //var newpos = i*205;
+               //newpos = 'left: '+newpos+'px';
+               var newheight = nnodes*45 + 40;
+               newheight = newheight+'px';
+               //var newstyle = newpos + newheight;         
+               element1.setAttribute('class','tier');
+               element1.setAttribute('id',newname);
+               element1.setAttribute('ondrop','drop(this, event)');
+               element1.setAttribute('ondragenter','return false');
+               element1.setAttribute('ondragover','return false');
+               //element1.setAttribute('style',newpos);
+               element1.style.height=(newheight);
+               element1.innerHTML = newname +"<br>";
+               document.getElementById('tiers').appendChild(element1);
+            }
+               var newwidth = ntiers*205 + 20;
+               newwidth = newwidth+'px';
+               document.getElementById('tiers').style.width=newwidth;
+}
+
+
+
+function makeTierDesc1(ntiers) {
+               var element1 = document.createElement('div');
+               var newheight = '20px';
+               var newwidth = '220px';
+               element1.setAttribute('id','int_box1_first');
+               element1.setAttribute('class','int');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               //element1.innerHTML = "st<br>";
+               document.getElementById('int_box1').appendChild(element1);
+	       for (i=1;i<=ntiers;i++) {
+		 var newname = 'int_box1'+i;
+                 var newheight = '20px';
+                 var newwidth = '205px';
+                 //var newwidth = ntiers*65 + 20;
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "&nbsp&nbspTier"+i+"<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box1').appendChild(element1);
+	       }
+                 
+}
+function makeTierDesc2(ntiers) {
+               var element1 = document.createElement('div');
+               var newheight = '50px';
+               var newwidth = '220px';
+               element1.setAttribute('id','int_box2_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Are within tier <br>interactions allowed?<br>";
+               document.getElementById('int_box2').appendChild(element1);
+	       for (i=1;i<=ntiers;i++) {
+		 var newname = 'int_box2'+i;
+                 var newheight = '50px';
+                 var newwidth = '205px';
+                 //var newwidth = ntiers*65 + 20;
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box2').appendChild(element1);
+                       //create form to hold yes/no radio boxes
+                       var form1 = document.createElement('form');
+                       //form1.innerHTML = "Allow edges between nodes in Tier"+i+"?<br>";
+                       var radio_yes = document.createElement('input');
+                       radio_yes.setAttribute('type','radio');
+                       radio_yes.setAttribute('name',"r_yes_no_"+newname);
+                       radio_yes.setAttribute('id',"r_yes_"+newname);
+
+                       radio_yes.value = "r_yes_"+newname;
+                       radio_yes.setAttribute('checked','checked');
+                       form1.appendChild(radio_yes);
+                       var yes_label = document.createElement('label');
+                       yes_label.setAttribute('for',radio_yes.id);
+                       yes_label.innerHTML = "Yes&nbsp&nbsp&nbsp&nbsp&nbsp";
+                       form1.appendChild(yes_label);
+                       var radio_no = document.createElement('input');
+                       radio_no.setAttribute('type','radio');
+                       radio_no.setAttribute('name',"r_yes_no_"+newname);
+                       radio_no.setAttribute('id',"r_no_"+newname);
+                       radio_no.value = "r_no_"+newname;
+                       form1.appendChild(radio_no);
+                       var no_label = document.createElement('label');
+                       no_label.setAttribute('for',radio_no.id);
+                       no_label.innerHTML = "No<br>";
+                       form1.appendChild(no_label);
+                       element1.appendChild(form1);
+                     //  alert(radio_yes.value);
+                     //  alert(radio_yes.checked);
+                     //  alert(radio_no.value); 
+                     //  alert(radio_no.checked);
+	       }
+                 
+}
+
+function makeTierDesc3(ntiers) {
+               var element1 = document.createElement('div');
+               var newwidth = '220px';
+               var newheight = ntiers*10 + 25;
+               newheight = newheight + 'px'; 
+               //var newheight = '50px';
+               //var newwidth = '250px';
+               element1.setAttribute('id','int_box3_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Which tiers contain nodes that <br>can be the parents of this tier?<br>";
+               document.getElementById('int_box3').appendChild(element1);
+	       for (i=1;i<=ntiers;i++) {
+		 var newname = 'int_box3'+i;
+                 //var newheight = '50px';
+                 var newwidth = '205px';
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box3').appendChild(element1);
+                       //create form to hold allowed parents
+                       var form2 = document.createElement('form');
+                       //form2.innerHTML = "Which tiers can be the "+
+                       //    "parents of the nodes in Tier"+i+"?<br>";
+		       var k = 0;
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+			    k = k + 1;
+                             var pbox = document.createElement('input');
+                             pbox.setAttribute('type','checkbox');
+                            // pbox.setAttribute('name',"par_"+i);
+                             pbox.setAttribute('name',"par_"+i+"_"+j);
+                             pbox.setAttribute('id',"par_"+i+"_"+j);   
+                             pbox.value = "par_"+i+"_"+j;
+                             if (j<i) {
+                                pbox.setAttribute('checked','checked');
+                             }
+                             var plabel = document.createElement('label');
+                             plabel.setAttribute('for',pbox.id);
+                             if (k%2 == 0) {
+                             plabel.innerHTML = "Tier"+j+"&nbsp&nbsp<br>";
+                             } else {
+                             plabel.innerHTML = "Tier"+j+"&nbsp&nbsp";
+                             }
+                             form2.appendChild(pbox);
+                             form2.appendChild(plabel);  
+                           }
+                        }
+                       element1.appendChild(form2);
+	       }
+}
+
+function makeTierDesc4(ntiers) {
+               var element1 = document.createElement('div');
+               //var newheight = '50px';
+               var newwidth = '220px';
+               var newheight = ntiers*10 + 25;
+               newheight = newheight + 'px'; 
+               element1.setAttribute('id','int_box4_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Which tiers contain nodes that<br> can be the children of this tier?<br>";
+               document.getElementById('int_box4').appendChild(element1);
+	       for (i=1;i<=ntiers;i++) {
+		 var newname = 'int_box4'+i;
+                 //var newheight = '50px';
+                 //var newwidth = ntiers*65 + 20;
+                 var newwidth = '205px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box4').appendChild(element1);
+                       //create form to hold allowed children
+                       var form3 = document.createElement('form');
+                       //form3.innerHTML = "Nodes in which tiers can be <br>the children of this tier?<br>";
+                       var k = 0;
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+			     k = k + 1;
+                             var cbox = document.createElement('input');
+                             cbox.setAttribute('type','checkbox');
+                             //cbox.setAttribute('name',"child_"+i);
+                             cbox.setAttribute('name',"child_"+i+"_"+j);
+                             cbox.setAttribute('id',"child_"+i+"_"+j);
+
+                             cbox.value = "child_"+i+"_"+j;
+                             if (j>i) {
+                                cbox.setAttribute('checked','checked');
+                             }
+                             var clabel = document.createElement('label');
+                             clabel.setAttribute('for',cbox.id);
+                             if (k%2 == 0) {
+                                clabel.innerHTML = "Tier"+j+"&nbsp&nbsp<br>";
+			      } 
+			       else 
+                              {
+                               clabel.innerHTML = "Tier"+j+"&nbsp&nbsp";
+			      }
+                             form3.appendChild(cbox);
+                             form3.appendChild(clabel);  
+                           }
+                        }
+                       element1.appendChild(form3);
+	       }
+}
+
+
+
+//Old function to make section of page that allows for tier description.
+//Replaced by the four functions above.
+function makeTierDesc(ntiers) {
+                for (i=1;i<=ntiers;i++) {
+                       //var i = 2;
+                       var newname = 'desc_tier'+i;
+                       
+                       //create the outer division to hold the other boxes
+                       var out_div = document.createElement('div');
+                       out_div.setAttribute('id',newname);
+                       if (i==1) {
+                             out_div.innerHTML = "Tier"+i+"<br>";
+                       } else {
+                              out_div.innerHTML = "<br><br>Tier"+i+"<br>";
+                       }
+                       document.getElementById('outer_tier_desc').appendChild(out_div);
+
+                       //create form to hold yes/no radio boxes
+                       var form1 = document.createElement('form');
+                       form1.innerHTML = "Allow edges between nodes in Tier"+i+"?<br>";
+                       var radio_yes = document.createElement('input');
+                       radio_yes.setAttribute('type','radio');
+                       radio_yes.setAttribute('name',"r_yes_no_"+newname);
+                       radio_yes.setAttribute('id',"r_yes_"+newname);
+
+                       radio_yes.value = "r_yes_"+newname;
+                       radio_yes.setAttribute('checked','checked');
+                       form1.appendChild(radio_yes);
+                       var yes_label = document.createElement('label');
+                       yes_label.setAttribute('for',radio_yes.id);
+                       yes_label.innerHTML = "Yes    ";
+                       form1.appendChild(yes_label);
+                       var radio_no = document.createElement('input');
+                       radio_no.setAttribute('type','radio');
+                       radio_no.setAttribute('name',"r_yes_no_"+newname);
+                       radio_no.setAttribute('id',"r_no_"+newname);
+                       radio_no.value = "r_no_"+newname;
+                       form1.appendChild(radio_no);
+                       var no_label = document.createElement('label');
+                       no_label.setAttribute('for',radio_no.id);
+                       no_label.innerHTML = "No<br>";
+                       form1.appendChild(no_label);
+                       out_div.appendChild(form1);
+                     //  alert(radio_yes.value);
+                     //  alert(radio_yes.checked);
+                     //  alert(radio_no.value); 
+                     //  alert(radio_no.checked);
+
+
+                       //create form to hold allowed parents
+                       var form2 = document.createElement('form');
+                       form2.innerHTML = "Which tiers can be the "+
+                           "parents of the nodes in Tier"+i+"?<br>";
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+                             var pbox = document.createElement('input');
+                             pbox.setAttribute('type','checkbox');
+                            // pbox.setAttribute('name',"par_"+i);
+                             pbox.setAttribute('name',"par_"+i+"_"+j);
+                             pbox.setAttribute('id',"par_"+i+"_"+j);   
+                             pbox.value = "par_"+i+"_"+j;
+                             if (j<i) {
+                                pbox.setAttribute('checked','checked');
+                             }
+                             var plabel = document.createElement('label');
+                             plabel.setAttribute('for',pbox.id);
+                             plabel.innerHTML = "Tier"+j;
+                             form2.appendChild(pbox);
+                             form2.appendChild(plabel);  
+                           }
+                        }
+                       out_div.appendChild(form2);
+            
+                    //   alert(pbox.value);
+                   //    alert(pbox.checked);
+                      
+   
+
+                       //create form to hold allowed children
+                       var form3 = document.createElement('form');
+                       form3.innerHTML = "Which tiers can be the "+
+                           "children of the nodes in Tier"+i+"?<br>";
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+                             var cbox = document.createElement('input');
+                             cbox.setAttribute('type','checkbox');
+                             //cbox.setAttribute('name',"child_"+i);
+                             cbox.setAttribute('name',"child_"+i+"_"+j);
+                             cbox.setAttribute('id',"child_"+i+"_"+j);
+
+                             cbox.value = "child_"+i+"_"+j;
+                             if (j>i) {
+                                cbox.setAttribute('checked','checked');
+                             }
+                             var clabel = document.createElement('label');
+                             clabel.setAttribute('for',cbox.id);
+                             clabel.innerHTML = "Tier"+j;
+                             form3.appendChild(cbox);
+                             form3.appendChild(clabel);  
+                           }
+                        }
+                       out_div.appendChild(form3);
+                    //var break = document.createElement('div');
+                    //break.innerHTML = "<br>";
+                    //out_div.appendChild(break);
+                    //out_div.appendChild(break);
+                     //  alert(cbox.value);
+                      // alert(cbox.checked);
+
+                  }
+}
+
+//Function to give the divs for the ban and white lists the correct
+// dimensions.
+function makeBWLists(nnodes) {
+                var newheight = 45*nnodes + 40;
+                var nlheight = newheight+'px';
+                document.getElementById('nodelist2').style.height=nlheight;
+                var inheight = newheight*2; 
+                var outheight = inheight + 50;
+                inheight=inheight+'px';
+                outheight = outheight+'px';
+                document.getElementById('ban_outer').style.height=outheight;
+                document.getElementById('white_outer').style.height=outheight;
+                document.getElementById('ban_from').style.height=inheight;
+                document.getElementById('ban_to').style.height=inheight;
+                document.getElementById('white_from').style.height=inheight;
+                document.getElementById('white_to').style.height=inheight;
+          
+}
+
+
+//Functions that get the locations of the nodes to group the
+// nodes into tiers and make ban and white lists.
+//Will probably need to add a function to get the tier description information.
+//Might be able to do that with just php though?
+function getNodesInTiers(ntiers) {
+                output = ntiers+",\n";
+                for (i=1;i<=ntiers;i++){
+                var newname = 'Tier'+i;
+                children = document.getElementById(newname).childNodes;
+                temp = children.length - 2;
+                temp = newname + ",\t" +temp+ ",\t"
+                for (j=2;j<children.length;j++){
+                temp = temp + children[j].innerHTML + ",\t"
+                }
+                output = output + temp +"\n"
+                }
+                
+                
+                return output;
+                
+               // window.open("http://compbio.uthsc.edu/BNServer/tier.php?tier="+output,"Ratting","width=950,height=270,0,status=0,");
+                
+}
+
+function getNodesInList(from_div,to_div) {
+                children_from = document.getElementById(from_div).childNodes;
+                children_to = document.getElementById(to_div).childNodes;
+                if(children_from.length == children_to.length){
+                    temp = "";                
+                    for (i=2;i<children_from.length;i++){
+                    temp = temp+children_from[i].innerHTML;
+                    temp = temp+",\t"+children_to[i].innerHTML+",\n";
+                    }
+                  
+    
+
+                 }
+                 else 
+                 {
+                   alert('Error in node list');
+                   temp="";
+                 }
+               return temp;
+}
+
+
+//Functions that get the description of the tiers. 
+function getDescribeTiers(ntiers) {
+              output = "";
+              for (i=1;i<=ntiers;i++) {
+               temp="";
+               var newname = 'int_box2'+i;
+                
+               var temp_id_yes="r_yes_"+newname;
+               var temp_id_no="r_no_"+newname;
+               
+                temp_yes = document.getElementById(temp_id_yes);
+                temp_no = document.getElementById(temp_id_no);
+
+               // temp = temp + temp_yes.value + ",\t"
+                temp = temp + temp_yes.checked + ",\t"
+
+               // temp = temp + temp_no.value + ",\t"
+                temp = temp + temp_no.checked + ",\t"
+ 
+                for (j=1;j<=ntiers;j++) {
+                    if(j!=i)
+                    {
+                      var pbox_id="par_"+i+"_"+j;
+                      var cbox_id="child_"+i+"_"+j;
+                      temp_p = document.getElementById(pbox_id);
+                      temp_c = document.getElementById(cbox_id); 
+  
+                      temp = temp + temp_p.checked + ",\t"
+
+                      temp = temp + temp_c.checked + ",\t"
+
+                      
+                     }
+                }   
+               // alert(temp); 
+                
+                output = output + temp +"\n"
+               
+}
+              
+
+              //  window.open("http://compbio.uthsc.edu/BNServer/tierdescription.php?tierdesc="+output,"Ratting","width=950,height=270,0,status=0,");
+              return output;
+                
+}
+
+
+//Combined all three function together and then execute structure learning
+
+function getcombineDescription(ntiers,ban_from,ban_to,white_from,white_to,keyv)
+{
+  //  var tier=getNodesInTiers(ntiers);
+  //  var tierdesc=getDescribeTiers(ntiers);
+  ntiers = 1;
+  var tier = "";
+  var tierdesc = "";
+  var ban=getNodesInList(ban_from,ban_to);
+  var white=getNodesInList(white_from,white_to);
+  window.open("modify_edges_processing.php?ban="+ban+"&white="+white +"&My_key="+keyv,'_self',false);
+}
+
+function clearBWLists()
+{
+  var element = document.getElementById('ban_from');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('ban_to');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('white_from');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('white_to');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+}
+
+
+
+
+
+</script> 
+</head> 
+
+
+<script type="text/javascript">
+     var nnodes =<?php print($node);?>;
+     var ntiers = <?php print($tier_number);?>;
+</script>
+
+<body onload="loadFunction(nnodes,ntiers)">
+
+
+</br>
+
+
+<!---
+        <p><h3>2. Assign variables to tiers:<br></h3>
+         </p>
+        <br>
+        <div id="tier_box">
+        <div id="tiers"></div>
+       
+       </div>
+
+
+       <div id="outer_tier_desc1">
+       <p><h3>3. Define interactions allowed between tiers:<br></h3> 
+       </p>
+       <br>
+       <div id="int_box1">
+       </div>
+       <br>
+       <div id="int_box2">
+       </div>
+       <br>
+       <div id="int_box3">
+       </div>
+       <br>
+       <div id="int_box4">
+       </div>
+       </div>
+       <br>
+       <br>
+       <br>
+
+--->
+       <div id="outer_box_lists">
+       <p><h3>Specify edges to remove or add:<br></h3>
+       </p>         
+       <br>
+       <div><input type="button" value="Clear lists of banned and required edges" onClick="clearBWLists()"/></div><br>
+        <div id="nodelist2" ondrop="return false"
+        ondragcenter="return false" ondragover="return false" >Nodes<br>
+        </div>
+         
+        <div id="ban_outer">Edges to remove<br>
+        <div id="ban_from" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">From<br></div>
+        <div id="ban_to" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">To<br></div>
+        </div>
+        <div id="white_outer">Edges to add<br>
+        <div id="white_from" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">From<br></div>
+        <div id="white_to" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">To<br></div>
+        </div>
+        </div>
+
+
+
+       
+        <br>
+        <br>
+   
+        
+
+</body> 
+</div>
+</html>
+
diff --git a/sourcecodes/modify_edges_processing.php b/sourcecodes/modify_edges_processing.php
new file mode 100644
index 00000000..98bf3f87
--- /dev/null
+++ b/sourcecodes/modify_edges_processing.php
@@ -0,0 +1,234 @@
+<?php
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+
+function get_tier($keyval)
+{
+
+$tier=trim($_GET['tier']);
+$dir="./data/";
+$tf=$dir.$keyval."del_var.txt";
+$fpvar = fopen("$tf","w");
+
+fwrite($fpvar,"$tier");
+fclose($fpvar);
+}
+
+
+function enter_ban_list($t1,$s1,$t2,$s2,$tier_d,$fpvar)
+{
+  
+   for ($i=0;$i<$s1;$i++)
+   {
+        $data_val_1=$tier_d[$t1][$i];
+           
+        for ($j=0;$j<$s2;$j++)
+        {
+            $data_val_2=$tier_d[$t2][$j];
+            if($data_val_1!=$data_val_2)
+            {
+               
+               fprintf($fpvar,"%s\t%s\n",$data_val_1,$data_val_2); 
+              
+
+            }
+   
+        }
+         
+   }
+  
+
+}
+
+
+
+function describe_tier($fpvar,$keyval)
+{
+
+
+$tierdesc=trim($_GET['tierdesc']);
+$dir="./data/";
+$tf=$dir.$keyval."tier.txt";
+$tier=file_get_contents("$tf");
+
+$tier_data=array();
+$tier_size=array();
+$tier_d=array();
+$tier_data=explode(",",$tier);
+
+$tn=$tier_data[0];
+$count=0;
+
+for ($i=0;$i<$tn;$i++)
+{
+    $count+=2;
+    $tier_size[$i]=$tier_data[$count];
+         
+    $rs=$tier_size[$i];
+    for ($j=0;$j<$rs;$j++)
+    {
+     $count++;  
+     $tier_d[$i][$j]=$tier_data[$count];
+     
+    
+    }
+   
+}
+
+
+
+$data=array();
+$data=explode(",",$tierdesc);
+$n=count($data);
+$nn=0;
+$di=0;
+for ($i=0;$i<$tn;$i++)
+{
+
+$d_y=trim($data[$di]);
+$di++;
+$d_n=trim($data[$di]);
+
+if($d_n=="true") //put data in banlist
+{
+   $s1=$tier_size[$i];
+   enter_ban_list($i,$s1,$i,$s1,$tier_d,$fpvar);
+
+}
+$di++;
+
+
+   for ($j=0;$j<$tn;$j++)
+   {
+      if($j!=$i)
+      {
+        $p_d=trim($data[$di]);
+        $di++;
+    
+        if($p_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$j];
+             $s2=$tier_size[$i];
+             //echo $tier_size[$j];
+            enter_ban_list($j,$s1,$i,$s2,$tier_d,$fpvar);
+        }
+    
+
+
+        $c_d=trim($data[$di]);
+        $di++;
+        if($c_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$i];
+             $s2=$tier_size[$j];
+                  // echo $tier_size[$j];
+            enter_ban_list($i,$s1,$j,$s2,$tier_d,$fpvar);
+        }
+
+ 
+      }
+   }
+
+}
+
+
+}
+
+
+function banlist($fpvar)
+{
+$ban=trim($_GET['ban']);
+$data=array();
+$data=explode(",",$ban);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2)
+{
+	$ii=$i+1;
+	$d1=trim($data[$i]);
+	$d2=trim($data[$ii]);
+
+	if($d1!="" && $d2!="")
+	{
+  		fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  		$nn++;
+	}
+
+}
+
+}
+
+function whitelist($fpvar)
+{
+
+$white=trim($_GET['white']);
+
+
+
+$data=array();
+$data=explode(",",$white);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2){
+$ii=$i+1;
+$d1=trim($data[$i]);
+$d2=trim($data[$ii]);
+
+if($d1!="" && $d2!="")
+{
+  fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  $nn++;
+}
+
+}
+
+
+}
+
+
+/////////////////////Call functions//////////////////////
+
+
+
+$dir="./data/";
+
+$sid1=$dir.$keyval."del_edge";
+$sid2=$dir.$keyval."add_edge";
+
+$Textban=$sid1.".txt";
+$Textwhite=$sid2.".txt";
+$fpb = fopen($Textban,"w");
+$fpw = fopen($Textwhite,"w");
+$datpost="From\tTo\n";
+fwrite($fpb,"$datpost");
+fwrite($fpw,"$datpost");
+
+get_tier($keyval);
+
+
+//describe_tier($fpb,$keyval);
+banlist($fpb);
+whitelist($fpw);
+
+
+$oldkey=$keyval;
+
+///Generate new random key
+$alphas=array();
+$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
+
+$al1=rand(0,51);
+$al2=rand(0,51);
+$al3=rand(0,51);
+
+$alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
+$keyval=$alpha;
+
+shell_exec('./run_scripts/run_mod_edges '.$oldkey.' '.$keyval);
+
+
+////////////////////////////////////execute structurelearning/////////////////////////////////////////////////////////////////////////////////////////////
+?>
+<script>
+window.open("graphviz_structure.php?My_key=<?php print($keyval);?>",'_self',false);
+</script>
\ No newline at end of file
diff --git a/sourcecodes/modify_structure_learning.php b/sourcecodes/modify_structure_learning.php
new file mode 100644
index 00000000..67a065d4
--- /dev/null
+++ b/sourcecodes/modify_structure_learning.php
@@ -0,0 +1,233 @@
+<?php
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+
+function get_tier($keyval)
+{
+
+$tier=trim($_GET['tier']);
+$dir="./data/";
+$tf=$dir.$keyval."del_var.txt";
+$fpvar = fopen("$tf","w");
+
+fwrite($fpvar,"$tier");
+fclose($fpvar);
+}
+
+
+function enter_ban_list($t1,$s1,$t2,$s2,$tier_d,$fpvar)
+{
+  
+   for ($i=0;$i<$s1;$i++)
+   {
+        $data_val_1=$tier_d[$t1][$i];
+           
+        for ($j=0;$j<$s2;$j++)
+        {
+            $data_val_2=$tier_d[$t2][$j];
+            if($data_val_1!=$data_val_2)
+            {
+               
+               fprintf($fpvar,"%s\t%s\n",$data_val_1,$data_val_2); 
+              
+
+            }
+   
+        }
+         
+   }
+  
+
+}
+
+
+
+function describe_tier($fpvar,$keyval)
+{
+
+
+$tierdesc=trim($_GET['tierdesc']);
+$dir="./data/";
+$tf=$dir.$keyval."tier.txt";
+$tier=file_get_contents("$tf");
+
+$tier_data=array();
+$tier_size=array();
+$tier_d=array();
+$tier_data=explode(",",$tier);
+
+$tn=$tier_data[0];
+$count=0;
+
+for ($i=0;$i<$tn;$i++)
+{
+    $count+=2;
+    $tier_size[$i]=$tier_data[$count];
+         
+    $rs=$tier_size[$i];
+    for ($j=0;$j<$rs;$j++)
+    {
+     $count++;  
+     $tier_d[$i][$j]=$tier_data[$count];
+     
+    
+    }
+   
+}
+
+
+
+$data=array();
+$data=explode(",",$tierdesc);
+$n=count($data);
+$nn=0;
+$di=0;
+for ($i=0;$i<$tn;$i++)
+{
+
+$d_y=trim($data[$di]);
+$di++;
+$d_n=trim($data[$di]);
+
+if($d_n=="true") //put data in banlist
+{
+   $s1=$tier_size[$i];
+   enter_ban_list($i,$s1,$i,$s1,$tier_d,$fpvar);
+
+}
+$di++;
+
+
+   for ($j=0;$j<$tn;$j++)
+   {
+      if($j!=$i)
+      {
+        $p_d=trim($data[$di]);
+        $di++;
+    
+        if($p_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$j];
+             $s2=$tier_size[$i];
+             //echo $tier_size[$j];
+            enter_ban_list($j,$s1,$i,$s2,$tier_d,$fpvar);
+        }
+    
+
+
+        $c_d=trim($data[$di]);
+        $di++;
+        if($c_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$i];
+             $s2=$tier_size[$j];
+                  // echo $tier_size[$j];
+            enter_ban_list($i,$s1,$j,$s2,$tier_d,$fpvar);
+        }
+
+ 
+      }
+   }
+
+}
+
+
+}
+
+
+function banlist($fpvar)
+{
+$ban=trim($_GET['ban']);
+$data=array();
+$data=explode(",",$ban);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2)
+{
+	$ii=$i+1;
+	$d1=trim($data[$i]);
+	$d2=trim($data[$ii]);
+
+	if($d1!="" && $d2!="")
+	{
+  		fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  		$nn++;
+	}
+
+}
+
+}
+
+function whitelist($fpvar)
+{
+
+$white=trim($_GET['white']);
+
+
+
+$data=array();
+$data=explode(",",$white);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2){
+$ii=$i+1;
+$d1=trim($data[$i]);
+$d2=trim($data[$ii]);
+
+if($d1!="" && $d2!="")
+{
+  fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  $nn++;
+}
+
+}
+
+
+}
+
+
+/////////////////////Call functions//////////////////////
+
+
+
+$dir="./data/";
+
+//$sid1=$dir.$keyval."ban";
+//$sid2=$dir.$keyval."white";
+
+//$Textban=$sid1.".txt";
+//$Textwhite=$sid2.".txt";
+//$fpb = fopen($Textban,"w");
+//$fpw = fopen($Textwhite,"w");
+//$datpost="From\tTo\n";
+//fwrite($fpb,"$datpost");
+//fwrite($fpw,"$datpost");
+
+get_tier($keyval);
+
+$oldkey=$keyval;
+
+///Generate new random key
+$alphas=array();
+$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
+
+$al1=rand(0,51);
+$al2=rand(0,51);
+$al3=rand(0,51);
+
+$alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
+$keyval=$alpha;
+
+shell_exec('./run_scripts/run_mod_str '.$oldkey.' '.$keyval);
+shell_exec('./run_scripts/run_prep_input '.$keyval);
+
+//describe_tier($fpb,$keyval);
+//banlist($fpb);
+//whitelist($fpw);
+
+
+////////////////////////////////////execute structurelearning/////////////////////////////////////////////////////////////////////////////////////////////
+?>
+<script>
+window.open("bn_after_upload_gom.php?My_key=<?php print($keyval);?>",'_self',false);
+</script>
\ No newline at end of file
diff --git a/sourcecodes/remove_variables.php b/sourcecodes/remove_variables.php
new file mode 100644
index 00000000..c88bc29e
--- /dev/null
+++ b/sourcecodes/remove_variables.php
@@ -0,0 +1,978 @@
+<?php 
+
+///////This code will allow users to group variables in tier. getcombineDescription() function combined all data and take you to "tier_description_processing_gom.php" for preparation of ban and whitelist //////////
+
+include("header_new.inc");
+include("runtime_check.php");
+include("input_validate.php");
+$keyval=$_GET["My_key"];
+
+$dir="./data/";
+
+$type_n=array();
+
+//Get number of tier data and key value for changes in number of tier
+
+if(isset($_POST["nm_tier"]))
+{
+   $type_n=explode("|",$_POST["nm_tier"]);
+}
+else if(isset($_POST["nm_parent"]))
+{
+   $type_n=explode("|",$_POST["nm_parent"]);
+}
+else if(isset($_POST["nm_k"]))
+{
+   $type_n=explode("|",$_POST["nm_k"]);
+}
+else if(isset($_POST["nm_thr"]))
+{
+    $type_n=explode("|",$_POST["nm_thr"]);
+}
+
+$parent_number=trim($type_n[0]);   
+$k_number=trim($type_n[1]);   
+$tier_number=trim($type_n[2]);   
+$structure_thr=trim($type_n[3]);   
+
+
+if($keyval=="")
+  $keyval=$type_n[4];
+
+
+if($parent_number=="")
+{
+   $parent_number=4;
+}
+
+if($k_number=="")
+{
+   $k_number=1;
+}
+
+if($tier_number=="")
+{
+  $tier_number=3;
+}
+if($structure_thr=="")
+{
+  $structure_thr=0.5;
+}
+
+
+
+$nf=$dir.$keyval."nnode.txt";
+$node=trim(file_get_contents("$nf"));
+$maxplist=$node-1;
+
+//print default number of parents
+$pfile=$dir.$keyval."parent.txt";
+$parentf=fopen($pfile,"w");
+fwrite($parentf,"$parent_number\n");
+
+//print default number of k for model averaging
+$kfile=$dir.$keyval."k.txt";
+$kf=fopen($kfile,"w");
+fwrite($kf,"$k_number\n");
+
+//print model averaging threshold
+$thrfile=$dir.$keyval."thr.txt";
+$kf=fopen($thrfile,"w");
+fwrite($kf,"$structure_thr\n");
+
+//////////////////Check execution time//////////////////////////////////////////////
+$keyval=valid_keyval($keyval);
+$runtime=exe_time($keyval,$parent_number,$k_number);
+
+//print("Runtime is $runtime");
+
+?>
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><p onClick="getcombineDescriptionDefault(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a href="javascript:void(0)" >Perform structure learning with default settings</a></p>
+  <li><p onClick="getcombineDescription(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a href="javascript:void(0)" >Go to structural constraint interface</a></p>
+  <li><a href="javascript:void(0);"
+NAME="InputCheck" title="InputCheck"
+    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
+</ul>
+<ul class="navbar">
+  <li><a href="help.php#constraint_interface" target="_blank">How to use this page</a>
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+
+</ul>
+
+<div id="outernew">
+
+<?php
+
+
+if(isset($HTTP_POST_VARS["bantext"]))
+{
+   $ban_search=$HTTP_POST_VARS["searchkey"];
+}
+
+if(isset($HTTP_POST_VARS["whitetext"]))
+{
+   $white_search=$HTTP_POST_VARS["searchkey"];
+}
+
+?>
+
+<!DOCTYPE html> 
+<html> 
+<head> 
+<title>Drag and Drop test</title> 
+<style type="text/css"> 
+	#nodelist{
+		width:200px;
+		font-weight:bold;
+                border: 2px solid;
+		}
+        #tiers{
+                position:absolute;
+                left:215px;
+                white-space: nowrap; 
+                min-width: 3000px;
+                float:top;
+                }
+
+        #int_box1{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box2{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box3{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box4{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+
+        #outer_tier_desc{
+                margin-top: 100px;
+                }
+
+        #outer_tier_desc1{
+                width:2000px;
+                margin-top: 20px;
+                }
+
+	#outer_box_lists{
+                margin-top: 100px;
+		}
+	#nodelist2{
+		width:200px;
+		font-weight:bold;
+                border: 2px solid;
+                float:left;
+		}
+	#ban_outer {
+                position:absolute;
+                left: 215px;
+                width:449px;
+		border: 2px solid;
+                background-color:#C0C0C0;
+		font-weight:bold;
+                margin-left:15px;
+	}
+        #ban_from {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+        #ban_to {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+	#white_outer {
+                position:absolute;
+                left:700px;
+                width:449px;
+		border: 2px solid;
+                background-color:#C0C0C0;
+		font-weight:bold;
+	}
+        #white_from {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+        #white_to {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+
+
+	.tier {
+		width:200px;
+		border: 2px solid;
+		font-weight:bold;
+                float:left;
+                background-color:#FFFFFF;
+                margin-left:5px;
+	        display: inline-block;
+	}
+	.int {
+		border: 2px solid;
+		font-weight:bold;
+                float:left;
+                background-color:#FFFFFF;
+                margin-left:0px;
+	        display: inline-block;
+	}
+	.int1 {
+		border: 2px solid;
+                background-color:#FFFFFF;
+	        clear: left;
+	        float:left;
+                margin-left:0px;
+	        display: inline-block;
+	}
+	.node1 {
+		width:150px;
+		height:30px;
+		float:left;	
+		margin-left:10px;
+		margin-top:10px;
+		border: 2px dashed;
+                background-color:#C0C0C0;
+	}
+	.node2 {
+		width:150px;
+		height:30px;
+		float:left;	
+		margin-left:10px;
+		margin-top:10px;
+		border: 2px dashed;
+                background-color:#EAE822;
+	}
+
+</style> 
+
+<script type="text/javascript">
+
+//There are three groups of functions here:
+//The first group is involved with dragging and dropping nodes
+// between different locations.
+//The second group is involved with creating the divs that are needed
+// based on the number of nodes and number of tiers and organizing
+// them on the webpage.
+//The third group determines which divs the nodes are located in
+// to group the nodes into tiers and make ban and white lists.
+
+
+//Drag and drop functions:
+function drag(drop_target, e) {
+		e.dataTransfer.setData('Text', drop_target.id);
+		}
+
+function drop(drop_target, e) {
+		var id = e.dataTransfer.getData('Text');
+		drop_target.appendChild(document.getElementById(id));
+		e.preventDefault();
+	        } 
+
+function dropCopy(ev) {
+           ev.stopPropagation();
+           ev.preventDefault();
+           var src = ev.dataTransfer.getData("Text");
+           var orig = document.getElementById(src);
+           var pid = orig.parentNode.id;
+           var target_id = ev.target.id;
+           //document.write(pid);
+           if (pid != target_id){
+                var origclone = orig.cloneNode(true);
+                var newid = src+"a";
+                origclone.setAttribute('id',newid);
+                document.getElementById(pid).appendChild(origclone);
+                ev.target.appendChild(orig);
+           }
+           else {
+                document.write(pid,target_id);
+           }
+           return false; 
+}
+
+
+
+
+function loadFunction(nnodes,ntiers) {
+             makeNodeList(nnodes,'nodelist','tr');
+             makeNodes(nnodes,'nodelist');
+             makeTiers(nnodes,ntiers);
+             makeNodes(nnodes,'nodelist2','bw');
+             makeTierDesc1(ntiers);
+             makeTierDesc2(ntiers);
+             makeTierDesc3(ntiers);
+             makeTierDesc4(ntiers);
+             makeBWLists(nnodes);
+}
+
+
+//Function to make the NodeList. It is similar to the above function.
+function makeNodeList(nnodes,nlist) {
+               var element1 = document.createElement('div');
+               var newheight = 45*nnodes + 40;
+               newheight = newheight+'px';                  
+               element1.setAttribute('id',nlist);
+               element1.setAttribute('ondrop','drop(this, event)');
+               element1.setAttribute('ondragenter','return false');
+               element1.setAttribute('ondragover','return false');
+               element1.style.height=(newheight);
+               element1.innerHTML = "Variables to use<br>";
+               document.getElementById('tier_box').appendChild(element1);
+}
+
+
+//This is the function that makes the nodes. It is called when the
+// page loads. The nodes are placed in the "nodelist" div.
+//Will need to mofidy this function to pass it a list of the node
+// names. The inner html is what is used in the later functions
+// that make the tier list, banlist, and white list.
+function makeNodes(nnodes,nlist,suffix) {
+
+<?php $xyz=1;
+$nm=$dir."$keyval"."name.txt";
+
+$namelist=file_get_contents("$nm");
+$str_arrname=array();
+$str_arrname=explode("\n",$namelist);
+$dataname=array();
+$dataname=explode("\t",$str_arrname[0]);
+             for ($i=1;$i<=$node;$i++){
+$ii=$i-1;
+$npr=trim($dataname[$ii]);
+?>             
+               i="<?php print($i);?>";
+               var newname = 'node'+i;
+               var element1 = document.createElement('div');
+               element1.setAttribute('draggable','true');
+               element1.setAttribute('class','node1');
+               element1.setAttribute('ondragstart','drag(this, event)');
+               element1.setAttribute('id',newname+suffix);
+               element1.setAttribute('ondragover','return false');
+               element1.innerHTML = "<?php print($npr);?>";
+               document.getElementById(nlist).appendChild(element1);
+           <?php  }
+          ?>
+     }
+
+
+//Function to make the Tiers. It is similar to the above function.
+function makeTiers(nnodes,ntiers) {
+  //ntiers = 1;
+  //         for (i=1;i<=ntiers;i++){
+             i = 1;
+	     //var newname = 'Tier'+i;
+	     var newname = 'Variables to remove';
+               var element1 = document.createElement('div');
+               //var newpos = i*205;
+               //newpos = 'left: '+newpos+'px';
+               var newheight = nnodes*45 + 40;
+               newheight = newheight+'px';
+               //var newstyle = newpos + newheight;         
+               element1.setAttribute('class','tier');
+               element1.setAttribute('id',newname);
+               element1.setAttribute('ondrop','drop(this, event)');
+               element1.setAttribute('ondragenter','return false');
+               element1.setAttribute('ondragover','return false');
+               //element1.setAttribute('style',newpos);
+               element1.style.height=(newheight);
+               element1.innerHTML = newname +"<br>";
+               document.getElementById('tiers').appendChild(element1);
+	       //   }
+               var newwidth = ntiers*205 + 20;
+               newwidth = newwidth+'px';
+               document.getElementById('tiers').style.width=newwidth;
+}
+
+
+
+function makeTierDesc1(ntiers) {
+               var element1 = document.createElement('div');
+               var newheight = '20px';
+               var newwidth = '220px';
+               element1.setAttribute('id','int_box1_first');
+               element1.setAttribute('class','int');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               //element1.innerHTML = "st<br>";
+               document.getElementById('int_box1').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+               i = 1;
+		 var newname = 'int_box1'+i;
+                 var newheight = '20px';
+                 var newwidth = '205px';
+                 //var newwidth = ntiers*65 + 20;
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "&nbsp&nbspTier"+i+"<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box1').appendChild(element1);
+		 //}
+                 
+}
+function makeTierDesc2(ntiers) {
+               var element1 = document.createElement('div');
+               var newheight = '50px';
+               var newwidth = '220px';
+               element1.setAttribute('id','int_box2_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Are within tier <br>interactions allowed?<br>";
+               document.getElementById('int_box2').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+	       i = 1;
+		 var newname = 'int_box2'+i;
+                 var newheight = '50px';
+                 var newwidth = '205px';
+                 //var newwidth = ntiers*65 + 20;
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box2').appendChild(element1);
+                       //create form to hold yes/no radio boxes
+                       var form1 = document.createElement('form');
+                       //form1.innerHTML = "Allow edges between nodes in Tier"+i+"?<br>";
+                       var radio_yes = document.createElement('input');
+                       radio_yes.setAttribute('type','radio');
+                       radio_yes.setAttribute('name',"r_yes_no_"+newname);
+                       radio_yes.setAttribute('id',"r_yes_"+newname);
+
+                       radio_yes.value = "r_yes_"+newname;
+                       radio_yes.setAttribute('checked','checked');
+                       form1.appendChild(radio_yes);
+                       var yes_label = document.createElement('label');
+                       yes_label.setAttribute('for',radio_yes.id);
+                       yes_label.innerHTML = "Yes&nbsp&nbsp&nbsp&nbsp&nbsp";
+                       form1.appendChild(yes_label);
+                       var radio_no = document.createElement('input');
+                       radio_no.setAttribute('type','radio');
+                       radio_no.setAttribute('name',"r_yes_no_"+newname);
+                       radio_no.setAttribute('id',"r_no_"+newname);
+                       radio_no.value = "r_no_"+newname;
+                       form1.appendChild(radio_no);
+                       var no_label = document.createElement('label');
+                       no_label.setAttribute('for',radio_no.id);
+                       no_label.innerHTML = "No<br>";
+                       form1.appendChild(no_label);
+                       element1.appendChild(form1);
+                     //  alert(radio_yes.value);
+                     //  alert(radio_yes.checked);
+                     //  alert(radio_no.value); 
+                     //  alert(radio_no.checked);
+		       //}
+                 
+}
+
+function makeTierDesc3(ntiers) {
+               var element1 = document.createElement('div');
+               var newwidth = '220px';
+               var newheight = ntiers*10 + 25;
+               newheight = newheight + 'px'; 
+               //var newheight = '50px';
+               //var newwidth = '250px';
+               element1.setAttribute('id','int_box3_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Which tiers contain nodes that <br>can be the parents of this tier?<br>";
+               document.getElementById('int_box3').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+               i = 1;
+		 var newname = 'int_box3'+i;
+                 //var newheight = '50px';
+                 var newwidth = '205px';
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box3').appendChild(element1);
+                       //create form to hold allowed parents
+                       var form2 = document.createElement('form');
+                       //form2.innerHTML = "Which tiers can be the "+
+                       //    "parents of the nodes in Tier"+i+"?<br>";
+		       var k = 0;
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+			    k = k + 1;
+                             var pbox = document.createElement('input');
+                             pbox.setAttribute('type','checkbox');
+                            // pbox.setAttribute('name',"par_"+i);
+                             pbox.setAttribute('name',"par_"+i+"_"+j);
+                             pbox.setAttribute('id',"par_"+i+"_"+j);   
+                             pbox.value = "par_"+i+"_"+j;
+                             if (j<i) {
+                                pbox.setAttribute('checked','checked');
+                             }
+                             var plabel = document.createElement('label');
+                             plabel.setAttribute('for',pbox.id);
+                             if (k%2 == 0) {
+                             plabel.innerHTML = "Tier"+j+"&nbsp&nbsp<br>";
+                             } else {
+                             plabel.innerHTML = "Tier"+j+"&nbsp&nbsp";
+                             }
+                             form2.appendChild(pbox);
+                             form2.appendChild(plabel);  
+                           }
+                        }
+                       element1.appendChild(form2);
+		       //}
+}
+
+function makeTierDesc4(ntiers) {
+               var element1 = document.createElement('div');
+               //var newheight = '50px';
+               var newwidth = '220px';
+               var newheight = ntiers*10 + 25;
+               newheight = newheight + 'px'; 
+               element1.setAttribute('id','int_box4_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Which tiers contain nodes that<br> can be the children of this tier?<br>";
+               document.getElementById('int_box4').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+	       i = 1;
+		 var newname = 'int_box4'+i;
+                 //var newheight = '50px';
+                 //var newwidth = ntiers*65 + 20;
+                 var newwidth = '205px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box4').appendChild(element1);
+                       //create form to hold allowed children
+                       var form3 = document.createElement('form');
+                       //form3.innerHTML = "Nodes in which tiers can be <br>the children of this tier?<br>";
+                       var k = 0;
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+			     k = k + 1;
+                             var cbox = document.createElement('input');
+                             cbox.setAttribute('type','checkbox');
+                             //cbox.setAttribute('name',"child_"+i);
+                             cbox.setAttribute('name',"child_"+i+"_"+j);
+                             cbox.setAttribute('id',"child_"+i+"_"+j);
+
+                             cbox.value = "child_"+i+"_"+j;
+                             if (j>i) {
+                                cbox.setAttribute('checked','checked');
+                             }
+                             var clabel = document.createElement('label');
+                             clabel.setAttribute('for',cbox.id);
+                             if (k%2 == 0) {
+                                clabel.innerHTML = "Tier"+j+"&nbsp&nbsp<br>";
+			      } 
+			       else 
+                              {
+                               clabel.innerHTML = "Tier"+j+"&nbsp&nbsp";
+			      }
+                             form3.appendChild(cbox);
+                             form3.appendChild(clabel);  
+                           }
+                        }
+                       element1.appendChild(form3);
+		       //}
+}
+
+
+
+//Old function to make section of page that allows for tier description.
+//Replaced by the four functions above.
+function makeTierDesc(ntiers) {
+  i = 1;
+  //                for (i=1;i<=ntiers;i++) {
+                       //var i = 2;
+                       var newname = 'desc_tier'+i;
+                       
+                       //create the outer division to hold the other boxes
+                       var out_div = document.createElement('div');
+                       out_div.setAttribute('id',newname);
+                       if (i==1) {
+                             out_div.innerHTML = "Tier"+i+"<br>";
+                       } else {
+                              out_div.innerHTML = "<br><br>Tier"+i+"<br>";
+                       }
+                       document.getElementById('outer_tier_desc').appendChild(out_div);
+
+                       //create form to hold yes/no radio boxes
+                       var form1 = document.createElement('form');
+                       form1.innerHTML = "Allow edges between nodes in Tier"+i+"?<br>";
+                       var radio_yes = document.createElement('input');
+                       radio_yes.setAttribute('type','radio');
+                       radio_yes.setAttribute('name',"r_yes_no_"+newname);
+                       radio_yes.setAttribute('id',"r_yes_"+newname);
+
+                       radio_yes.value = "r_yes_"+newname;
+                       radio_yes.setAttribute('checked','checked');
+                       form1.appendChild(radio_yes);
+                       var yes_label = document.createElement('label');
+                       yes_label.setAttribute('for',radio_yes.id);
+                       yes_label.innerHTML = "Yes    ";
+                       form1.appendChild(yes_label);
+                       var radio_no = document.createElement('input');
+                       radio_no.setAttribute('type','radio');
+                       radio_no.setAttribute('name',"r_yes_no_"+newname);
+                       radio_no.setAttribute('id',"r_no_"+newname);
+                       radio_no.value = "r_no_"+newname;
+                       form1.appendChild(radio_no);
+                       var no_label = document.createElement('label');
+                       no_label.setAttribute('for',radio_no.id);
+                       no_label.innerHTML = "No<br>";
+                       form1.appendChild(no_label);
+                       out_div.appendChild(form1);
+                     //  alert(radio_yes.value);
+                     //  alert(radio_yes.checked);
+                     //  alert(radio_no.value); 
+                     //  alert(radio_no.checked);
+
+
+                       //create form to hold allowed parents
+                       var form2 = document.createElement('form');
+                       form2.innerHTML = "Which tiers can be the "+
+                           "parents of the nodes in Tier"+i+"?<br>";
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+                             var pbox = document.createElement('input');
+                             pbox.setAttribute('type','checkbox');
+                            // pbox.setAttribute('name',"par_"+i);
+                             pbox.setAttribute('name',"par_"+i+"_"+j);
+                             pbox.setAttribute('id',"par_"+i+"_"+j);   
+                             pbox.value = "par_"+i+"_"+j;
+                             if (j<i) {
+                                pbox.setAttribute('checked','checked');
+                             }
+                             var plabel = document.createElement('label');
+                             plabel.setAttribute('for',pbox.id);
+                             plabel.innerHTML = "Tier"+j;
+                             form2.appendChild(pbox);
+                             form2.appendChild(plabel);  
+                           }
+                        }
+                       out_div.appendChild(form2);
+            
+                    //   alert(pbox.value);
+                   //    alert(pbox.checked);
+                      
+   
+
+                       //create form to hold allowed children
+                       var form3 = document.createElement('form');
+                       form3.innerHTML = "Which tiers can be the "+
+                           "children of the nodes in Tier"+i+"?<br>";
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+                             var cbox = document.createElement('input');
+                             cbox.setAttribute('type','checkbox');
+                             //cbox.setAttribute('name',"child_"+i);
+                             cbox.setAttribute('name',"child_"+i+"_"+j);
+                             cbox.setAttribute('id',"child_"+i+"_"+j);
+
+                             cbox.value = "child_"+i+"_"+j;
+                             if (j>i) {
+                                cbox.setAttribute('checked','checked');
+                             }
+                             var clabel = document.createElement('label');
+                             clabel.setAttribute('for',cbox.id);
+                             clabel.innerHTML = "Tier"+j;
+                             form3.appendChild(cbox);
+                             form3.appendChild(clabel);  
+                           }
+                        }
+                       out_div.appendChild(form3);
+                    //var break = document.createElement('div');
+                    //break.innerHTML = "<br>";
+                    //out_div.appendChild(break);
+                    //out_div.appendChild(break);
+                     //  alert(cbox.value);
+                      // alert(cbox.checked);
+
+		       //          }
+}
+
+//Function to give the divs for the ban and white lists the correct
+// dimensions.
+function makeBWLists(nnodes) {
+                var newheight = 45*nnodes + 40;
+                var nlheight = newheight+'px';
+                document.getElementById('nodelist2').style.height=nlheight;
+                var inheight = newheight*2; 
+                var outheight = inheight + 50;
+                inheight=inheight+'px';
+                outheight = outheight+'px';
+                document.getElementById('ban_outer').style.height=outheight;
+                document.getElementById('white_outer').style.height=outheight;
+                document.getElementById('ban_from').style.height=inheight;
+                document.getElementById('ban_to').style.height=inheight;
+                document.getElementById('white_from').style.height=inheight;
+                document.getElementById('white_to').style.height=inheight;
+          
+}
+
+
+//Functions that get the locations of the nodes to group the
+// nodes into tiers and make ban and white lists.
+//Will probably need to add a function to get the tier description information.
+//Might be able to do that with just php though?
+function getNodesInTiers(ntiers) {
+                //output = ntiers+",\n";
+		i = 1;
+                //for (i=1;i<=ntiers;i++){
+		  //var newname = 'Tier'+i;
+		var newname = 'Variables to remove';
+                children = document.getElementById(newname).childNodes;
+                //temp = children.length - 2;
+		var temp = [];
+                //temp = newname + ",\t" +temp+ ",\t"
+                for (j=2;j<children.length;j++){
+		  //temp = temp + "\\t" + children[j].innerHTML;
+		  temp.push(children[j].innerHTML);
+                }
+                //output = output + temp +"\n"
+		  //}
+                
+                output = temp.join(' ');
+                return output;
+                
+               // window.open("http://compbio.uthsc.edu/BNServer/tier.php?tier="+output,"Ratting","width=950,height=270,0,status=0,");
+                
+}
+
+function getNodesInList(from_div,to_div) {
+                children_from = document.getElementById(from_div).childNodes;
+                children_to = document.getElementById(to_div).childNodes;
+                if(children_from.length == children_to.length){
+                    temp = "";                
+                    for (i=2;i<children_from.length;i++){
+                    temp = temp+children_from[i].innerHTML;
+                    temp = temp+",\t"+children_to[i].innerHTML+",\n";
+                    }
+                  
+    
+
+                 }
+                 else 
+                 {
+                   alert('Error in node list');
+                   temp="";
+                 }
+               return temp;
+}
+
+
+//Functions that get the description of the tiers. 
+function getDescribeTiers(ntiers) {
+              output = "";
+	      //              for (i=1;i<=ntiers;i++) {
+	      i = 1;
+               temp="";
+               var newname = 'int_box2'+i;
+                
+               var temp_id_yes="r_yes_"+newname;
+               var temp_id_no="r_no_"+newname;
+               
+                temp_yes = document.getElementById(temp_id_yes);
+                temp_no = document.getElementById(temp_id_no);
+
+               // temp = temp + temp_yes.value + ",\t"
+                temp = temp + temp_yes.checked + ",\t"
+
+               // temp = temp + temp_no.value + ",\t"
+                temp = temp + temp_no.checked + ",\t"
+ 
+		  //for (j=1;j<=ntiers;j++) {
+		  j = 1;
+                    if(j!=i)
+                    {
+                      var pbox_id="par_"+i+"_"+j;
+                      var cbox_id="child_"+i+"_"+j;
+                      temp_p = document.getElementById(pbox_id);
+                      temp_c = document.getElementById(cbox_id); 
+  
+                      temp = temp + temp_p.checked + ",\t"
+
+                      temp = temp + temp_c.checked + ",\t"
+
+                      
+                     }
+		    //}   
+               // alert(temp); 
+                
+                output = output + temp +"\n"
+               
+		  //}
+              
+
+              //  window.open("http://compbio.uthsc.edu/BNServer/tierdescription.php?tierdesc="+output,"Ratting","width=950,height=270,0,status=0,");
+              return output;
+                
+}
+
+
+//Combined all three function together and then execute structure learning
+
+function getcombineDescription(ntiers,ban_from,ban_to,white_from,white_to,keyv)
+{
+  ntiers = 1;
+  var tier=getNodesInTiers(ntiers);
+  var txtFile="./data/"+keyv+"del_var.txt";
+  //var file = new File(txtFile);
+  //file.open("w");
+  //file.write(tier);
+  //file.close();
+  //  var tierdesc=getDescribeTiers(ntiers);
+  //  var ban=getNodesInList(ban_from,ban_to);
+  //  var white=getNodesInList(white_from,white_to);
+  var tierdesc = "";
+  var ban = "";
+  var white = "";
+  window.open("remove_variables_processing.php?tier="+tier+"&My_key="+keyv,'_self',false);
+}
+function getcombineDescriptionDefault(ntiers,ban_from,ban_to,white_from,white_to,keyv)
+{
+  ntiers = 1;
+  var tier=getNodesInTiers(ntiers);
+  var txtFile="./data/"+keyv+"del_var.txt";
+  //var file = new File(txtFile);
+  //file.open("w");
+  //file.write(tier);
+  //file.close();
+  //  var tierdesc=getDescribeTiers(ntiers);
+  //  var ban=getNodesInList(ban_from,ban_to);
+  //  var white=getNodesInList(white_from,white_to);
+  var tierdesc = "";
+  var ban = "";
+  var white = "";
+  window.open("remove_variables_processing_default.php?tier="+tier+"&My_key="+keyv,'_self',false);
+}
+
+function clearBWLists()
+{
+  var element = document.getElementById('ban_from');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('ban_to');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('white_from');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('white_to');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+}
+
+
+
+
+
+</script> 
+</head> 
+
+
+<script type="text/javascript">
+     var nnodes =<?php print($node);?>;
+     var ntiers = <?php print($tier_number);?>;
+</script>
+
+<body onload="loadFunction(nnodes,ntiers)">
+</br>
+        <p><h3>Select variables to remove:<br></h3>
+         </p>
+        <br>
+        <div id="tier_box">
+        <div id="tiers"></div>
+       
+       </div>
+
+<!--
+           
+       <div id="outer_tier_desc1">
+       <p><h3>3. Define interactions allowed between tiers:<br></h3> 
+       </p>
+       <br>
+       <div id="int_box1">
+       </div>
+       <br>
+       <div id="int_box2">
+       </div>
+       <br>
+       <div id="int_box3">
+       </div>
+       <br>
+       <div id="int_box4">
+       </div>
+       </div>
+       <br>
+       <br>
+       <br>
+
+        <div id="outer_box_lists">
+       <p><h3>4. Specify additional constraints:<br></h3>
+       </p>         
+       <br>
+       <div><input type="button" value="Clear lists of banned and required edges" onClick="clearBWLists()"/></div><br>
+        <div id="nodelist2" ondrop="return false"
+        ondragcenter="return false" ondragover="return false" >Nodes<br>
+        </div>
+         
+        <div id="ban_outer">Banned edges<br>
+        <div id="ban_from" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">From<br></div>
+        <div id="ban_to" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">To<br></div>
+        </div>
+        <div id="white_outer">Required edges<br>
+        <div id="white_from" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">From<br></div>
+        <div id="white_to" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">To<br></div>
+        </div>
+-->
+
+        </div>
+       
+        <br>
+        <br>
+   
+        
+
+</body> 
+</div>
+</html>
+
diff --git a/sourcecodes/remove_variables.php~ b/sourcecodes/remove_variables.php~
new file mode 100644
index 00000000..e4cdd91e
--- /dev/null
+++ b/sourcecodes/remove_variables.php~
@@ -0,0 +1,977 @@
+<?php 
+
+///////This code will allow users to group variables in tier. getcombineDescription() function combined all data and take you to "tier_description_processing_gom.php" for preparation of ban and whitelist //////////
+
+include("header_new.inc");
+include("runtime_check.php");
+include("input_validate.php");
+$keyval=$_GET["My_key"];
+
+$dir="./data/";
+
+$type_n=array();
+
+//Get number of tier data and key value for changes in number of tier
+
+if(isset($_POST["nm_tier"]))
+{
+   $type_n=explode("|",$_POST["nm_tier"]);
+}
+else if(isset($_POST["nm_parent"]))
+{
+   $type_n=explode("|",$_POST["nm_parent"]);
+}
+else if(isset($_POST["nm_k"]))
+{
+   $type_n=explode("|",$_POST["nm_k"]);
+}
+else if(isset($_POST["nm_thr"]))
+{
+    $type_n=explode("|",$_POST["nm_thr"]);
+}
+
+$parent_number=trim($type_n[0]);   
+$k_number=trim($type_n[1]);   
+$tier_number=trim($type_n[2]);   
+$structure_thr=trim($type_n[3]);   
+
+
+if($keyval=="")
+  $keyval=$type_n[4];
+
+
+if($parent_number=="")
+{
+   $parent_number=4;
+}
+
+if($k_number=="")
+{
+   $k_number=1;
+}
+
+if($tier_number=="")
+{
+  $tier_number=3;
+}
+if($structure_thr=="")
+{
+  $structure_thr=0.5;
+}
+
+
+
+$nf=$dir.$keyval."nnode.txt";
+$node=trim(file_get_contents("$nf"));
+$maxplist=$node-1;
+
+//print default number of parents
+$pfile=$dir.$keyval."parent.txt";
+$parentf=fopen($pfile,"w");
+fwrite($parentf,"$parent_number\n");
+
+//print default number of k for model averaging
+$kfile=$dir.$keyval."k.txt";
+$kf=fopen($kfile,"w");
+fwrite($kf,"$k_number\n");
+
+//print model averaging threshold
+$thrfile=$dir.$keyval."thr.txt";
+$kf=fopen($thrfile,"w");
+fwrite($kf,"$structure_thr\n");
+
+//////////////////Check execution time//////////////////////////////////////////////
+$keyval=valid_keyval($keyval);
+$runtime=exe_time($keyval,$parent_number,$k_number);
+
+//print("Runtime is $runtime");
+
+?>
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><p onClick="getcombineDescriptionDefault(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a href="javascript:void(0)" >Remove variables and continue</a></p>
+  <li><a href="javascript:void(0);"
+NAME="InputCheck" title="InputCheck"
+    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
+</ul>
+<ul class="navbar">
+  <li><a href="help.php#constraint_interface" target="_blank">How to use this page</a>
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+
+</ul>
+
+<div id="outernew">
+
+<?php
+
+
+if(isset($HTTP_POST_VARS["bantext"]))
+{
+   $ban_search=$HTTP_POST_VARS["searchkey"];
+}
+
+if(isset($HTTP_POST_VARS["whitetext"]))
+{
+   $white_search=$HTTP_POST_VARS["searchkey"];
+}
+
+?>
+
+<!DOCTYPE html> 
+<html> 
+<head> 
+<title>Drag and Drop test</title> 
+<style type="text/css"> 
+	#nodelist{
+		width:200px;
+		font-weight:bold;
+                border: 2px solid;
+		}
+        #tiers{
+                position:absolute;
+                left:215px;
+                white-space: nowrap; 
+                min-width: 3000px;
+                float:top;
+                }
+
+        #int_box1{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box2{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box3{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+        #int_box4{
+                white-space: nowrap;
+                min-width: 10000px;
+                }
+
+        #outer_tier_desc{
+                margin-top: 100px;
+                }
+
+        #outer_tier_desc1{
+                width:2000px;
+                margin-top: 20px;
+                }
+
+	#outer_box_lists{
+                margin-top: 100px;
+		}
+	#nodelist2{
+		width:200px;
+		font-weight:bold;
+                border: 2px solid;
+                float:left;
+		}
+	#ban_outer {
+                position:absolute;
+                left: 215px;
+                width:449px;
+		border: 2px solid;
+                background-color:#C0C0C0;
+		font-weight:bold;
+                margin-left:15px;
+	}
+        #ban_from {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+        #ban_to {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+	#white_outer {
+                position:absolute;
+                left:700px;
+                width:449px;
+		border: 2px solid;
+                background-color:#C0C0C0;
+		font-weight:bold;
+	}
+        #white_from {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+        #white_to {
+                width:200px;
+                border:2px solid;
+                margin-left:15px;
+        }
+
+
+	.tier {
+		width:200px;
+		border: 2px solid;
+		font-weight:bold;
+                float:left;
+                background-color:#FFFFFF;
+                margin-left:5px;
+	        display: inline-block;
+	}
+	.int {
+		border: 2px solid;
+		font-weight:bold;
+                float:left;
+                background-color:#FFFFFF;
+                margin-left:0px;
+	        display: inline-block;
+	}
+	.int1 {
+		border: 2px solid;
+                background-color:#FFFFFF;
+	        clear: left;
+	        float:left;
+                margin-left:0px;
+	        display: inline-block;
+	}
+	.node1 {
+		width:150px;
+		height:30px;
+		float:left;	
+		margin-left:10px;
+		margin-top:10px;
+		border: 2px dashed;
+                background-color:#C0C0C0;
+	}
+	.node2 {
+		width:150px;
+		height:30px;
+		float:left;	
+		margin-left:10px;
+		margin-top:10px;
+		border: 2px dashed;
+                background-color:#EAE822;
+	}
+
+</style> 
+
+<script type="text/javascript">
+
+//There are three groups of functions here:
+//The first group is involved with dragging and dropping nodes
+// between different locations.
+//The second group is involved with creating the divs that are needed
+// based on the number of nodes and number of tiers and organizing
+// them on the webpage.
+//The third group determines which divs the nodes are located in
+// to group the nodes into tiers and make ban and white lists.
+
+
+//Drag and drop functions:
+function drag(drop_target, e) {
+		e.dataTransfer.setData('Text', drop_target.id);
+		}
+
+function drop(drop_target, e) {
+		var id = e.dataTransfer.getData('Text');
+		drop_target.appendChild(document.getElementById(id));
+		e.preventDefault();
+	        } 
+
+function dropCopy(ev) {
+           ev.stopPropagation();
+           ev.preventDefault();
+           var src = ev.dataTransfer.getData("Text");
+           var orig = document.getElementById(src);
+           var pid = orig.parentNode.id;
+           var target_id = ev.target.id;
+           //document.write(pid);
+           if (pid != target_id){
+                var origclone = orig.cloneNode(true);
+                var newid = src+"a";
+                origclone.setAttribute('id',newid);
+                document.getElementById(pid).appendChild(origclone);
+                ev.target.appendChild(orig);
+           }
+           else {
+                document.write(pid,target_id);
+           }
+           return false; 
+}
+
+
+
+
+function loadFunction(nnodes,ntiers) {
+             makeNodeList(nnodes,'nodelist','tr');
+             makeNodes(nnodes,'nodelist');
+             makeTiers(nnodes,ntiers);
+             makeNodes(nnodes,'nodelist2','bw');
+             makeTierDesc1(ntiers);
+             makeTierDesc2(ntiers);
+             makeTierDesc3(ntiers);
+             makeTierDesc4(ntiers);
+             makeBWLists(nnodes);
+}
+
+
+//Function to make the NodeList. It is similar to the above function.
+function makeNodeList(nnodes,nlist) {
+               var element1 = document.createElement('div');
+               var newheight = 45*nnodes + 40;
+               newheight = newheight+'px';                  
+               element1.setAttribute('id',nlist);
+               element1.setAttribute('ondrop','drop(this, event)');
+               element1.setAttribute('ondragenter','return false');
+               element1.setAttribute('ondragover','return false');
+               element1.style.height=(newheight);
+               element1.innerHTML = "Variables to use<br>";
+               document.getElementById('tier_box').appendChild(element1);
+}
+
+
+//This is the function that makes the nodes. It is called when the
+// page loads. The nodes are placed in the "nodelist" div.
+//Will need to mofidy this function to pass it a list of the node
+// names. The inner html is what is used in the later functions
+// that make the tier list, banlist, and white list.
+function makeNodes(nnodes,nlist,suffix) {
+
+<?php $xyz=1;
+$nm=$dir."$keyval"."name.txt";
+
+$namelist=file_get_contents("$nm");
+$str_arrname=array();
+$str_arrname=explode("\n",$namelist);
+$dataname=array();
+$dataname=explode("\t",$str_arrname[0]);
+             for ($i=1;$i<=$node;$i++){
+$ii=$i-1;
+$npr=trim($dataname[$ii]);
+?>             
+               i="<?php print($i);?>";
+               var newname = 'node'+i;
+               var element1 = document.createElement('div');
+               element1.setAttribute('draggable','true');
+               element1.setAttribute('class','node1');
+               element1.setAttribute('ondragstart','drag(this, event)');
+               element1.setAttribute('id',newname+suffix);
+               element1.setAttribute('ondragover','return false');
+               element1.innerHTML = "<?php print($npr);?>";
+               document.getElementById(nlist).appendChild(element1);
+           <?php  }
+          ?>
+     }
+
+
+//Function to make the Tiers. It is similar to the above function.
+function makeTiers(nnodes,ntiers) {
+  //ntiers = 1;
+  //         for (i=1;i<=ntiers;i++){
+             i = 1;
+	     //var newname = 'Tier'+i;
+	     var newname = 'Variables to remove';
+               var element1 = document.createElement('div');
+               //var newpos = i*205;
+               //newpos = 'left: '+newpos+'px';
+               var newheight = nnodes*45 + 40;
+               newheight = newheight+'px';
+               //var newstyle = newpos + newheight;         
+               element1.setAttribute('class','tier');
+               element1.setAttribute('id',newname);
+               element1.setAttribute('ondrop','drop(this, event)');
+               element1.setAttribute('ondragenter','return false');
+               element1.setAttribute('ondragover','return false');
+               //element1.setAttribute('style',newpos);
+               element1.style.height=(newheight);
+               element1.innerHTML = newname +"<br>";
+               document.getElementById('tiers').appendChild(element1);
+	       //   }
+               var newwidth = ntiers*205 + 20;
+               newwidth = newwidth+'px';
+               document.getElementById('tiers').style.width=newwidth;
+}
+
+
+
+function makeTierDesc1(ntiers) {
+               var element1 = document.createElement('div');
+               var newheight = '20px';
+               var newwidth = '220px';
+               element1.setAttribute('id','int_box1_first');
+               element1.setAttribute('class','int');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               //element1.innerHTML = "st<br>";
+               document.getElementById('int_box1').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+               i = 1;
+		 var newname = 'int_box1'+i;
+                 var newheight = '20px';
+                 var newwidth = '205px';
+                 //var newwidth = ntiers*65 + 20;
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "&nbsp&nbspTier"+i+"<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box1').appendChild(element1);
+		 //}
+                 
+}
+function makeTierDesc2(ntiers) {
+               var element1 = document.createElement('div');
+               var newheight = '50px';
+               var newwidth = '220px';
+               element1.setAttribute('id','int_box2_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Are within tier <br>interactions allowed?<br>";
+               document.getElementById('int_box2').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+	       i = 1;
+		 var newname = 'int_box2'+i;
+                 var newheight = '50px';
+                 var newwidth = '205px';
+                 //var newwidth = ntiers*65 + 20;
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box2').appendChild(element1);
+                       //create form to hold yes/no radio boxes
+                       var form1 = document.createElement('form');
+                       //form1.innerHTML = "Allow edges between nodes in Tier"+i+"?<br>";
+                       var radio_yes = document.createElement('input');
+                       radio_yes.setAttribute('type','radio');
+                       radio_yes.setAttribute('name',"r_yes_no_"+newname);
+                       radio_yes.setAttribute('id',"r_yes_"+newname);
+
+                       radio_yes.value = "r_yes_"+newname;
+                       radio_yes.setAttribute('checked','checked');
+                       form1.appendChild(radio_yes);
+                       var yes_label = document.createElement('label');
+                       yes_label.setAttribute('for',radio_yes.id);
+                       yes_label.innerHTML = "Yes&nbsp&nbsp&nbsp&nbsp&nbsp";
+                       form1.appendChild(yes_label);
+                       var radio_no = document.createElement('input');
+                       radio_no.setAttribute('type','radio');
+                       radio_no.setAttribute('name',"r_yes_no_"+newname);
+                       radio_no.setAttribute('id',"r_no_"+newname);
+                       radio_no.value = "r_no_"+newname;
+                       form1.appendChild(radio_no);
+                       var no_label = document.createElement('label');
+                       no_label.setAttribute('for',radio_no.id);
+                       no_label.innerHTML = "No<br>";
+                       form1.appendChild(no_label);
+                       element1.appendChild(form1);
+                     //  alert(radio_yes.value);
+                     //  alert(radio_yes.checked);
+                     //  alert(radio_no.value); 
+                     //  alert(radio_no.checked);
+		       //}
+                 
+}
+
+function makeTierDesc3(ntiers) {
+               var element1 = document.createElement('div');
+               var newwidth = '220px';
+               var newheight = ntiers*10 + 25;
+               newheight = newheight + 'px'; 
+               //var newheight = '50px';
+               //var newwidth = '250px';
+               element1.setAttribute('id','int_box3_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Which tiers contain nodes that <br>can be the parents of this tier?<br>";
+               document.getElementById('int_box3').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+               i = 1;
+		 var newname = 'int_box3'+i;
+                 //var newheight = '50px';
+                 var newwidth = '205px';
+                 //newwidth = newwidth+'px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box3').appendChild(element1);
+                       //create form to hold allowed parents
+                       var form2 = document.createElement('form');
+                       //form2.innerHTML = "Which tiers can be the "+
+                       //    "parents of the nodes in Tier"+i+"?<br>";
+		       var k = 0;
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+			    k = k + 1;
+                             var pbox = document.createElement('input');
+                             pbox.setAttribute('type','checkbox');
+                            // pbox.setAttribute('name',"par_"+i);
+                             pbox.setAttribute('name',"par_"+i+"_"+j);
+                             pbox.setAttribute('id',"par_"+i+"_"+j);   
+                             pbox.value = "par_"+i+"_"+j;
+                             if (j<i) {
+                                pbox.setAttribute('checked','checked');
+                             }
+                             var plabel = document.createElement('label');
+                             plabel.setAttribute('for',pbox.id);
+                             if (k%2 == 0) {
+                             plabel.innerHTML = "Tier"+j+"&nbsp&nbsp<br>";
+                             } else {
+                             plabel.innerHTML = "Tier"+j+"&nbsp&nbsp";
+                             }
+                             form2.appendChild(pbox);
+                             form2.appendChild(plabel);  
+                           }
+                        }
+                       element1.appendChild(form2);
+		       //}
+}
+
+function makeTierDesc4(ntiers) {
+               var element1 = document.createElement('div');
+               //var newheight = '50px';
+               var newwidth = '220px';
+               var newheight = ntiers*10 + 25;
+               newheight = newheight + 'px'; 
+               element1.setAttribute('id','int_box4_first');
+               element1.setAttribute('class','int1');
+               element1.style.height=(newheight);
+               element1.style.width=(newwidth);
+               element1.innerHTML = "Which tiers contain nodes that<br> can be the children of this tier?<br>";
+               document.getElementById('int_box4').appendChild(element1);
+	       //for (i=1;i<=ntiers;i++) {
+	       i = 1;
+		 var newname = 'int_box4'+i;
+                 //var newheight = '50px';
+                 //var newwidth = ntiers*65 + 20;
+                 var newwidth = '205px';
+                 var element1 = document.createElement('div');
+                 element1.setAttribute('id',newname);
+                 element1.setAttribute('class','int');
+                 element1.innerHTML = "<br>";
+		 element1.style.height=(newheight);
+		 element1.style.width=(newwidth);
+		 document.getElementById('int_box4').appendChild(element1);
+                       //create form to hold allowed children
+                       var form3 = document.createElement('form');
+                       //form3.innerHTML = "Nodes in which tiers can be <br>the children of this tier?<br>";
+                       var k = 0;
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+			     k = k + 1;
+                             var cbox = document.createElement('input');
+                             cbox.setAttribute('type','checkbox');
+                             //cbox.setAttribute('name',"child_"+i);
+                             cbox.setAttribute('name',"child_"+i+"_"+j);
+                             cbox.setAttribute('id',"child_"+i+"_"+j);
+
+                             cbox.value = "child_"+i+"_"+j;
+                             if (j>i) {
+                                cbox.setAttribute('checked','checked');
+                             }
+                             var clabel = document.createElement('label');
+                             clabel.setAttribute('for',cbox.id);
+                             if (k%2 == 0) {
+                                clabel.innerHTML = "Tier"+j+"&nbsp&nbsp<br>";
+			      } 
+			       else 
+                              {
+                               clabel.innerHTML = "Tier"+j+"&nbsp&nbsp";
+			      }
+                             form3.appendChild(cbox);
+                             form3.appendChild(clabel);  
+                           }
+                        }
+                       element1.appendChild(form3);
+		       //}
+}
+
+
+
+//Old function to make section of page that allows for tier description.
+//Replaced by the four functions above.
+function makeTierDesc(ntiers) {
+  i = 1;
+  //                for (i=1;i<=ntiers;i++) {
+                       //var i = 2;
+                       var newname = 'desc_tier'+i;
+                       
+                       //create the outer division to hold the other boxes
+                       var out_div = document.createElement('div');
+                       out_div.setAttribute('id',newname);
+                       if (i==1) {
+                             out_div.innerHTML = "Tier"+i+"<br>";
+                       } else {
+                              out_div.innerHTML = "<br><br>Tier"+i+"<br>";
+                       }
+                       document.getElementById('outer_tier_desc').appendChild(out_div);
+
+                       //create form to hold yes/no radio boxes
+                       var form1 = document.createElement('form');
+                       form1.innerHTML = "Allow edges between nodes in Tier"+i+"?<br>";
+                       var radio_yes = document.createElement('input');
+                       radio_yes.setAttribute('type','radio');
+                       radio_yes.setAttribute('name',"r_yes_no_"+newname);
+                       radio_yes.setAttribute('id',"r_yes_"+newname);
+
+                       radio_yes.value = "r_yes_"+newname;
+                       radio_yes.setAttribute('checked','checked');
+                       form1.appendChild(radio_yes);
+                       var yes_label = document.createElement('label');
+                       yes_label.setAttribute('for',radio_yes.id);
+                       yes_label.innerHTML = "Yes    ";
+                       form1.appendChild(yes_label);
+                       var radio_no = document.createElement('input');
+                       radio_no.setAttribute('type','radio');
+                       radio_no.setAttribute('name',"r_yes_no_"+newname);
+                       radio_no.setAttribute('id',"r_no_"+newname);
+                       radio_no.value = "r_no_"+newname;
+                       form1.appendChild(radio_no);
+                       var no_label = document.createElement('label');
+                       no_label.setAttribute('for',radio_no.id);
+                       no_label.innerHTML = "No<br>";
+                       form1.appendChild(no_label);
+                       out_div.appendChild(form1);
+                     //  alert(radio_yes.value);
+                     //  alert(radio_yes.checked);
+                     //  alert(radio_no.value); 
+                     //  alert(radio_no.checked);
+
+
+                       //create form to hold allowed parents
+                       var form2 = document.createElement('form');
+                       form2.innerHTML = "Which tiers can be the "+
+                           "parents of the nodes in Tier"+i+"?<br>";
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+                             var pbox = document.createElement('input');
+                             pbox.setAttribute('type','checkbox');
+                            // pbox.setAttribute('name',"par_"+i);
+                             pbox.setAttribute('name',"par_"+i+"_"+j);
+                             pbox.setAttribute('id',"par_"+i+"_"+j);   
+                             pbox.value = "par_"+i+"_"+j;
+                             if (j<i) {
+                                pbox.setAttribute('checked','checked');
+                             }
+                             var plabel = document.createElement('label');
+                             plabel.setAttribute('for',pbox.id);
+                             plabel.innerHTML = "Tier"+j;
+                             form2.appendChild(pbox);
+                             form2.appendChild(plabel);  
+                           }
+                        }
+                       out_div.appendChild(form2);
+            
+                    //   alert(pbox.value);
+                   //    alert(pbox.checked);
+                      
+   
+
+                       //create form to hold allowed children
+                       var form3 = document.createElement('form');
+                       form3.innerHTML = "Which tiers can be the "+
+                           "children of the nodes in Tier"+i+"?<br>";
+                       for (j=1;j<=ntiers;j++) {
+                          if (j!=i) {
+                             var cbox = document.createElement('input');
+                             cbox.setAttribute('type','checkbox');
+                             //cbox.setAttribute('name',"child_"+i);
+                             cbox.setAttribute('name',"child_"+i+"_"+j);
+                             cbox.setAttribute('id',"child_"+i+"_"+j);
+
+                             cbox.value = "child_"+i+"_"+j;
+                             if (j>i) {
+                                cbox.setAttribute('checked','checked');
+                             }
+                             var clabel = document.createElement('label');
+                             clabel.setAttribute('for',cbox.id);
+                             clabel.innerHTML = "Tier"+j;
+                             form3.appendChild(cbox);
+                             form3.appendChild(clabel);  
+                           }
+                        }
+                       out_div.appendChild(form3);
+                    //var break = document.createElement('div');
+                    //break.innerHTML = "<br>";
+                    //out_div.appendChild(break);
+                    //out_div.appendChild(break);
+                     //  alert(cbox.value);
+                      // alert(cbox.checked);
+
+		       //          }
+}
+
+//Function to give the divs for the ban and white lists the correct
+// dimensions.
+function makeBWLists(nnodes) {
+                var newheight = 45*nnodes + 40;
+                var nlheight = newheight+'px';
+                document.getElementById('nodelist2').style.height=nlheight;
+                var inheight = newheight*2; 
+                var outheight = inheight + 50;
+                inheight=inheight+'px';
+                outheight = outheight+'px';
+                document.getElementById('ban_outer').style.height=outheight;
+                document.getElementById('white_outer').style.height=outheight;
+                document.getElementById('ban_from').style.height=inheight;
+                document.getElementById('ban_to').style.height=inheight;
+                document.getElementById('white_from').style.height=inheight;
+                document.getElementById('white_to').style.height=inheight;
+          
+}
+
+
+//Functions that get the locations of the nodes to group the
+// nodes into tiers and make ban and white lists.
+//Will probably need to add a function to get the tier description information.
+//Might be able to do that with just php though?
+function getNodesInTiers(ntiers) {
+                //output = ntiers+",\n";
+		i = 1;
+                //for (i=1;i<=ntiers;i++){
+		  //var newname = 'Tier'+i;
+		var newname = 'Variables to remove';
+                children = document.getElementById(newname).childNodes;
+                //temp = children.length - 2;
+		var temp = [];
+                //temp = newname + ",\t" +temp+ ",\t"
+                for (j=2;j<children.length;j++){
+		  //temp = temp + "\\t" + children[j].innerHTML;
+		  temp.push(children[j].innerHTML);
+                }
+                //output = output + temp +"\n"
+		  //}
+                
+                output = temp.join(' ');
+                return output;
+                
+               // window.open("http://compbio.uthsc.edu/BNServer/tier.php?tier="+output,"Ratting","width=950,height=270,0,status=0,");
+                
+}
+
+function getNodesInList(from_div,to_div) {
+                children_from = document.getElementById(from_div).childNodes;
+                children_to = document.getElementById(to_div).childNodes;
+                if(children_from.length == children_to.length){
+                    temp = "";                
+                    for (i=2;i<children_from.length;i++){
+                    temp = temp+children_from[i].innerHTML;
+                    temp = temp+",\t"+children_to[i].innerHTML+",\n";
+                    }
+                  
+    
+
+                 }
+                 else 
+                 {
+                   alert('Error in node list');
+                   temp="";
+                 }
+               return temp;
+}
+
+
+//Functions that get the description of the tiers. 
+function getDescribeTiers(ntiers) {
+              output = "";
+	      //              for (i=1;i<=ntiers;i++) {
+	      i = 1;
+               temp="";
+               var newname = 'int_box2'+i;
+                
+               var temp_id_yes="r_yes_"+newname;
+               var temp_id_no="r_no_"+newname;
+               
+                temp_yes = document.getElementById(temp_id_yes);
+                temp_no = document.getElementById(temp_id_no);
+
+               // temp = temp + temp_yes.value + ",\t"
+                temp = temp + temp_yes.checked + ",\t"
+
+               // temp = temp + temp_no.value + ",\t"
+                temp = temp + temp_no.checked + ",\t"
+ 
+		  //for (j=1;j<=ntiers;j++) {
+		  j = 1;
+                    if(j!=i)
+                    {
+                      var pbox_id="par_"+i+"_"+j;
+                      var cbox_id="child_"+i+"_"+j;
+                      temp_p = document.getElementById(pbox_id);
+                      temp_c = document.getElementById(cbox_id); 
+  
+                      temp = temp + temp_p.checked + ",\t"
+
+                      temp = temp + temp_c.checked + ",\t"
+
+                      
+                     }
+		    //}   
+               // alert(temp); 
+                
+                output = output + temp +"\n"
+               
+		  //}
+              
+
+              //  window.open("http://compbio.uthsc.edu/BNServer/tierdescription.php?tierdesc="+output,"Ratting","width=950,height=270,0,status=0,");
+              return output;
+                
+}
+
+
+//Combined all three function together and then execute structure learning
+
+function getcombineDescription(ntiers,ban_from,ban_to,white_from,white_to,keyv)
+{
+  ntiers = 1;
+  var tier=getNodesInTiers(ntiers);
+  var txtFile="./data/"+keyv+"del_var.txt";
+  //var file = new File(txtFile);
+  //file.open("w");
+  //file.write(tier);
+  //file.close();
+  //  var tierdesc=getDescribeTiers(ntiers);
+  //  var ban=getNodesInList(ban_from,ban_to);
+  //  var white=getNodesInList(white_from,white_to);
+  var tierdesc = "";
+  var ban = "";
+  var white = "";
+  window.open("remove_variables_processing.php?tier="+tier+"&My_key="+keyv,'_self',false);
+}
+function getcombineDescriptionDefault(ntiers,ban_from,ban_to,white_from,white_to,keyv)
+{
+  ntiers = 1;
+  var tier=getNodesInTiers(ntiers);
+  var txtFile="./data/"+keyv+"del_var.txt";
+  //var file = new File(txtFile);
+  //file.open("w");
+  //file.write(tier);
+  //file.close();
+  //  var tierdesc=getDescribeTiers(ntiers);
+  //  var ban=getNodesInList(ban_from,ban_to);
+  //  var white=getNodesInList(white_from,white_to);
+  var tierdesc = "";
+  var ban = "";
+  var white = "";
+  window.open("remove_variables_processing_default.php?tier="+tier+"&My_key="+keyv,'_self',false);
+}
+
+function clearBWLists()
+{
+  var element = document.getElementById('ban_from');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('ban_to');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('white_from');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+  var element = document.getElementById('white_to');
+  var children = element.childNodes;
+  while (children.length>2) {
+    element.removeChild(element.lastChild);
+    var children = element.childNodes;
+  }
+}
+
+
+
+
+
+</script> 
+</head> 
+
+
+<script type="text/javascript">
+     var nnodes =<?php print($node);?>;
+     var ntiers = <?php print($tier_number);?>;
+</script>
+
+<body onload="loadFunction(nnodes,ntiers)">
+</br>
+        <p><h3>Select variables to remove:<br></h3>
+         </p>
+        <br>
+        <div id="tier_box">
+        <div id="tiers"></div>
+       
+       </div>
+
+<!--
+           
+       <div id="outer_tier_desc1">
+       <p><h3>3. Define interactions allowed between tiers:<br></h3> 
+       </p>
+       <br>
+       <div id="int_box1">
+       </div>
+       <br>
+       <div id="int_box2">
+       </div>
+       <br>
+       <div id="int_box3">
+       </div>
+       <br>
+       <div id="int_box4">
+       </div>
+       </div>
+       <br>
+       <br>
+       <br>
+
+        <div id="outer_box_lists">
+       <p><h3>4. Specify additional constraints:<br></h3>
+       </p>         
+       <br>
+       <div><input type="button" value="Clear lists of banned and required edges" onClick="clearBWLists()"/></div><br>
+        <div id="nodelist2" ondrop="return false"
+        ondragcenter="return false" ondragover="return false" >Nodes<br>
+        </div>
+         
+        <div id="ban_outer">Banned edges<br>
+        <div id="ban_from" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">From<br></div>
+        <div id="ban_to" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">To<br></div>
+        </div>
+        <div id="white_outer">Required edges<br>
+        <div id="white_from" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">From<br></div>
+        <div id="white_to" class="tier" ondrop="return dropCopy(event)"
+        ondragenter="return false" ondragover="return false">To<br></div>
+        </div>
+-->
+
+        </div>
+       
+        <br>
+        <br>
+   
+        
+
+</body> 
+</div>
+</html>
+
diff --git a/sourcecodes/remove_variables_processing.php b/sourcecodes/remove_variables_processing.php
new file mode 100644
index 00000000..be2d9f5d
--- /dev/null
+++ b/sourcecodes/remove_variables_processing.php
@@ -0,0 +1,232 @@
+<?php
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+
+function get_tier($keyval)
+{
+
+$tier=trim($_GET['tier']);
+$dir="./data/";
+$tf=$dir.$keyval."del_var.txt";
+$fpvar = fopen("$tf","w");
+
+fwrite($fpvar,"$tier");
+fclose($fpvar);
+}
+
+
+function enter_ban_list($t1,$s1,$t2,$s2,$tier_d,$fpvar)
+{
+  
+   for ($i=0;$i<$s1;$i++)
+   {
+        $data_val_1=$tier_d[$t1][$i];
+           
+        for ($j=0;$j<$s2;$j++)
+        {
+            $data_val_2=$tier_d[$t2][$j];
+            if($data_val_1!=$data_val_2)
+            {
+               
+               fprintf($fpvar,"%s\t%s\n",$data_val_1,$data_val_2); 
+              
+
+            }
+   
+        }
+         
+   }
+  
+
+}
+
+
+
+function describe_tier($fpvar,$keyval)
+{
+
+
+$tierdesc=trim($_GET['tierdesc']);
+$dir="./data/";
+$tf=$dir.$keyval."tier.txt";
+$tier=file_get_contents("$tf");
+
+$tier_data=array();
+$tier_size=array();
+$tier_d=array();
+$tier_data=explode(",",$tier);
+
+$tn=$tier_data[0];
+$count=0;
+
+for ($i=0;$i<$tn;$i++)
+{
+    $count+=2;
+    $tier_size[$i]=$tier_data[$count];
+         
+    $rs=$tier_size[$i];
+    for ($j=0;$j<$rs;$j++)
+    {
+     $count++;  
+     $tier_d[$i][$j]=$tier_data[$count];
+     
+    
+    }
+   
+}
+
+
+
+$data=array();
+$data=explode(",",$tierdesc);
+$n=count($data);
+$nn=0;
+$di=0;
+for ($i=0;$i<$tn;$i++)
+{
+
+$d_y=trim($data[$di]);
+$di++;
+$d_n=trim($data[$di]);
+
+if($d_n=="true") //put data in banlist
+{
+   $s1=$tier_size[$i];
+   enter_ban_list($i,$s1,$i,$s1,$tier_d,$fpvar);
+
+}
+$di++;
+
+
+   for ($j=0;$j<$tn;$j++)
+   {
+      if($j!=$i)
+      {
+        $p_d=trim($data[$di]);
+        $di++;
+    
+        if($p_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$j];
+             $s2=$tier_size[$i];
+             //echo $tier_size[$j];
+            enter_ban_list($j,$s1,$i,$s2,$tier_d,$fpvar);
+        }
+    
+
+
+        $c_d=trim($data[$di]);
+        $di++;
+        if($c_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$i];
+             $s2=$tier_size[$j];
+                  // echo $tier_size[$j];
+            enter_ban_list($i,$s1,$j,$s2,$tier_d,$fpvar);
+        }
+
+ 
+      }
+   }
+
+}
+
+
+}
+
+
+function banlist($fpvar)
+{
+$ban=trim($_GET['ban']);
+$data=array();
+$data=explode(",",$ban);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2)
+{
+	$ii=$i+1;
+	$d1=trim($data[$i]);
+	$d2=trim($data[$ii]);
+
+	if($d1!="" && $d2!="")
+	{
+  		fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  		$nn++;
+	}
+
+}
+
+}
+
+function whitelist($fpvar)
+{
+
+$white=trim($_GET['white']);
+
+
+
+$data=array();
+$data=explode(",",$white);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2){
+$ii=$i+1;
+$d1=trim($data[$i]);
+$d2=trim($data[$ii]);
+
+if($d1!="" && $d2!="")
+{
+  fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  $nn++;
+}
+
+}
+
+
+}
+
+
+/////////////////////Call functions//////////////////////
+
+
+
+$dir="./data/";
+
+//$sid1=$dir.$keyval."ban";
+//$sid2=$dir.$keyval."white";
+
+//$Textban=$sid1.".txt";
+//$Textwhite=$sid2.".txt";
+//$fpb = fopen($Textban,"w");
+//$fpw = fopen($Textwhite,"w");
+//$datpost="From\tTo\n";
+//fwrite($fpb,"$datpost");
+//fwrite($fpw,"$datpost");
+
+get_tier($keyval);
+
+$oldkey=$keyval;
+
+///Generate new random key
+$alphas=array();
+$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
+
+$al1=rand(0,51);
+$al2=rand(0,51);
+$al3=rand(0,51);
+
+$alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
+$keyval=$alpha;
+
+shell_exec('./run_scripts/run_del_var '.$oldkey.' '.$keyval);
+
+//describe_tier($fpb,$keyval);
+//banlist($fpb);
+//whitelist($fpw);
+
+
+////////////////////////////////////execute structurelearning/////////////////////////////////////////////////////////////////////////////////////////////
+?>
+<script>
+window.open("create_tiers_gom.php?My_key=<?php print($keyval);?>",'_self',false);
+</script>
\ No newline at end of file
diff --git a/sourcecodes/remove_variables_processing_default.php b/sourcecodes/remove_variables_processing_default.php
new file mode 100644
index 00000000..255535b2
--- /dev/null
+++ b/sourcecodes/remove_variables_processing_default.php
@@ -0,0 +1,232 @@
+<?php
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+
+function get_tier($keyval)
+{
+
+$tier=trim($_GET['tier']);
+$dir="./data/";
+$tf=$dir.$keyval."del_var.txt";
+$fpvar = fopen("$tf","w");
+
+fwrite($fpvar,"$tier");
+fclose($fpvar);
+}
+
+
+function enter_ban_list($t1,$s1,$t2,$s2,$tier_d,$fpvar)
+{
+  
+   for ($i=0;$i<$s1;$i++)
+   {
+        $data_val_1=$tier_d[$t1][$i];
+           
+        for ($j=0;$j<$s2;$j++)
+        {
+            $data_val_2=$tier_d[$t2][$j];
+            if($data_val_1!=$data_val_2)
+            {
+               
+               fprintf($fpvar,"%s\t%s\n",$data_val_1,$data_val_2); 
+              
+
+            }
+   
+        }
+         
+   }
+  
+
+}
+
+
+
+function describe_tier($fpvar,$keyval)
+{
+
+
+$tierdesc=trim($_GET['tierdesc']);
+$dir="./data/";
+$tf=$dir.$keyval."tier.txt";
+$tier=file_get_contents("$tf");
+
+$tier_data=array();
+$tier_size=array();
+$tier_d=array();
+$tier_data=explode(",",$tier);
+
+$tn=$tier_data[0];
+$count=0;
+
+for ($i=0;$i<$tn;$i++)
+{
+    $count+=2;
+    $tier_size[$i]=$tier_data[$count];
+         
+    $rs=$tier_size[$i];
+    for ($j=0;$j<$rs;$j++)
+    {
+     $count++;  
+     $tier_d[$i][$j]=$tier_data[$count];
+     
+    
+    }
+   
+}
+
+
+
+$data=array();
+$data=explode(",",$tierdesc);
+$n=count($data);
+$nn=0;
+$di=0;
+for ($i=0;$i<$tn;$i++)
+{
+
+$d_y=trim($data[$di]);
+$di++;
+$d_n=trim($data[$di]);
+
+if($d_n=="true") //put data in banlist
+{
+   $s1=$tier_size[$i];
+   enter_ban_list($i,$s1,$i,$s1,$tier_d,$fpvar);
+
+}
+$di++;
+
+
+   for ($j=0;$j<$tn;$j++)
+   {
+      if($j!=$i)
+      {
+        $p_d=trim($data[$di]);
+        $di++;
+    
+        if($p_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$j];
+             $s2=$tier_size[$i];
+             //echo $tier_size[$j];
+            enter_ban_list($j,$s1,$i,$s2,$tier_d,$fpvar);
+        }
+    
+
+
+        $c_d=trim($data[$di]);
+        $di++;
+        if($c_d=="false") //put data in banlist
+        {
+             $s1=$tier_size[$i];
+             $s2=$tier_size[$j];
+                  // echo $tier_size[$j];
+            enter_ban_list($i,$s1,$j,$s2,$tier_d,$fpvar);
+        }
+
+ 
+      }
+   }
+
+}
+
+
+}
+
+
+function banlist($fpvar)
+{
+$ban=trim($_GET['ban']);
+$data=array();
+$data=explode(",",$ban);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2)
+{
+	$ii=$i+1;
+	$d1=trim($data[$i]);
+	$d2=trim($data[$ii]);
+
+	if($d1!="" && $d2!="")
+	{
+  		fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  		$nn++;
+	}
+
+}
+
+}
+
+function whitelist($fpvar)
+{
+
+$white=trim($_GET['white']);
+
+
+
+$data=array();
+$data=explode(",",$white);
+$n=count($data);
+$nn=0;
+for ($i=0;$i<$n;$i+=2){
+$ii=$i+1;
+$d1=trim($data[$i]);
+$d2=trim($data[$ii]);
+
+if($d1!="" && $d2!="")
+{
+  fprintf($fpvar,"%s\t%s\n",$d1,$d2);
+  $nn++;
+}
+
+}
+
+
+}
+
+
+/////////////////////Call functions//////////////////////
+
+
+
+$dir="./data/";
+
+//$sid1=$dir.$keyval."ban";
+//$sid2=$dir.$keyval."white";
+
+//$Textban=$sid1.".txt";
+//$Textwhite=$sid2.".txt";
+//$fpb = fopen($Textban,"w");
+//$fpw = fopen($Textwhite,"w");
+//$datpost="From\tTo\n";
+//fwrite($fpb,"$datpost");
+//fwrite($fpw,"$datpost");
+
+get_tier($keyval);
+
+$oldkey=$keyval;
+
+///Generate new random key
+$alphas=array();
+$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
+
+$al1=rand(0,51);
+$al2=rand(0,51);
+$al3=rand(0,51);
+
+$alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
+$keyval=$alpha;
+
+shell_exec('./run_scripts/run_del_var '.$oldkey.' '.$keyval);
+
+//describe_tier($fpb,$keyval);
+//banlist($fpb);
+//whitelist($fpw);
+
+
+////////////////////////////////////execute structurelearning/////////////////////////////////////////////////////////////////////////////////////////////
+?>
+<script>
+window.open("executionprogress.php?My_key=<?php print($keyval);?>",'_self',false);
+</script>
\ No newline at end of file
diff --git a/sourcecodes/structuremap.php b/sourcecodes/structuremap.php
deleted file mode 100644
index 6c4c1323..00000000
--- a/sourcecodes/structuremap.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-function map($id,$val,$pre)
-{
-
-$dir="./data/";
-
-$matfile=$dir."$pre"."map.txt";
-
-
-$matrix=file("$matfile");
-$matrix1=file_get_contents("$matfile");             
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-$datamat=array();
-$data_cell=array(); 
-
-$data_cell_canvas=array();
-
-$i=0;
-foreach($str_arrmat as $line)
-{
-  
-$data_cell_canvas=explode("\t",$line);
-$map_name=$data_cell_canvas[0];
-$map_type=$data_cell_canvas[1];
-$map_std=$data_cell_canvas[2];
-$map_mean=$data_cell_canvas[3];
-if($id==$map_name)
-{
-  $mapval=$val*$map_std+$map_mean;
-}
-
-$i++;
-}
-return $mapval;
-}
-
-
-
-function reversemap($id,$val,$pre)
-{
-$dir="./data/";
-
-
-$matfile=$dir."$pre"."map.txt";
-
-
-$matrix=file("$matfile");
-$matrix1=file_get_contents("$matfile");             
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-$datamat=array();
-$data_cell=array(); 
-
-$data_cell_canvas=array();
-
-$i=0;
-foreach($str_arrmat as $line)
-{
-  
-$data_cell_canvas=explode("\t",$line);
-$map_name=$data_cell_canvas[0];
-$map_type=$data_cell_canvas[1];
-$map_std=$data_cell_canvas[2];
-$map_mean=$data_cell_canvas[3];
-if($id==$map_name)
-{
-  $mapval=($val-$map_mean)/$map_std;
-}
-
-$i++;
-}
-
-return $mapval;
-}
-
-
-
-?>
-
diff --git a/sourcecodes/test_set_predictions.php b/sourcecodes/test_set_predictions.php
index b6a1df80..b626dea3 100644
--- a/sourcecodes/test_set_predictions.php
+++ b/sourcecodes/test_set_predictions.php
@@ -85,6 +85,16 @@ else if(file_exists($filename2))
   {?>
   <br>
   <h2> <a href=<?php $d="./data/".$keyval."ts_output.txt"; print($d);?>>View predictions</a></h2>
+<?php
+   $plotly_file="./data/".$keyval."ts_plotly.html";
+   if(file_exists($plotly_file))
+     {?>
+     <div>
+	 <object type="text/html" data=<?php print($plotly_file);?> width="800" height="500" >
+         </object>
+     </div>
+ <?php
+      }?>    
   <br>
 <h3>Make a new set of predictions by submitting data file below</h3>
 <FORM name="key_search" enctype="multipart/form-data" ACTION="test_set_predictions.php" METHOD=POST>
@@ -146,7 +156,7 @@ if($searchID!="")
       $fpdata = fopen("./data/".$keyval."ts_input.txt","w");
       fwrite($fpdata,$searchID);
     }
-  $command = './run_test_set '.$keyval;
+  $command = './run_scripts/run_test_set '.$keyval;
   $output = shell_exec("$command > /dev/null 2 > /dev/null &");
   $pred_link='cv_predictions.php?My_key='.$keyval;
 }
diff --git a/sourcecodes/test_set_predictions_example.php b/sourcecodes/test_set_predictions_example.php
index bdaeb170..1ad96f80 100644
--- a/sourcecodes/test_set_predictions_example.php
+++ b/sourcecodes/test_set_predictions_example.php
@@ -146,7 +146,7 @@ if($searchID!="")
       $fpdata = fopen("./data/".$keyval."ts_input.txt","w");
       fwrite($fpdata,$searchID);
     }
-  $command = './run_test_set '.$keyval;
+  $command = './run_scripts/run_test_set '.$keyval;
   $output = shell_exec("$command > /dev/null 2 > /dev/null &");
   $pred_link='cv_predictions_example.php?My_key='.$keyval;
 }
diff --git a/sourcecodes/ts_plotly.py b/sourcecodes/ts_plotly.py
new file mode 100644
index 00000000..bd7d1405
--- /dev/null
+++ b/sourcecodes/ts_plotly.py
@@ -0,0 +1,157 @@
+#!/home/jziebart/python/Python-2.7.15/python
+import os
+import sys
+
+#sys.path.append('/home/jziebart/.local/bin')
+#sys.path.append('/home/jziebart/.local/lib')
+
+import plotly
+import plotly.graph_objs as go
+import csv
+import string
+
+netID = sys.argv[-1]
+outfile = netID+"ts_plotly.html"
+
+ 
+filename=netID+"ts_output.txt"
+f=open(filename,"r")
+#Read the first line to get the variable name
+line=f.readline()
+line = map(string.strip,line.strip().split(" "))
+varName = line[-1]
+
+print varName
+
+#Read type file to determine if it is continuous or discrete
+typefile = netID+"type.txt"
+tf=open(typefile,"r")
+line=tf.readline()
+varnames = map(string.strip,line.strip().split("\t"))
+print varnames
+line=tf.readline()
+vartypes = map(string.strip,line.strip().split("\t"))
+varindex = varnames.index(varName)
+cd_type = int(vartypes[varindex])
+
+
+if cd_type == 1:
+    #Make scatterplot for continuous_data
+    #Read introductory lines from file
+    for i in range(6):
+        line = f.readline()
+    #Read the data
+    x = []
+    y = []
+    line = f.readline()
+    while line:
+        line = map(string.strip,line.strip().split("\t"))
+        if line[1] != 'NA':     
+            x.append(float(line[1]))
+            y.append(float(line[2]))
+        line=f.readline()
+
+    data = [go.Scatter(x=x,y=y,mode='markers')]
+    layout = go.Layout(
+        xaxis=dict(
+            autorange=True,
+            title='Actual values',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            ),
+        yaxis=dict(
+            autorange=True,
+            title='Predicted values',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            )
+        )
+    fig = go.Figure(data=data, layout = layout)
+    plotly.offline.plot(fig,filename=outfile)
+
+else:
+    #Make bar chart for discrete data
+    #Read introductory lines from file
+    for i in range(5):
+        line = f.readline()
+    #Get names of states
+    line = map(string.strip,line.strip().split("\t"))
+    states = line[2:]
+    #Read the data
+    actual = []
+    predicted = []
+    line = f.readline()
+    while line:
+        line = map(string.strip,line.strip().split("\t"))
+        if line[1] != 'NA':
+            actual.append(line[1])
+            predict_x = line[2:]
+            predict_x = [float(x) for x in predict_x]
+            max_value = max(predict_x)
+            max_index = predict_x.index(max_value)
+            predicted.append(states[max_index])
+            #check if multiple states are equally likely to be predicted states
+            #I am not going to count these as being predicted here
+            max_items = [x for x in predict_x if (abs(x-max_value) < 0.000001)]
+            if len(max_items) > 1:
+                predicted.pop()
+                actual.pop()
+        line=f.readline()
+    
+    #Go through states and get number of true positives, false positives, and false negatives
+    tp_all = []
+    fp_all = []
+    fn_all = []
+    for state in states:
+        tp = 0
+        fp = 0
+        fn = 0
+        for i in range(len(actual)):
+            actual_i = actual[i]
+            predicted_i = predicted[i]
+            if actual_i == state:
+                if predicted_i == state:
+                    tp = tp + 1
+                else:
+                    fn = fn + 1
+            elif predicted_i == state:
+                fp = fp + 1
+        tp_all.append(tp)
+        fn_all.append(fn)
+        fp_all.append(fp)
+    print tp_all
+    print fn_all
+    print fp_all
+    trace1 = go.Bar(x=states,y=tp_all,name="True Positives")
+    trace2 = go.Bar(x=states,y=fn_all,name="False Negatives")
+    trace3 = go.Bar(x=states,y=fp_all,name="False Positives")
+    data = [trace1,trace2,trace3]
+    layout = go.Layout(
+        barmode='group',
+        xaxis=dict(
+            autorange=True,
+            title='State',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            ),
+        yaxis=dict(
+            autorange=True,
+            title='Number of cases',
+            titlefont=dict(
+                family='Arial, sans-serif',
+                size=18,
+                color='black'
+                ),
+            )
+    )
+    fig = go.Figure(data=data, layout = layout)
+    plotly.offline.plot(fig,filename=outfile)
diff --git a/sourcecodes/upload_structure_file.php b/sourcecodes/upload_structure_file.php
index 170bcfae..9eb6694b 100644
--- a/sourcecodes/upload_structure_file.php
+++ b/sourcecodes/upload_structure_file.php
@@ -123,7 +123,7 @@ if($searchID!="")
       $fpdata = fopen($dir.$keyval."continuous_input_orig.txt","w");
       fwrite($fpdata,$searchID);
   }  
-  shell_exec('./run_prep_input '.$keyval);
+  shell_exec('./run_scripts/run_prep_input '.$keyval);
 ?>
 <ul class="navbar2">
   <li><a href="net_structure.php?My_key=<?php print($keyval);?>">Upload structure file</a>