Skip to content
This repository
Browse code

phylomel: misc

  • Loading branch information...
commit c4fa3d2d4caf836e737d5c00cb65664b733597bb 1 parent 2e15a18
Yoann Padioleau aryx authored
0  external/phylomel/opengl/utils.ml 100755 → 100644
File mode changed
7 external/phylomel/src/forceDirectedLayout.mli
... ... @@ -0,0 +1,7 @@
  1 +
  2 +val do_calc_forces:
  3 + Vec2.t array -> BarnesHut.body array -> Phylogram.tree_figure -> unit
  4 +
  5 +val body_of_pos:
  6 + ?v:Vec2.t -> Vec2.t -> BarnesHut.body
  7 +
14 external/phylomel/src/phylogram.ml
@@ -164,7 +164,7 @@ let radial_layout ?(margin= (10.,10.)) ?(reframe = false) width tree =
164 164 crop_height h' xs
165 165 *)
166 166
167   -let put_points out ?(links_info = None) fig genos =
  167 +let put_points out ?(links_info = None) fig nodeinfo =
168 168 let printPoint i {x=x; y=y} =
169 169
170 170 Svg.circle out
@@ -179,7 +179,7 @@ let put_points out ?(links_info = None) fig genos =
179 179 Svg.text out
180 180 ~anchor:"middle"
181 181 ~weight:"bold"
182   - (Genotype.description genos.(i))
  182 + (nodeinfo i)
183 183 (x, y+.4.)
184 184 | Some(links,target) ->
185 185 let link = links.(i) in
@@ -188,7 +188,7 @@ let put_points out ?(links_info = None) fig genos =
188 188 ~weight:"bold"
189 189 ~link:link
190 190 ~target:target
191   - (Genotype.description genos.(i))
  191 + (nodeinfo i)
192 192 (x, y+.4.)
193 193 end;
194 194
@@ -234,7 +234,7 @@ let put_lines out fig =
234 234
235 235 Array.iteri print_line ps
236 236
237   -let write_svg ?(links_info = None) collec fig out =
  237 +let write_svg ?(links_info = None) nodeinfo fig out =
238 238 (*let x0, y0 = margin in
239 239 let fig = reframe ~margin:margin fig in
240 240 let fig = crop_width (float_of_int(w) -. 2.*.x0) fig in*)
@@ -244,14 +244,14 @@ let write_svg ?(links_info = None) collec fig out =
244 244 Svg.put out (Svg.header w h);
245 245
246 246 put_lines out fig;
247   - put_points out ~links_info:links_info fig collec.Genotypes.genos;
248 247
  248 + put_points out ~links_info:links_info fig nodeinfo;
249 249 Svg.close out
250 250
251   -let write_svg_file ?(links_info = None) collec fig file =
  251 +let write_svg_file ?(links_info = None) nodeinfo fig file =
252 252 let out = IO.output_channel (open_out file) in
253   - write_svg ~links_info:links_info collec fig out
254 253
  254 + write_svg ~links_info:links_info nodeinfo fig out
255 255
256 256 (*let test =
257 257 let t = {
4 external/phylomel/tests/geno_simple
... ... @@ -0,0 +1,4 @@
  1 +country;town
  2 +200;0,0,1,2;g0;xx
  3 +201;0,0,1,3;g1;yy
  4 +202;1,0,1,2;g2;zz
26 main_pm_depend.ml
@@ -118,6 +118,25 @@ let test_phylomel geno_file =
118 118 in
119 119 let dmat = GenoMat.create collec in
120 120 let tree = Tree.prim_complete collec dmat in
  121 +(*
  122 + let dist_mat =
  123 + [|
  124 + [||];
  125 + [|1|];
  126 + [|1;2|];
  127 + |]
  128 + in
  129 + let adj_mat =
  130 + [|
  131 + [||];
  132 + [|true|];
  133 + [|true;false|];
  134 + |]
  135 + in
  136 +
  137 + let tree = Tree.create adj_mat dist_mat in
  138 + let infos = [|"n0"; "n1"; "n2"|] in
  139 +*)
121 140
122 141 let fig = Phylogram.radial_layout ~reframe:false 800. tree in
123 142
@@ -138,8 +157,13 @@ let test_phylomel geno_file =
138 157 (* let x0 = 10. in *)
139 158 (* unsafe_reframe (10., 10.) fig.ps; *)
140 159 (* unsafe_crop_width (800.-.2.*.x0) fig.ps; *)
  160 +
  161 + let nodeinfo =
  162 + (fun i -> Genotype.description collec.Genotypes.genos.(i))
  163 + (* (fun i -> infos.(i)) *)
  164 + in
141 165
142   - Phylogram.write_svg_file collec fig svg_file;
  166 + Phylogram.write_svg_file nodeinfo fig svg_file;
143 167 ()
144 168
145 169
3  project.el
@@ -295,9 +295,10 @@
295 295 (join-string
296 296 (list
297 297 "-debugger"
298   - (case 0
  298 + (case 1
299 299
300 300 (0 "-test_phylomel /home/pad/pfff/external/phylomel/tests/geno0 ")
  301 + (1 "-test_phylomel /home/pad/pfff/external/phylomel/tests/geno_simple")
301 302 )
302 303 )
303 304 )

0 comments on commit c4fa3d2

Please sign in to comment.
Something went wrong with that request. Please try again.