-
Notifications
You must be signed in to change notification settings - Fork 90
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
Unable to select the ligand with Entity selection
node or Ligand
node
#701
Comments
As a workaround currently, if you molecules have bonds imported (which the example structure has) you can use Detection and selection of ligands is something that I have been meaning to return to for some time. The authoring of them in structure files seems to not entirely be standardised. Sometimes they are a separate chain, sometimes they are the same chain but different residue names etc. I came up with a solution that mostly kind of works years ago and haven't had another go. I think I could probably just compare to non-standard residue names and use that for ligands / non-protein or nucleic molecules. Open to suggestions, but I'll have a think about how to try and implement this. |
Thanks for the workaround! |
I have created a workaround will allow the use of the
I'll try to solve these issues and I need to do the testing, and check whether filetypes other than In @staticmethod
def _get_entity_id(array, file):
chain_ids = file.block["entity_poly"]["pdbx_strand_id"].as_array(str)
# the chain_ids are an array of individual items np.array(['A,B', 'C', 'D,E,F'])
# which need to be categorised as [1, 1, 2, 3, 3, 3] for their belonging to individual
# entities
chains = []
idx = []
for i, chain_str in enumerate(chain_ids):
for chain in chain_str.split(","):
chains.append(chain)
idx.append(i)
entity_lookup = dict(zip(chains, idx))
chain_id_int = np.array(
[entity_lookup.get(chain, -1) for chain in array.chain_id], int
)
# NEW CODE:
# overwrite the entity value from the chain for hetero atoms
hetero_idxs = np.nonzero(array.hetero)[0]
# TODO: keep from also including non-proteinogenic amino acids
hetero_types = array.res_name[hetero_idxs]
hetero_types_numeric = max(idx) + 1 + np.unique(hetero_types, return_inverse=True)[1]
# TODO: np.unique sorts the hetero_types and so the order of entity_id gets changed
entity_id_int = chain_id_int
entity_id_int[hetero_idxs] = hetero_types_numeric
return entity_id_int Please let me know what you think. |
I've had a bit of a play around and I think this works OK, but we might need to change the approach than using the We could add another attribute ( Ultimately it's just a problem because Geometry Nodes doesn't support string attributes, otherwise we could just match against the actual residue names rather than having to convert them to some numerical representation. |
Describe the bug
Differentiating between different entities using a
Seperate Atoms
node together with aSelect Entity
node does not work.Select Ligand
nodes is always greyed out.To Reproduce
Seperate Atoms
node (I put it right afterGroup input
)Select Entity
node and connect toSeperate Atoms
-> nothing is displayedSeperate Atoms
node (I put it right afterGroup input
)Select Entity
node and connect toSeperate Atoms
-> nothing is displayedExpected behavior
Entity selection allows to select different entities and or
Ligand
node allows to select the ligand.Error Codes
I think this is probably unrelated?
Desktop (please complete the following information):
Additional context
I also tried importing the different filetypes, which did not seem to make a difference. I tried it on Linux, Windows and with different Blender versions.
From the Small Molecules side of things, selecting the ligand itself would be really nice, and a workaround would be appreciated. Just using the inverse of an
Is Peptide
node does not work in the presence of cofactors (they also get selected) but perhaps in combination with other selectors, I'll try it out some more.The text was updated successfully, but these errors were encountered: