diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-07-07 20:48:27 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-07-07 20:48:27 +0530 |
commit | b334659db44942ca1457af4752751b1281da4948 (patch) | |
tree | c2914bb093f1cc78e55fcb43caa2595ccae6b93f /plip/structure/preparation.py | |
parent | 85a0b26230b239f7f5c8655c958dcdee01ca5a7b (diff) |
using PLIP v2.1.3
Diffstat (limited to 'plip/structure/preparation.py')
-rw-r--r-- | plip/structure/preparation.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/plip/structure/preparation.py b/plip/structure/preparation.py index 6b63d63..c2631d3 100644 --- a/plip/structure/preparation.py +++ b/plip/structure/preparation.py @@ -290,20 +290,19 @@ class LigandFinder: ligtype = classify_by_name(names) logger.debug(f'ligand classified as {ligtype}') - hetatoms = set() + hetatoms = dict() for obresidue in kmer: - hetatoms_res = set([(obatom.GetIdx(), obatom) for obatom in pybel.ob.OBResidueAtomIter(obresidue) - if obatom.GetAtomicNum() != 1]) - + cur_hetatoms = {obatom.GetIdx(): obatom for obatom in pybel.ob.OBResidueAtomIter(obresidue) if + obatom.GetAtomicNum() != 1} if not config.ALTLOC: # Remove alternative conformations (standard -> True) - hetatoms_res = set([atm for atm in hetatoms_res - if not self.mapper.mapid(atm[0], mtype='protein', - to='internal') in self.altconformations]) - hetatoms.update(hetatoms_res) + ids_to_remove = [atom_id for atom_id in hetatoms.keys() if + self.mapper.mapid(atom_id, mtype='protein', to='internal') in self.altconformations] + for atom_id in ids_to_remove: + del cur_hetatoms[atom_id] + hetatoms.update(cur_hetatoms) logger.debug(f'hetero atoms determined (n={len(hetatoms)})') - hetatoms = dict(hetatoms) # make it a dict with idx as key and OBAtom as value lig = pybel.ob.OBMol() # new ligand mol neighbours = dict() for obatom in hetatoms.values(): # iterate over atom objects |