diff options
| author | ziejd2 | 2017-09-28 15:04:40 -0500 |
|---|---|---|
| committer | ziejd2 | 2017-09-28 15:04:40 -0500 |
| commit | 8070dc963753142bb86c4ed698d91fd623ed28e7 (patch) | |
| tree | d0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/graphviz_structure.php~ | |
| parent | 7cc31810d53176e805532b2789955f4eedbce6bb (diff) | |
| download | BNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz | |
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/graphviz_structure.php~')
| -rw-r--r-- | sourcecodes/graphviz_structure.php~ | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/sourcecodes/graphviz_structure.php~ b/sourcecodes/graphviz_structure.php~ new file mode 100644 index 00000000..251c7557 --- /dev/null +++ b/sourcecodes/graphviz_structure.php~ @@ -0,0 +1,97 @@ +<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> + + +<?php +include("header_new.inc"); +$keyval=$_GET["My_key"]; + +/////////////////////////////////structure matrix////////////////////////////////////////////////////////// + + +$matfile="./data/".$keyval."structure_input.txt"; +$fout=fopen("./data/".$keyval."graphviz.txt","w"); + +$matrix1=file_get_contents("$matfile"); +$str_arrmat=array(); +$str_arrmat=explode("\n",$matrix1); +$datamat=array(); +$data_cell=array(); + +$dataname=array(); +$dataname=explode("\t",$str_arrmat[0]); +$n=count($dataname); + +$initialstring="digraph G {\n"."size=\"10,10\"; ratio = fill;\n"."node [shape=square,width=1.5];\n"; +$endstring="}"; +fwrite($fout,"$initialstring"); +//fwrite($fouttemp,"$initialstring_temp"); + + +$g_file_name="./data/".$keyval."grviz_name_file.txt"; +$grviz_name_file=fopen($g_file_name,"w"); + +for($i=0;$i<$n;$i++) +{ + $row_name=trim($dataname[$i]); + fwrite($grviz_name_file,"$row_name\n"); +} + +for($i=1;$i<=$n;$i++) +{ + $ii=$i-1; + $row_name=trim($dataname[$ii]); + + + $col_arr=explode("\t",$str_arrmat[$i]); + + + for($j=0;$j<$n;$j++) + { + $col_val=trim($col_arr[$j]); + if($col_val==1) + { + $col_name=trim($dataname[$j]); + fprintf($fout,"%s -> %s;\n",$ii,$j); + //fprintf($fouttemp,"%s -> %s;\n",$row_name,$col_name); + + } + } + + +} +fwrite($fout,"$endstring"); +//fwrite($fouttemp,"$endstring"); + +//shell_exec('/usr/bin/dot -Tpng -o /var/www/html/compbio/BNW/graphviz.jpg /var/www/html/compbio/BNW/graphviztemp.txt'); + +$file1="./data/".$keyval."run_initialstructure.sh"; +$initiallines=file_get_contents("./data/temp_shell_file_initial_structure"); +$all_lines="$initiallines"."$keyval\nfi\nexit"; +$fp = fopen($file1,"w"); +fwrite($fp, "$all_lines\n"); +fclose($fp); +//prepare and execute shell script for matlab with a write lock +//$cmd="./runmat.sh $keyval"; +//system($cmd); +shell_exec('./runmat.sh '.$keyval); +?> +<script> +window.open("layout.php?My_key=<?php print($keyval);?>",'_self',false); +</script> + + + |
