Skip to content

Commit cd30a54

Browse files
committed
update python calls in fluxdiagrams.jl
1 parent fc9bcec commit cd30a54

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

src/fluxdiagrams.jl

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ function drawspc(spc::Species,path::String=".")
4242
end
4343
end
4444
if spc.inchi != ""
45-
mol = molecule[:Molecule]()[:fromInChI](spc.inchi)
45+
mol = molecule.Molecule().fromInChI(spc.inchi)
4646
elseif spc.smiles != ""
47-
mol = molecule[:Molecule]()[:fromSMILES](spc.smiles)
47+
mol = molecule.Molecule().fromSMILES(spc.smiles)
4848
else
4949
throw(error("no smiles or inchi for molecule $name"))
5050
end
51-
mol[:draw](joinpath(path,fname))
51+
mol.draw(joinpath(path,fname))
5252
end
5353
export drawspc
5454

@@ -203,16 +203,16 @@ function makefluxdiagrams(bsol,ts;centralspecieslist=Array{String,1}(),superimpo
203203
end
204204
end
205205

206-
graph = pydot[:Dot]("flux_diagram",graph_type="digraph",overlap="false")
207-
graph[:set_rankdir]("LR")
208-
graph[:set_fontname]("sans")
209-
graph[:set_fontsize]("10")
206+
graph = pydot.Dot("flux_diagram",graph_type="digraph",overlap="false")
207+
graph.set_rankdir("LR")
208+
graph.set_fontname("sans")
209+
graph.set_fontsize("10")
210210

211211
for index in nodes
212212
species = specieslist[index]
213-
node = pydot[:Node](name=species.name)
214-
node[:set_penwidth](maximumnodepenwidth)
215-
graph[:add_node](node)
213+
node = pydot.Node(name=species.name)
214+
node.set_penwidth(maximumnodepenwidth)
215+
graph.add_node(node)
216216

217217
speciesindex = string(species.name,".png")
218218
imagepath = ""
@@ -228,22 +228,22 @@ function makefluxdiagrams(bsol,ts;centralspecieslist=Array{String,1}(),superimpo
228228
end
229229
end
230230
if isfile(imagepath)
231-
node[:set_image](imagepath)
232-
node[:set_label](" ")
231+
node.set_image(imagepath)
232+
node.set_label(" ")
233233
end
234234
end
235235

236236
for (reactantindex,productindex) in edges
237237
if reactantindex in nodes && productindex in nodes
238238
reactant = specieslist[reactantindex]
239239
product = specieslist[productindex]
240-
edge = pydot[:Edge](reactant.name,product.name)
241-
edge[:set_penwidth](maximumedgepenwidth)
242-
graph[:add_edge](edge)
240+
edge = pydot.Edge(reactant.name,product.name)
241+
edge.set_penwidth(maximumedgepenwidth)
242+
graph.add_edge(edge)
243243
end
244244
end
245245

246-
graph = pydot[:graph_from_dot_data](graph[:create_dot](prog="dot"))[1]
246+
graph = pydot.graph_from_dot_data(graph.create_dot(prog="dot"))[1]
247247

248248
for t in 1:length(ts)
249249
slope = -maximumnodepenwidth / log10(concentrationtol)
@@ -255,15 +255,15 @@ function makefluxdiagrams(bsol,ts;centralspecieslist=Array{String,1}(),superimpo
255255
species_string = string("\"",species.name,"\"")
256256
end
257257

258-
node = graph[:get_node](species_string)[1]
258+
node = graph.get_node(species_string)[1]
259259
concentration = concentrations[index,t] / maxconcentration
260260
if concentration < concentrationtol
261261
penwidth = 0.0
262262
else
263263
penwidth = round((slope*log10(concentration)+maximumnodepenwidth)*1.0e3)/1.0e3
264264
end
265265

266-
node[:set_penwidth](penwidth)
266+
node.set_penwidth(penwidth)
267267
end
268268

269269
slope = -maximumedgepenwidth / log10(speciesratetolerance)
@@ -294,25 +294,25 @@ function makefluxdiagrams(bsol,ts;centralspecieslist=Array{String,1}(),superimpo
294294
product_string = string("\"",product.name,"\"")
295295
end
296296

297-
edge = graph[:get_edge](reactant_string,product_string)[1]
297+
edge = graph.get_edge(reactant_string,product_string)[1]
298298

299299
speciesrate = speciesrates[reactantindex,productindex,t] / maxspeciesrate
300300
if speciesrate < 0
301-
edge[:set_dir]("back")
301+
edge.set_dir("back")
302302
speciesrate = -speciesrate
303303
else
304-
edge[:set_dir]("forward")
304+
edge.set_dir("forward")
305305
end
306306

307307
if speciesrate < speciesratetolerance
308308
penwidth = 0.0
309-
edge[:set_dir]("none")
309+
edge.set_dir("none")
310310
else
311311
penwidth = round((slope*log10(speciesrate) + maximumedgepenwidth)*1.0e3)/1.0e3
312312
end
313313

314-
edge[:set_penwidth](penwidth)
315-
edge[:set_color](getcolor(speciesrates[reactantindex,productindex,t],maxspeciesrate,minspeciesrate,colorscheme))
314+
edge.set_penwidth(penwidth)
315+
edge.set_color(getcolor(speciesrates[reactantindex,productindex,t],maxspeciesrate,minspeciesrate,colorscheme))
316316

317317
end
318318
end
@@ -324,10 +324,10 @@ function makefluxdiagrams(bsol,ts;centralspecieslist=Array{String,1}(),superimpo
324324
label = "t = 10^$tval s"
325325
end
326326

327-
graph[:set_label](label)
328-
graph[:write_dot](joinpath(outputdirectory,"flux_diagram_$t.dot"))
329-
graph[:write_png](joinpath(outputdirectory,"flux_diagram_$t.png"))
330-
graph[:write_svg](joinpath(outputdirectory,"flux_diagram_$t.svg"))
327+
graph.set_label(label)
328+
graph.write_dot(joinpath(outputdirectory,"flux_diagram_$t.dot"))
329+
graph.write_png(joinpath(outputdirectory,"flux_diagram_$t.png"))
330+
graph.write_svg(joinpath(outputdirectory,"flux_diagram_$t.svg"))
331331
end
332332
return FluxDiagram(ts,outputdirectory)
333333
end

0 commit comments

Comments
 (0)