def convertAtomNameByType(self, assign): (chain, seqId, codedAtomName) = assign.split('.') (typeCode, resType, atomName) = codedAtomName.split(':') newAssign = None # Warning: this is slightly dangerous because molType not defined - could in principle find wrong chemComp (Wim 080207) targetChemComp = self.project.findFirstChemComp(ccpCode=resType) if targetChemComp: namingSystem = targetChemComp.findFirstNamingSystem( name=self.namingSystemName) if namingSystem: searchDict = {'sysName': atomName} chemAtomSysName = findChemAtomSysName(namingSystem, searchDict) newAtomName = chemAtomSysName.atomName #print chemAtomSysName,atomName,newAtomName newCodedAtomName = ':'.join((typeCode, resType, newAtomName), ) newAssign = '.'.join((chain, seqId, newCodedAtomName), ) #if assign != newAssign: #print '\tNote: changed %s %s %s %s to %s' % (chain,resType,seqId,atomName,newAtomName) return newAssign
def findMatchingAtom(self,residue,atomName): atom = residue.findFirstAtom(name = atomName) if not atom: # Rough search but should be OK for bb atoms namingSystem = residue.chemCompVar.chemComp.findFirstNamingSystem(name = 'XPLOR') chemAtomSysName = findChemAtomSysName(namingSystem,{'sysName': atomName}) atom = residue.findFirstAtom(name = chemAtomSysName.atomName) return atom
def setRawDistanceConstraintItemMembers(self): # # Expand the information... is necessary for Concoord (only handles individual atoms) # atomNameLists = [] for i in range(0, 2): atomNameLists.append([]) resonanceToAtom = self.ccpInfo[i][3] chemAtomOrigName = self.ccpInfo[i][2] if resonanceToAtom.chemAtomSet: chemAtomOrSet = resonanceToAtom.chemAtomSet else: chemAtomOrSet = resonanceToAtom.chemAtom if chemAtomOrSet: chemCompVar = resonanceToAtom.getResidue().chemCompVar namingSystem = chemCompVar.chemComp.findFirstNamingSystem( name=self.namingSystemName) if namingSystem: chemAtomSysName = findChemAtomSysName( namingSystem, {'sysName': chemAtomOrigName}) else: chemAtomSysName = None if chemAtomSysName: chemAtom = chemCompVar.findFirstChemAtom( name=chemAtomSysName.atomName, subType=chemAtomSysName.atomSubType) else: chemAtom = chemCompVar.findFirstChemAtom( name=chemAtomOrigName) if not chemAtom: chemAtomSetSysName = findChemAtomSetSysName( namingSystem, {'sysName': chemAtomOrigName}) if chemAtomSetSysName: chemAtomSet = chemCompVar.findFirstChemAtomSet( name=chemAtomSetSysName.atomName, subType=chemAtomSetSysName.atomSubType) else: chemAtomSet = chemCompVar.findFirstChemAtomSet( name=chemAtomOrigName) if chemAtomSet: (chainCode, seqCode, spinSystemId, seqInsertCode, atomName) = getNameInfo(self.resSetNames[i]) if chemAtomSet.chemAtomSets: chemAtomSets = list(chemAtomSet.chemAtomSets) else: chemAtomSets = [chemAtomSet] for chemAtomSet in chemAtomSets: chemAtomSysNames = self.getChemAtomSysNamesFromSet( chemAtomSet, chemCompVar, findIupac=1) for chemAtomSysName in chemAtomSysNames: if chemAtomSysName: atomNameLists[-1].append( getResName( chainCode, seqCode, chemAtomSysName, seqInsertCode=seqInsertCode)) else: print " Error: problems with decompressing Concoord name %s - sysNames missing for %s" % ( self.resSetNames[i], chemAtomSet.name) else: print " Error: can't decompress Concoord name %s" % self.resSetNames[ i] # # If no names use default # if not atomNameLists[-1]: atomNameLists[-1].append(self.resSetNames[i]) # # Now write them one by one... # itemResonances = getResonancesFromPairwiseConstraintItem(self.item) for resSetName0 in atomNameLists[0]: # TODO: bit risky this one! What if original names (eg GLU-) are being used?! resonance = itemResonances[0] resLabel0 = resonance.resonanceSet.findFirstAtomSet( ).findFirstAtom().residue.molResidue.chemComp.ccpCode.upper() (chainCode0, seqCode0, spinSystemId0, seqInsertCode0, atomName0) = getNameInfo(resSetName0) if atomName0 == allResidueAtoms_kw: print " Error: not handling residue level constraints for %s." % self.format continue for resSetName1 in atomNameLists[1]: # TODO: bit risky this one! What if original names (eg GLU-) are being used?! resonance = itemResonances[1] resLabel1 = resonance.resonanceSet.findFirstAtomSet( ).findFirstAtom().residue.molResidue.chemComp.ccpCode.upper() (chainCode1, seqCode1, spinSystemId1, seqInsertCode1, atomName1) = getNameInfo(resSetName1) if atomName1 == allResidueAtoms_kw: print " Error: not handling residue level constraints for %s." % self.format continue # # Now set all items and members... # self.rawConstraint.items.append(self.rawConstraintItemClass()) self.rawConstraintItem = self.rawConstraint.items[-1] self.rawConstraintItem.members.append( self.rawConstraintItemMemberClass()) self.rawConstraintItem.members[-1].setInfo( chainCode0, seqCode0, resLabel0, atomName0) self.rawConstraintItem.members.append( self.rawConstraintItemMemberClass()) self.rawConstraintItem.members[-1].setInfo( chainCode1, seqCode1, resLabel1, atomName1)