diff options
| author | ziejd2 | 2021-02-24 15:19:03 -0600 |
|---|---|---|
| committer | ziejd2 | 2021-02-24 15:19:03 -0600 |
| commit | 1427e9bf4f85823164b4573a3bcf1ba3ba6b04d0 (patch) | |
| tree | d4356879a9b0a3d44063a6b292ef0197173697af /sourcecodes/matrix.php | |
| parent | a2b306b10fb07f07c63235861ccfe460153e8609 (diff) | |
| download | BNW-1427e9bf4f85823164b4573a3bcf1ba3ba6b04d0.tar.gz | |
Moving final GENENET8 version to master
Diffstat (limited to 'sourcecodes/matrix.php')
| -rw-r--r-- | sourcecodes/matrix.php | 233 |
1 files changed, 60 insertions, 173 deletions
diff --git a/sourcecodes/matrix.php b/sourcecodes/matrix.php index aaf58028..b5e1e89d 100644 --- a/sourcecodes/matrix.php +++ b/sourcecodes/matrix.php @@ -1,189 +1,76 @@ +<head> +<script src="./scripts/d3.v4.min.js"></script> +<script src="./scripts/create_table.js"></script> <?php +include("header_new.inc"); include("input_validate.php"); $keyval=valid_keyval($_GET["My_key"]); -//$dir="./data/"; -$dir="/tmp/bnw/"; +$dir="./data/"; +//$dir="/tmp/bnw/"; -$matfile=$dir.$keyval."structure_input_temp.txt"; -$fpw=fopen($dir.$keyval."Model_Averaging_Scores.txt","w"); -$matrix1=file_get_contents("$matfile"); //file("$matfile"); -fwrite($fpw,$matrix1); -fclose($fpw); -$str_arrmat=array(); -$str_arrmat=explode("\n",$matrix1); -$datamat=array(); -$data_cell=array(); - -$dataname=array(); -$dataname=explode("\t",$str_arrmat[0]); -$n=count($dataname); - - - - - -//echo $m_line; - - -if($matrix1!="") -{?> - <h2> Model Averaging Scores </h2> - <br><table width="90%" align="center" style="background-color:" bordercolor="" border=1 cellspacing="0" cellpadding="0"> - -<tr> -<th> -Name -</th> -<?php +$score_file = $dir.$keyval."structure_input_temp.txt"; +$mat_file = $dir.$keyval."structure_input.txt"; +?> -foreach($dataname as $cell1) -{ - $cell1=trim($cell1); - ?> -<th> <?php print($cell1); ?> </th> +</head> + + +<!-- Site navigation menu --> +<ul class="navbar2"> + <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></a></li> + <li><a href="about_this_page.php#matrix">About this page</a> + <li><a href="help.php">Help</a> + <li><a href="home.php">Home</a> +</ul> + +<body> + <div class="table_div"> + <div class="d3_table" id="table_div1"> + <script type="text/javascript"> + d3.text("<?php print($mat_file);?>", function(error, raw){ + var dsv = d3.dsvFormat("\t") + var data = dsv.parse(raw) + var caption_text = "Structure matrix"; + if (error) throw error; + tabulate_header_row("#table_div1",data,caption_text); + }); +</script> +</div> + <a class=button2 href="<?php print($mat_file);?>">Download structure matrix</a> +<br> +<br> <?php - -} +$filename1="/tmp/bnw/".$keyval."structure_input_temp.txt"; +if(file_exists($filename1)) + { ?> -</tr> -<?php - - for($i=0;$i<$n;$i++) - { - $ii=$i+1; - $datamat=explode("\t",$str_arrmat[$ii]); - - ?> - <tr> - <th> - <?php print trim($dataname[$i]); ?> - </th> - <?php - $dpr=trim($dataname[$i]); - - - foreach($datamat as $cell) - { - $cell=trim($cell); - if($cell!="") - { - ?> - <td> - <?php print $cell; ?> - </td> - <?php - - } - } - ?> - <tr> - <?php - - } - ?> - </table> - -<a href=<?php $d="./data/".$keyval."Model_Averaging_Scores.txt"; print($d);?>>download</a> - -<?php - -} - -/////////////////////////////////Second////////////////////////////////////////////////////////// - - -$matfile=$dir.$keyval."structure_input.txt"; -//echo $matfile; + <div class="d3_table" id="table_div2"> -$fpw=fopen($dir.$keyval."Structure_matrix.txt","w"); + <script type="text/javascript"> -$matrix1=file_get_contents("$matfile"); //file("$matfile"); + d3.text("<?php print($score_file);?>", function(error, raw){ + var dsv = d3.dsvFormat("\t") + var data = dsv.parse(raw) + var caption_text = "Model averaging scores"; + if (error) throw error; + tabulate_header_row("#table_div2",data,caption_text); + }); -fwrite($fpw,$matrix1); -fclose($fpw); +</script> + </div> - - - -$str_arrmat=array(); -$str_arrmat=explode("\n",$matrix1); -$datamat=array(); -$data_cell=array(); - -$dataname=array(); -$dataname=explode("\t",$str_arrmat[0]); -$n=count($dataname); - - - - - -//echo $m_line; - - -if($matrix1!="") -{?> - <h2> Structure Matrix </h2> - <br><table width="90%" align="center" style="background-color:" bordercolor="" border=1 cellspacing="0" cellpadding="0"> - -<tr> -<th> -Name -</th> -<?php - - -foreach($dataname as $cell1) -{ - $cell1=trim($cell1); - ?> -<th> <?php print($cell1); ?> </th> + <a class=button2 href="<?php print($score_file);?>">Download model averaging scores<br></a> +<br> <?php - -} + } ?> -</tr> -<?php - - for($i=0;$i<$n;$i++) - { - $ii=$i+1; - $datamat=explode("\t",$str_arrmat[$ii]); - - ?> - <tr> - <th> - <?php print trim($dataname[$i]); ?> - </th> - <?php - $dpr=trim($dataname[$i]); - - - foreach($datamat as $cell) - { - $cell=trim($cell); - if($cell!="") - { - ?> - <td> - <?php print $cell; ?> - </td> - <?php - - } - } - ?> - <tr> - <?php - - } - ?> - </table> -<?php +<br> +<br> +<br> +<br> +<br> +</div> +</body> -} -?> -<a href=<?php $d="./data/".$keyval."Structure_matrix.txt"; print($d);?>>download<br></a> -<input type=button onClick="self.close();" value="Close this window"> \ No newline at end of file |
