From c4f926438dcb8abe805e910399940f79ff643c4b Mon Sep 17 00:00:00 2001
From: ziejd2
Date: Thu, 14 Sep 2017 15:39:41 -0500
Subject: Add files via upload
---
sourcecodes/network_layout_evd_2_example.php | 953 +++++++++++++++++++++++++++
1 file changed, 953 insertions(+)
create mode 100644 sourcecodes/network_layout_evd_2_example.php
(limited to 'sourcecodes/network_layout_evd_2_example.php')
diff --git a/sourcecodes/network_layout_evd_2_example.php b/sourcecodes/network_layout_evd_2_example.php
new file mode 100644
index 00000000..055216e3
--- /dev/null
+++ b/sourcecodes/network_layout_evd_2_example.php
@@ -0,0 +1,953 @@
+ $line)
+{
+ $data_cell_ev=explode("\t",$line);
+ foreach ($data_cell_ev as $ld)
+ {
+ $ldd=trim($ld);
+ if($ldd !="")
+ {
+ $ev_arr[$cev]=$ldd;
+ $cev++;
+ //echo "Line #{$line_num} : " . htmlspecialchars($ldd) . "
\n";
+ }
+ }
+
+}
+
+$lf=$dir."$keyval"."vardata.txt";
+$linesd = file("$lf");
+
+$cevdata=0;
+// Loop through our array, show HTML source as HTML source; and line numbers too.
+foreach ($linesd as $line_num => $line)
+{
+
+ $data_cell_ev=explode("\t",$line);
+ foreach ($data_cell_ev as $ld)
+ {
+ $ldd=trim($ld);
+ if($ldd !="")
+ {
+ $evdata_arr[$cevdata]=$ldd;
+ $cevdata++;
+ //echo "Line #{$line_num} : " . htmlspecialchars($ldd) . "
\n";
+
+
+ }
+ }
+
+}
+
+
+
+////////////////////////////////////Read data from net_figure file///////////////////////Graphp Display/////////////////////////////////////////////
+
+
+$matfile=$dir.$keyval."net_figure_new.txt";
+
+$data_val="";
+
+$matrix=file("$matfile");
+$matrix1=file_get_contents("$matfile"); //file("$matfile");
+
+
+$str_arrmat=array();
+$str_arrmat=explode("\n",$matrix1);
+
+$node=trim($str_arrmat[1]);
+
+if($str_arrmat[2]=="" || $matrix1=="")
+{
+?>
+
Error: Unable to display your network structure.
+5 && $node<=7)
+{
+ $width=150;
+ $hieght=120;
+ $font=10;
+
+}
+else if($node>7 && $node<=10)
+{
+ $width=110;
+ $hieght=85;
+ $font=8;
+}
+else
+{
+ $width=80;
+ $hieght=60;
+ $font=7;
+}
+*/
+ $width=150;
+ $hieght=150;
+ $font=12;
+
+
+$datamat=array();
+$data_read=array();
+
+$r_index=$node+3;
+
+for($i=0;$i<$node;$i++)
+{
+ $datamat=explode("\t",$str_arrmat[$r_index]);
+ $data_read[$i][0]=trim($datamat[0]); //name
+ $data_read[$i][1]=trim($datamat[1]); //datatype
+ $nodetype=$data_read[$i][1];
+ $col_in=2;
+ $r_index+=4;
+ $evd=-9999;
+ $name=$data_read[$i][0];
+ for($ii=0;$ii<$cev;$ii++)
+ {
+ if($ev_arr[$ii]==$name)
+ {
+ $evd=$evdata_arr[$ii];
+ if($nodetype>1)
+ $evd=levelmap($evd,$data_read[$i][0],$levelmap);
+
+ break;
+ }
+ }
+
+ if($evd!=-9999)//with evidence
+ {
+ $datamat=explode("\t",$str_arrmat[$r_index]);
+ $data_read[$i][$col_in]=trim($datamat[0]); //x data
+ $col_in++;
+ $data_read[$i][$col_in]=trim($datamat[1]); //y data
+ $col_in++;
+ $r_index++; // increment to point next data
+
+
+ }
+ else //without evidence
+ {
+ if($nodetype==1) //type=coninuous
+ {
+ for($j=1;$j<=101;$j++)
+ {
+ $datamat=explode("\t",$str_arrmat[$r_index]);
+ $data_read[$i][$col_in]=trim($datamat[0]); //x data
+ $col_in++;
+ $data_read[$i][$col_in]=trim($datamat[1]); //y data
+ $col_in++;
+ $r_index++; // increment to point next data
+
+ }
+ }
+ if($nodetype>1) //type=descrete
+ {
+ $iter=$datamat[1];
+ for($j=1;$j<=$iter;$j++)
+ {
+ $datamat=explode("\t",$str_arrmat[$r_index]);
+ $data_read[$i][$col_in]=trim($datamat[0]); //x data
+ $data_read[$i][$col_in]=levelmap($data_read[$i][$col_in],$data_read[$i][0],$levelmap);
+ $col_in++;
+ $data_read[$i][$col_in]=trim($datamat[1]); //y data
+ $col_in++;
+ $r_index++; // increment to point next data
+ //echo "
";
+ }
+ }
+
+ }
+
+}
+
+
+$matfile_old=$dir.$keyval."net_figure.txt";
+
+$data_val="";
+
+$matrix_old=file("$matfile_old");
+$matrix1_old=file_get_contents("$matfile_old"); //file("$matfile");
+$str_arrmat_old=array();
+$str_arrmat_old=explode("\n",$matrix1_old);
+$datamat_old=array();
+$data_read_old=array();
+$node_old=trim($str_arrmat_old[0]);
+$r_index_old=$node_old+2;
+
+for($i=0;$i<$node_old;$i++)
+{
+ $datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
+ $data_read_old[$i][0]=trim($datamat_old[0]); //name
+ $data_read_old[$i][1]=trim($datamat_old[1]); //datatype
+ $col_in_old=2;
+ $r_index_old+=4;
+ if($datamat_old[1]==1) //type=coninuous
+ {
+ for($j=1;$j<=101;$j++)
+ {
+ $datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
+ $data_read_old[$i][$col_in_old]=trim($datamat_old[0]); //x data
+
+ $col_in_old++;
+ $data_read_old[$i][$col_in_old]=trim($datamat_old[1]); //y data
+
+ $col_in_old++;
+ $r_index_old++; // increment to point next data
+
+ }
+ }
+ if($datamat_old[1]>1) //type=descrete
+ {
+ $iter=$datamat_old[1];
+ for($j=1;$j<=$iter;$j++)
+ {
+ $datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
+ $data_read_old[$i][$col_in_old]=trim($datamat_old[0]); //x data
+ //$data_read_old[$i][$col_in_old]='y';
+ $data_read_old[$i][$col_in_old]=levelmap($data_read_old[$i][$col_in_old],$data_read_old[$i][0],$levelmap);
+
+ $col_in_old++;
+ $data_read_old[$i][$col_in_old]=trim($datamat_old[1]); //y data
+ $col_in_old++;
+ $r_index_old++; // increment to point next data
+
+ }
+ }
+}
+
+
+////////////////////////////////////////////////Graphviz data read////////////////////////////////////////////////////////////////////////////////
+$grv=$dir.$keyval."graphviz.txt";
+$line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
+
+
+//$grfilename=$keyval."graphviz.txt";
+//$cmd="/usr/bin/dot -Tplain -y $grfilename";
+//$line=system($cmd);
+
+
+
+//shell_exec('/usr/bin/dot -Tpng -o /var/www/html/compbio/BNW/graphviz.png /var/www/html/compbio/BNW/graphviz.txt');
+$str_arrname=array();
+$str_arrname=explode("\n",$line);
+$data=array();
+$ID_data=array();
+$i=0;
+$ii=0;
+foreach($str_arrname as $row)
+{
+ $i++;
+ if($i>1)
+ {
+
+ $data=explode(" ",$row);
+ $j=0;
+ $k=0;
+ $flag=0;
+ foreach($data as $cell)
+ {
+
+ $j++;
+
+ $cell=trim($cell);
+ //echo $cell;
+ //echo ' ';
+ if($j==1 && $cell=="node")
+ {
+ $flag=1;
+ }
+
+ if($j>1 && $j<5 && $flag==1)
+ {
+ //echo $cell;
+ //echo ' ';
+ if($j==2)
+ $ID_data[$ii][$k]=$cell;
+ else
+ $ID_data[$ii][$k]=round($cell/10*900);
+ // echo $ID_data[$ii][$k];
+ //echo ' ';
+
+ $k++;
+ }
+ }
+
+ if($flag==1)
+ {
+ $ID_data[$ii][3]=$ID_data[$ii][1]+100;
+ $ID_data[$ii][4]=$ID_data[$ii][2]+150;
+ $ID_data[$ii][5]=$ID_data[$ii][1]+100;
+ $ID_data[$ii][6]=$ID_data[$ii][2];
+ $ii++;
+ //echo "
";
+ }
+ // echo "
";
+
+ }
+}
+
+$nnode=$ii;
+$edge_data=array();
+
+$i=0;
+$ii=0;
+
+foreach($str_arrname as $row)
+{
+ $i++;
+ if($i>1)
+ {
+
+ $data=explode(" ",$row);
+ $j=0;
+
+ $flag=0;
+ $number_of_point=0;
+ $index=0;
+ foreach($data as $cell)
+ {
+ $j++;
+ $cell=trim($cell);
+
+ if($j==1 && $cell=="edge")
+ {
+ $flag=1;
+ }
+
+ if($j==2 && $flag==1)
+ {
+
+ for($k=0;$k<$nnode;$k++)
+ {
+ if($cell==$ID_data[$k][0])
+ {
+ $edge_data[$ii][0]=$ID_data[$k][3];
+ $edge_data[$ii][1]=$ID_data[$k][4];
+ }
+
+ }
+
+ }
+ else if($j==3 && $flag==1)
+ {
+ for($k=0;$k<$nnode;$k++)
+ {
+ if($cell==$ID_data[$k][0])
+ {
+ $edge_data[$ii][2]=$ID_data[$k][5];
+ $edge_data[$ii][3]=$ID_data[$k][6];
+ }
+
+ }
+
+ }
+ else if($j==4 && $flag==1)
+ {
+ $edge_data[$ii][4]=$cell;
+ $number_of_point=$cell*2;
+ $index=5;
+ }
+ else if($j>4 && $number_of_point>0 && $flag==1)
+ {
+ if(($j%2)!=0)
+ $edge_data[$ii][$index]=round($cell/10*900)+60;//+30+30;
+ else
+ $edge_data[$ii][$index]=round($cell/10*900)+48;//+18+30;
+
+ $number_of_point--;
+ $index++;
+ }
+
+
+
+ }
+ if($flag==1)
+ {
+ $ii++;
+ //echo "
";
+ }
+
+ }
+}
+
+
+$nedges=$ii;
+//echo $nedges;
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit 1.4.1