-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Big smiles #358
Big smiles #358
Conversation
…molecule including edges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the functionality, but I'm not super happy with the parser code tbh. As it is I wouldn't like to have to take over its maintenance
@pckroon thanks for the comments! I don't understand your worry about the parser maintenance. This is a wrapper around pysmiles that lives in the polyply repro. So maintenance only goes as far as your polyply commitments go. |
That's the standard I aim for when reviewing ;) |
Co-authored-by: Peter C Kroon <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting there, still some comments ;)
hcount = VALENCES[element][0] -\ | ||
self.meta_molecule.molecule.degree(node) + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VALENCES[element][0]
doesn't always work. You need to select the smallest valence that is larger than the current number of bonds present.
Also, why +1?
if stop < len(pattern) and pattern[stop] == '|': | ||
# eon => end of next |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor eon -> end_of_next
?
|
||
# add the new residue | ||
# new we add new residue as often as required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# new we add new residue as often as required | |
# now we add new residue as often as required |
prev_node = anchor | ||
# the outermost loop goes over how often a the branch has to be | ||
# added to the existing sequence | ||
for idx in range(0,int(pattern[eon_a+2:eon_b])-1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a variable repetition_number
or something to aid readability
for idx in range(0,int(pattern[eon_a+2:eon_b])-1): | |
repetition_number = int(pattern[eon_a+2:eon_b])-1 | |
for idx in range(0, repetition_number): |
Also, why -1?
mol_graph.nodes[node]['hcount'] = hcount - len(mol_graph.nodes[node]['bonding']) | ||
# get the degree | ||
ele = mol_graph.nodes[0]['element'] | ||
# hcoung is the valance minus the degree minus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# hcoung is the valance minus the degree minus | |
# hcount is the valence minus the degree minus |
# nx.draw_networkx(meta_mol.molecule, with_labels=True, labels=nx.get_node_attributes(meta_mol.molecule, 'element')) | ||
# plt.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# nx.draw_networkx(meta_mol.molecule, with_labels=True, labels=nx.get_node_attributes(meta_mol.molecule, 'element')) | |
# plt.show() |
for node in mol_graph.nodes: | ||
if mol_graph.nodes[node].get('bonding', False): | ||
# get the degree | ||
ele = mol_graph.nodes[0]['element'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 290 needs to be updated to node instead of just taking 0
retired in favor of cgsmiles |
Implements parsing capabilities for an adopted BigSmiles format. This format allows to specify both the residue graph well as any all-atom molecule utilising a string-based description similar to a smile.