Skip to content

Commit

Permalink
Draw groups using call to Group._repr_png_()
Browse files Browse the repository at this point in the history
Now that the functionality has been integrated into RMG-Py.
  • Loading branch information
mliu49 committed Feb 13, 2017
1 parent 9363be6 commit c2959c8
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions rmgweb/main/views.py
Expand Up @@ -286,27 +286,7 @@ def drawGroup(request, adjlist):
adjlist = str(urllib.unquote(adjlist))
pattern = Group().fromAdjacencyList(adjlist)

graph = pydot.Dot(graph_type='graph', dpi="52")
for index, atom in enumerate(pattern.atoms):
atomType = '%s ' % atom.label if atom.label != '' else ''
atomType += ','.join([atomType.label for atomType in atom.atomType])
atomType = '"' + atomType + '"'
graph.add_node(pydot.Node(name='%i' % (index+1), label=atomType, fontname='Helvetica', fontsize="16"))
for atom1 in pattern.atoms:
for atom2, bond in atom1.bonds.iteritems():
index1 = pattern.atoms.index(atom1)
index2 = pattern.atoms.index(atom2)
if index1 < index2:
bondType = ','.join([order for order in bond.order])
bondType = '"' + bondType + '"'
graph.add_edge(pydot.Edge(
src = '%i' % (index1+1),
dst = '%i' % (index2+1),
label = bondType,
fontname='Helvetica', fontsize = "16",
))

response.write(graph.create(prog='neato', format='png'))
response.write(pattern._repr_png_())

return response

Expand Down

0 comments on commit c2959c8

Please sign in to comment.