def map2molecule(self, molecule): """ Map the tree to CING molecule instance. """ unmatchedAtomByResDict = {} for chn in self.tree: for res in chn: # nTdebug("map2molecule res: %s" % res) if res.skip or (not res.db): continue for atm in res: atm.atom = None if atm.skip or (not atm.db): # nTerror("pdbParser#map2molecule was flagged before right?") # nTdebug( '>> %s' % atm ) continue #t = (IUPAC, chn.name, res.resNum, atm.db.name) # GV the atm.db.name is BY DEFINITION in INTERNAL format! # IUPAC and other mapping has already been done before and should not be # repeated here. It also will cause a potential swap of atoms t = (INTERNAL, chn.name, res.resNum, atm.db.name) atm.atom = molecule.decodeNameTuple(t) # if res.resNum==83: # nTdebug( '>> %s %s %s', atm.name, t, atm.atom ) # if not atm.atom: # for the non-standard residues and atoms. # t = (INTERNAL, chn.name, res.resNum, atm.db.name) # atm.atom = molecule.decodeNameTuple(t) if not atm.atom: # JFD: Report all together now. if not unmatchedAtomByResDict.has_key(res.resName): unmatchedAtomByResDict[ res.resName ] = ([], []) atmList = unmatchedAtomByResDict[res.resName][0] resNumList = unmatchedAtomByResDict[res.resName][1] if atm.name not in atmList: atmList.append(atm.name) if res.resNum not in resNumList: resNumList.append(res.resNum) #end if #end if #end for #end for #end for self.molecule = molecule if unmatchedAtomByResDict: msg = "pdbParser.map2molecule: Strange! Warning mapping atom for:\n" msg += unmatchedAtomByResDictToString(unmatchedAtomByResDict) nTwarning(msg)
def map2molecule(self, molecule): """ Map the tree to CING molecule instance. """ unmatchedAtomByResDict = {} for chn in self.tree: for res in chn: # nTdebug("map2molecule res: %s" % res) if res.skip or (not res.db): continue for atm in res: atm.atom = None if atm.skip or (not atm.db): # nTerror("pdbParser#map2molecule was flagged before right?") # nTdebug( '>> %s' % atm ) continue #t = (IUPAC, chn.name, res.resNum, atm.db.name) # GV the atm.db.name is BY DEFINITION in INTERNAL format! # IUPAC and other mapping has already been done before and should not be # repeated here. It also will cause a potential swap of atoms t = (INTERNAL, chn.name, res.resNum, atm.db.name) atm.atom = molecule.decodeNameTuple(t) # if res.resNum==83: # nTdebug( '>> %s %s %s', atm.name, t, atm.atom ) # if not atm.atom: # for the non-standard residues and atoms. # t = (INTERNAL, chn.name, res.resNum, atm.db.name) # atm.atom = molecule.decodeNameTuple(t) if not atm.atom: # JFD: Report all together now. if not unmatchedAtomByResDict.has_key(res.resName): unmatchedAtomByResDict[res.resName] = ([], []) atmList = unmatchedAtomByResDict[res.resName][0] resNumList = unmatchedAtomByResDict[res.resName][1] if atm.name not in atmList: atmList.append(atm.name) if res.resNum not in resNumList: resNumList.append(res.resNum) #end if #end if #end for #end for #end for self.molecule = molecule if unmatchedAtomByResDict: msg = "pdbParser.map2molecule: Strange! Warning mapping atom for:\n" msg += unmatchedAtomByResDictToString(unmatchedAtomByResDict) nTwarning(msg)
def _matchResiduesAndAtoms(self): """ Match residues and Atoms in the tree to CING db using self.convention """ # nTdebug("Now in _matchResiduesAndAtoms") unmatchedAtomByResDict = {} # unmatchedResDict = {} for res in self.tree.subNodes(depth = 2): self.matchGame.matchResidue2Cing(res) for atm in res: if not self.matchGame.matchAtom2Cing(atm): if not unmatchedAtomByResDict.has_key(res.resName): unmatchedAtomByResDict[ res.resName ] = ([], []) atmList = unmatchedAtomByResDict[res.resName][0] resNumList = unmatchedAtomByResDict[res.resName][1] if atm.name not in atmList: atmList.append(atm.name) if res.resNum not in resNumList: resNumList.append(res.resNum) if not self.allowNonStandardResidue: atm.skip = True continue # aName = moveFirstDigitToEnd(atm.name) # worry about this? atm.db = res.db.appendAtomDef(atm.name) if not atm.db: # nTwarning("Should have been possible to add a non-standard atom %s to the residue %s" % (atm.name, res.resName)) continue msg = "==> Non-standard (residues and their) atoms" if self.allowNonStandardResidue: msg += " to add:\n" else: msg += " to skip:\n" if unmatchedAtomByResDict: msg += unmatchedAtomByResDictToString(unmatchedAtomByResDict) if self.allowNonStandardResidue: nTmessage(msg) else: nTerror(msg)
def _matchResiduesAndAtoms(self): """ Match residues and Atoms in the tree to CING db using self.convention """ # nTdebug("Now in _matchResiduesAndAtoms") unmatchedAtomByResDict = {} # unmatchedResDict = {} for res in self.tree.subNodes(depth=2): self.matchGame.matchResidue2Cing(res) for atm in res: if not self.matchGame.matchAtom2Cing(atm): if not unmatchedAtomByResDict.has_key(res.resName): unmatchedAtomByResDict[res.resName] = ([], []) atmList = unmatchedAtomByResDict[res.resName][0] resNumList = unmatchedAtomByResDict[res.resName][1] if atm.name not in atmList: atmList.append(atm.name) if res.resNum not in resNumList: resNumList.append(res.resNum) if not self.allowNonStandardResidue: atm.skip = True continue # aName = moveFirstDigitToEnd(atm.name) # worry about this? atm.db = res.db.appendAtomDef(atm.name) if not atm.db: # nTwarning("Should have been possible to add a non-standard atom %s to the residue %s" % (atm.name, res.resName)) continue msg = "==> Non-standard (residues and their) atoms" if self.allowNonStandardResidue: msg += " to add:\n" else: msg += " to skip:\n" if unmatchedAtomByResDict: msg += unmatchedAtomByResDictToString(unmatchedAtomByResDict) if self.allowNonStandardResidue: nTmessage(msg) else: nTerror(msg)