about summary refs log tree commit diff
path: root/sourcecodes/bn_after_upload_gom.php
diff options
context:
space:
mode:
authorziejd22021-02-24 14:36:59 -0600
committerziejd22021-02-24 14:36:59 -0600
commit25b843f6bbacb1937bdb960777b73acbece64115 (patch)
tree88645b9d1d8a0eea19d7229555bf8805571bc8b7 /sourcecodes/bn_after_upload_gom.php
parent33cedf36248f616aa37d1462c69a4a3058a5d92e (diff)
downloadBNW-25b843f6bbacb1937bdb960777b73acbece64115.tar.gz
GENENET8 update
Diffstat (limited to 'sourcecodes/bn_after_upload_gom.php')
-rw-r--r--sourcecodes/bn_after_upload_gom.php147
1 files changed, 80 insertions, 67 deletions
diff --git a/sourcecodes/bn_after_upload_gom.php b/sourcecodes/bn_after_upload_gom.php
index d7435cfd..11a92650 100644
--- a/sourcecodes/bn_after_upload_gom.php
+++ b/sourcecodes/bn_after_upload_gom.php
@@ -1,8 +1,16 @@
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+
 <?php
+   // This file is copied form bn_file_load_gom.php with some lines commented out.
+   //It is used by modify_structure_learning.php to copy the input file over
+   // and begin structure learning.
+
   //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.
-
+//<link rel="stylesheet" href="./scripts/table.css" type="text/css">
 include("header_new.inc");
 include("header_batchsearch.inc");
 include("runtime_check.php");
@@ -10,7 +18,7 @@ include("input_validate.php");
 //$searchID="";
 $searchID="YES";
 $UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+$TextFile=$_FILES["MyFile"]["name"];
 
 
 /////////////Generate a random key/////////////////////
@@ -30,14 +38,16 @@ $TextFile=$HTTP_POST_FILES["MyFile"]["name"];
 //  $keyval=valid_keyval($keyval);
 
 //$sid=$keyval."continuous_input";
-//$dir="./data/";
+////$dir="./data/";
+//$dir="/tmp/bnw/";
+//$input_table_file="./data/".$keyval."input_table.txt";
 
 //$TextinFile=$dir.$sid."_orig.txt";
 
 
-if(isset($HTTP_POST_VARS["searchkey"]))
+if(isset($_POST["searchkey"]))
 {
-   $searchID=$HTTP_POST_VARS["searchkey"];
+   $searchID=$_POST["searchkey"];
 
 }
 
@@ -46,8 +56,10 @@ if($searchID=="")
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
+<ul class="navbar2">
+  <li><a href="sample_input.php" target="_blank">View sample input file</a> 
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="about_this_page.php#file_upload" target="_blank">About this page</a>
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
 </ul>
@@ -55,15 +67,15 @@ if($searchID=="")
 }
 
 
-if(isset($HTTP_POST_VARS["MyUpload"]))
+if(isset($_POST["MyUpload"]))
 {
-   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   $UploadValue=$_POST["MyUpload"];
    if ($UploadValue=="YES")
    {
         if($TextFile!="")
         {
 	  //	  $TextFile = valid_input($TextFile);
-            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+            $sta=move_uploaded_file($_FILES['MyFile']['tmp_name'],$TextinFile);
             if(!$sta)
             {
                  echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>";
@@ -88,57 +100,29 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
 
 ?>
 <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();">
+  <h3>Upload data file for structure learning search:</h3>
+<br>
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="bn_file_load_gom.php" METHOD=POST>
+
+<INPUT style="background-color:#FFFFFF;" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" >
+<label for="MyFile_id">Choose a file. . .</label> 
 <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>
+<textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br>
+<br>
+<br>
 </FORM>
 </div>
 
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
+
 <?php
 
 if($searchID!="")
@@ -151,27 +135,44 @@ if($searchID!="")
   //$keyval = valid_keyval($keyval);
   //shell_exec('./run_scripts/run_prep_input '.$keyval);
   $keyval=valid_keyval($_GET["My_key"]);
+  $input_table_file="/var/lib/genenet/bnw/".$keyval."input_table.txt";
   $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="about_this_page.php#file_upload" target="_blank">About this page</a>
 <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");
+<div id="outernew_load">
+<br>
+   <a class=button3 href="executionprogress_default.php?My_key=<?php print($keyval);?>">Perform Bayesian network modeling using default settings. Estimated runtime: <?php print($runtime);?> seconds</a>
+<br>
+<a class=button3 href="create_tiers_gom_part1.php?My_key=<?php print($keyval);?>">Go to structure learning settings and the BNW structural constraint interface</a>
+<br>
+<a class=button3 href="remove_variables.php?My_key=<?php print($keyval);?>">Remove variables from data set</a>  
+<br>
+<br>
+<p><h3>The uploaded data file has the following properties:
+<br></h3>
+<?php
+$table_text = json_encode(file("file://".$input_table_file));
 ?>
-<br><br><br><br></h3>
+  <div class="d3_table" id="table_div1">
+  <script type="text/javascript">
+   d3.text("", function(error, raw_temp){
+       var dsv = d3.dsvFormat("\t");
+         var data1 = <?php echo $table_text;?>;
+         var data2 = data1.join("");
+	 var data = dsv.parse(data2);
+	 var caption_text = data.pop();
+       if (error) throw error;
+       tabulate_caption("#table_div1",data,caption_text.Variable);
+     });
+</script>
+</div>
+<br><br><br></h3>
 </p>
 <br>
 <br>
@@ -180,6 +181,18 @@ print("Estimated run time for current dataset using default settings: $runtime s
 <br>
 <br>
 <br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
 </div>
 <?php
 }