Skip to content
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

Minor edit to atom_name_to_molsetup_index; Support input in both ways: --macromol (ProDy) and --pdb (RDKit) #172

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions meeko/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,16 @@ def get_basetype_and_order(self, atype):


def atom_name_to_molsetup_index(chorizo_residue, atom_name):
indices = []
for atom in chorizo_residue.raw_rdkit_mol.GetAtoms():
name = atom.GetPDBResidueInfo().GetName().strip()
if name == atom_name:
indices.append(atom.GetIdx())

# get matched indices from parameterized chorizo_residue
indices = [index for index, name in enumerate(chorizo_residue.atom_names) if name == atom_name]

if len(indices) > 1:
raise RuntimeError(f"multiple atoms matched query atom name {atom_name}")
if len(indices) == 0:
return None

index = indices[0]
index = chorizo_residue.mapidx_from_raw[index]
inv = {j: i for i, j in chorizo_residue.molsetup_mapidx.items()}
index = inv[index]
return index
Expand Down
Loading