about summary refs log tree commit diff
path: root/sourcecodes/parameter_learning/createSVG.m
diff options
context:
space:
mode:
authorziejd22021-02-24 14:36:59 -0600
committerziejd22021-02-24 14:36:59 -0600
commit25b843f6bbacb1937bdb960777b73acbece64115 (patch)
tree88645b9d1d8a0eea19d7229555bf8805571bc8b7 /sourcecodes/parameter_learning/createSVG.m
parent33cedf36248f616aa37d1462c69a4a3058a5d92e (diff)
downloadBNW-25b843f6bbacb1937bdb960777b73acbece64115.tar.gz
GENENET8 update
Diffstat (limited to 'sourcecodes/parameter_learning/createSVG.m')
-rw-r--r--sourcecodes/parameter_learning/createSVG.m28
1 files changed, 20 insertions, 8 deletions
diff --git a/sourcecodes/parameter_learning/createSVG.m b/sourcecodes/parameter_learning/createSVG.m
index f7cc9b64..2d190b68 100644
--- a/sourcecodes/parameter_learning/createSVG.m
+++ b/sourcecodes/parameter_learning/createSVG.m
@@ -16,6 +16,10 @@ function  [ ] = createSVG( pre )
    %
 
 
+nnodefile=strcat(pre,'nnode.txt');
+fnnode = fopen(nnodefile,'r');
+nnodes = fscanf(fnnode,'%d');
+
 %  open file for input, include error handling
 dfile=strcat(pre,'structure_input.txt');
 
@@ -26,19 +30,20 @@ end
 
 % Read in first line to get the number of nodes and the node labels.
 buffer = fgetl(fin);    %get header line as a string
-nnodes = numel(strfind(buffer,"\t")) + 1;
+
 labels = cell(1,nnodes);
 for j=1:nnodes
+    j, buffer
     [next,buffer] = strtok(buffer);
     labels{j} = next;
 end
 
-
 % Read in the edges
 edges = cell(nnodes,nnodes);
 for i = 1:nnodes
     buffer = fgetl(fin);
     for j = 1:nnodes
+	 i, j, buffer
          [next,buffer] = strtok(buffer);
          edges{i,j} = next;
     end
@@ -48,6 +53,13 @@ end
 % open file to read in model averaging scores
 dfile2=strcat(pre,'structure_input_temp.txt');
 
+%If it does not exist, then just read in the regular structure file
+%%   as the model averaging score file
+if exist(dfile2, 'file') != 2
+   dfile2 = dfile;
+   frewind(dfile2);
+end
+
 if (exist(dfile2) == 0)
   scores = cell(nnodes,nnodes);
   for i = 1:nnodes
@@ -107,11 +119,11 @@ end
 
 outfile = strcat(pre,'graphviz_svg.txt');
 fout = fopen(outfile,'w');
-fprintf(fout,"digraph G {\n");
+fprintf(fout,"digraph \"\" {\n");
 %fprintf(fout,"size=\"10,10\"; ratio = fill;\n");
 fprintf(fout,"size=\"10,10\"; remincross = true;\n");
-fprintf(fout,"node [shape=rectangle, width=1.0, fontsize=22];\n");
-fprintf(fout,"edge [fontsize=16];\n");
+fprintf(fout,"node [shape=box, fontsize=18, margin=\"0.05,0\", height=0.3, rounded=true];\n");
+fprintf(fout,"edge [fontsize=12];\n");
 for i = 1:nedges
   fprintf(fout,"\"%s\" -> \"%s\" [ label=\"%3.2f\", penwidth=\"%3.2f\" ];\n",labels{sources(i)},labels{targets(i)},scores1(i),2*scores1(i));
 end
@@ -121,11 +133,11 @@ fclose(fout);
 
 outfile2 = strcat(pre,'graphviz_svg_no_edge.txt');
 fout2 = fopen(outfile2,'w');
-fprintf(fout2,"digraph G {\n");
+fprintf(fout2,"digraph \"\" {\n");
 %fprintf(fout,"size=\"10,10\"; ratio = fill;\n");
 fprintf(fout2,"size=\"10,10\"; remincross = true;\n");
-fprintf(fout2,"node [shape=rectangle, width=1.0, fontsize=22];\n");
-fprintf(fout2,"edge [fontsize=16];\n");
+fprintf(fout2,"node [shape=box, fontsize=18, margin=\"0.05,0\", height=0.3,rounded=true];\n");
+fprintf(fout2,"edge [fontsize=12];\n");
 for i = 1:nedges
   fprintf(fout,"\"%s\" -> \"%s\" [ penwidth=\"%3.2f\" ];\n",labels{sources(i)},labels{targets(i)},2*scores1(i));
 end