about summary refs log tree commit diff
path: root/sourcecodes/bn_file_load_gom.php
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bn_file_load_gom.php')
-rw-r--r--sourcecodes/bn_file_load_gom.php154
1 files changed, 90 insertions, 64 deletions
diff --git a/sourcecodes/bn_file_load_gom.php b/sourcecodes/bn_file_load_gom.php
index 3f3ef195..d2480cd4 100644
--- a/sourcecodes/bn_file_load_gom.php
+++ b/sourcecodes/bn_file_load_gom.php
@@ -1,15 +1,19 @@
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+
 <?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.
-
+//<link rel="stylesheet" href="./scripts/table.css" type="text/css">
 include("header_new.inc");
 include("header_batchsearch.inc");
 include("runtime_check.php");
 include("input_validate.php");
 $searchID="";
 $UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+$TextFile=$_FILES["MyFile"]["name"];
 
 
 /////////////Generate a random key/////////////////////
@@ -29,14 +33,18 @@ if($_POST["My_key"]!="")
   $keyval=valid_keyval($keyval);
 
 $sid=$keyval."continuous_input";
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+//$input_table_file="./data/".$keyval."input_table.txt";
+$input_table_file=$dir.$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"];
 
 }
 
@@ -45,8 +53,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>
@@ -54,15 +64,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>";
@@ -87,57 +97,45 @@ 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
+<textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br>
+<br>
+<br>
+<h3>Or load one of the example data sets below:</h3><br>
+<INPUT TYPE="submit" class=button2 value="  Load example data of immune responses to infection with Chlamydia psittaci  " onclick="return demochl();">
 <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
+<br>
+<INPUT TYPE="submit" class=button2 value="  Load example data of a synthetic genetic network with 2 genotypes and 6 traits  " onclick="return demo8nodes();">
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?>> 
+<br>
+<INPUT TYPE="submit" class=button2 value="  Load example data of immune-related gene in the spleens of BXD mice  " onclick="return demospnl();">
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?>>
+<br>
+<INPUT TYPE="submit" class=button2 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
+<br>
+<INPUT TYPE="submit" class=button2 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>
+<br>
 </FORM>
 </div>
 
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
+
 <?php
 
 if($searchID!="")
@@ -154,22 +152,38 @@ if($searchID!="")
   $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>
@@ -178,6 +192,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
 }