Пример #1
0
  def setData(self,hExchRateTableTags,i):
      
    assignList = [['Id',            'ID',None],
                  ['seqCode',       'Seq_ID',None],
                  ['resLabel',      'Comp_ID',None],
                  ['atomName',      'Atom_ID',None],
                  ['atomType',      'Atom_type',None],
                  ['value',         'Val',None],
                  ['valueError',    'Val_err',0.0],
#                  ['valueMin',      'Val_min',None],
#                  ['valueMax',      'Val_max',0.0],
                  ['details',       'Details',None],
                  ['authorSeqCode', 'Author_seq_ID',None]
                  ]

    for (attrName,tagName,default) in assignList:

      if hExchRateTableTags.has_key(tagName):
        if hExchRateTableTags[tagName][i] != None:
          setattr(self,attrName,hExchRateTableTags[tagName][i])
        else:
          setattr(self,attrName,default)
          
    # For completeness...
    (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(self.seqCode)
Пример #2
0
    def setAtomMembers(self, chainCode, seqCode, resLabel):

        refAngle = self.cyanaLib.findAngle(resLabel, self.name)

        if not refAngle:
            print "  Warning: no %s angle available for %s. Ignored." % (
                self.name, resLabel)
            return False

        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
        self.resLabel = resLabel

        self.items.append(DyanaConstraintItem())

        for atom in refAngle.atoms:

            if atom.location:
                curSeqCode = self.seqCode + atom.location
                curResLabel = ""

            else:
                curSeqCode = self.seqCode
                curResLabel = self.resLabel

            self.items[-1].members.append(
                DyanaConstraintMember(chainCode, curSeqCode, curResLabel,
                                      atom.name))

        return True
Пример #3
0
    def setInfo(self, seqCode, atomName):

        self.chainCode = defaultMolCode
        self.resLabel = None

        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
        self.atomName = atomName
Пример #4
0
 def __init__(self,parent,atomSerial,value,valueError,atomName,seqCode,verbose=False):
 
   self.atomSerial = returnInt(atomSerial,default=None,verbose=verbose)
   self.value = returnFloat(value,default=None,verbose=verbose)
   self.valueError = returnFloat(valueError,default=None,verbose=verbose)
   self.atomName = atomName
   (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(seqCode)
   self.molCode = parent.defaultMolCode
Пример #5
0
 def __init__(self,chainCode = None,seqCode = None, atomName = None, resLabel = None):
   
   self.chainCode = chainCode
   (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(seqCode)
   self.atomName = atomName
   self.resLabel = resLabel
   
   self.defaultMolCode = defaultMolCode
Пример #6
0
 def __init__(self,Id = None, chainCode = None,seqCode = None, atomName = None, resLabel = None):
 
   self.Id = Id
   self.fracVal = None
   self.chainCode = chainCode
   (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(seqCode)
   self.atomName = atomName
   self.resLabel = resLabel
Пример #7
0
  def __init__(self,Id,authorId,firstIndexId,authorFirstSeqCode = None,isWaterChain = False):

    self.chainId = Id
    self.authorId = authorId
    self.firstIndexId = firstIndexId
    
    self.isWaterChain = isWaterChain
    
    (self.authorFirstSeqCode,self.authorFirstSeqInsertCode) = getSeqAndInsertCode(authorFirstSeqCode)
Пример #8
0
 def setItemSpecificVars(self):
 
   (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(self.seqCode)
   self.Id = self.parent.constraintNum
   
   self.targetAngle = self.value
   self.devAngle = self.error
   
   self.setAtomMembers()
Пример #9
0
    def setValue(self, valueKey, values):

        if len(values) == 1:

            value = values[0]

            if not self.parent.patt['emptyline'].search(value):

                if valueKey == 'residue':
                    value = value.strip()
                    self.resLabel = value[0]

                    seqCodes = value[1:].split(',')
                    (self.seqCode,
                     self.seqInsertCode) = getSeqAndInsertCode(seqCodes[0])

                    if self.seqCode == None:
                        self.resLabel = value

                    # Can have multiple values - need to take care of that...
                    if len(seqCodes) > 1:
                        for seqCode in seqCodes[1:]:
                            self.otherSeqAndInsertCodes.append(
                                getSeqAndInsertCode(seqCode))

                elif valueKey == 'atom':
                    self.atomName = value.strip()

                elif valueKey == 'atomType':
                    self.atomType = value.strip()

                elif valueKey == 'chemShift':
                    self.value = returnFloat(value)

                elif valueKey == 'chemShiftError':
                    self.valueError = returnFloat(value)

                elif valueKey == 'numAssignments':
                    self.numAssignments = returnInt(value)

        else:

            print "  Warning: empty or invalid data field %s for Sparky chemical shift file." % valueKey
            pass
Пример #10
0
    def __init__(self, value, atomName, seqCode, spinSystemId, resLabel,
                 defaultMolCode):

        self.value = returnFloat(value)
        self.atomName = atomName
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
        self.molCode = defaultMolCode
        self.resLabel = resLabel

        self.spinSystemId = spinSystemId
Пример #11
0
 def setInfo(self,chainCode,seqCode,resLabel,atomName):
   
   if chainCode != defaultMolCode:
     self.chainCode = chainCode
   else:
     self.chainCode = concoordDefaultMolCode
     
   (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(seqCode)
   self.resLabel = resLabel
   self.atomName = atomName
Пример #12
0
  def addStarInfo(self,constraintTableTags,i,position,tableTagNames):

    self.chainCode = constraintTableTags[tableTagNames['chainCode'] % position][i]
    
    if not self.chainCode:
      self.chainCode = self.defaultMolCode

    (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(constraintTableTags[tableTagNames['seqCode'] % position][i])
    self.atomName = constraintTableTags[tableTagNames['atomName'] % position][i]
    self.resLabel = constraintTableTags[tableTagNames['resLabel'] % position][i]
Пример #13
0
    def __init__(self, value, error, ambCode, atomSetName, atomName, seqCode,
                 molCode):

        self.value = value
        self.error = error
        self.ambCode = ambCode
        self.atomSetName = atomSetName
        self.atomName = atomName
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
        self.molCode = molCode
Пример #14
0
  def __init__(self, value, atomName, seqCode, figOfMerit, resLabel, defaultMolCode, iCode = 'i'):

    self.value = returnFloat(value)
    self.valueError = 0.0
    self.atomName = atomName
    (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
    self.molCode = defaultMolCode
    self.resLabel = resLabel
    self.figOfMerit = figOfMerit

    self.allValues = {iCode: self.value}
Пример #15
0
 def __init__(self,value,valueError,atomName,atomType,seqCode,resLabel,molCode,ambCode = 0):
 
   self.value = value
   self.valueError = valueError
   self.atomName = atomName
   self.atomType = atomType
   (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(seqCode)
   self.molCode = molCode
   self.resLabel = resLabel
   
   self.ambCode = ambCode
Пример #16
0
    def setData(self, chemShiftTableTags, i):

        # Values already formatted...

        if self.parent.version == '2.1.1':
            assignList = [
                ['Id', '_Atom_shift_assign_ID', None],
                ['seqCode', '_Residue_seq_code', None],
                ['resLabel', '_Residue_label', None],
                ['atomName', '_Atom_name', None],
                ['atomType', '_Atom_type', None],
                ['value', '_Chem_shift_value', None],
                ['valueError', '_Chem_shift_value_error', 0.0],
                ['ambCode', '_Chem_shift_ambiguity_code', 1],
                ['ambCode', '_Chem_shift_ambiguity_type',
                 1],  # This apparently also occurs sometimes...
                ['authorSeqCode', '_Residue_author_seq_code', None]
            ]
        else:
            # TODO can get a lot more out...
            assignList = [['Id', 'ID', None], ['seqCode', 'Seq_ID', None],
                          ['backupSeqCode', 'Comp_index_ID', None],
                          ['resLabel', 'Comp_ID', None],
                          ['atomName', 'Atom_ID', None],
                          ['atomType', 'Atom_type', None],
                          ['value', 'Val', None],
                          ['valueError', 'Val_err', 0.0],
                          ['figOfMerit', 'Assign_fig_of_merit', None],
                          ['ambCode', 'Ambiguity_code', 1],
                          ['details', 'Details', None],
                          ['authorSeqCode', 'Author_seq_ID', None]]

        for (attrName, tagName, default) in assignList:

            if chemShiftTableTags.has_key(tagName):
                if chemShiftTableTags[tagName][i] != None:
                    setattr(self, attrName, chemShiftTableTags[tagName][i])
                else:
                    setattr(self, attrName, default)

        # Little hack - not sure what is best in the end...
        if not self.seqCode and hasattr(
                self, 'backupSeqCode') and self.backupSeqCode:
            self.seqCode = self.backupSeqCode

        # For completeness...
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(self.seqCode)

        # This is a hack, is possible in older NMR-STAR files! Use resLabel as chain ID
        if self.seqCode == None and hasattr(self,
                                            'resLabel') and self.resLabel:
            self.seqCode = 1
            self.chainCode = self.resLabel
Пример #17
0
 def __init__(self,parent,value,atomName,seqCode,resLabel,molCode):
 
   self.value = value
   self.atomName = atomName
   #self.atomType = atomType
   (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(seqCode)
   self.molCode = molCode
   self.resLabel = resLabel
   
   if not parent.chemShiftsBySeqCodeAndAtomName.has_key(self.seqCode):
     parent.chemShiftsBySeqCodeAndAtomName[self.seqCode] = {}
   
   parent.chemShiftsBySeqCodeAndAtomName[self.seqCode][self.atomName] = self
Пример #18
0
    def __init__(self,
                 value,
                 atomName,
                 seqCode,
                 defaultMolCode,
                 unknownCode=0):

        self.value = returnFloat(value)
        self.atomName = atomName
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
        self.molCode = defaultMolCode
        self.unknownCode = returnInt(
            unknownCode)  # TODO: what is this one for?
Пример #19
0
  def addStarInfo(self,constraintTableTags,i,position,tableTagNames):

    # Tag can be missing in 2.1.1 files...
    if constraintTableTags.has_key(tableTagNames['chainCode'] % position):
      self.chainCode = constraintTableTags[tableTagNames['chainCode'] % position][i]
    else:
      self.chainCode = None

    if not self.chainCode:
      self.chainCode = self.defaultMolCode

    (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(constraintTableTags[tableTagNames['seqCode'] % position][i])
    self.atomName = constraintTableTags[tableTagNames['atomName'] % position][i]
    self.resLabel = constraintTableTags[tableTagNames['resLabel'] % position][i]
Пример #20
0
    def getPeakResNames(self):

        if self.rawPeak.assignResNum[self.rawPeakDimIndex] != '':
            (seqCode, seqInsertCode) = getSeqAndInsertCode(
                self.rawPeak.assignResNum[self.rawPeakDimIndex])
            self.resNames = [
                getResName(' ',
                           seqCode,
                           self.rawPeak.assignAtom[self.rawPeakDimIndex],
                           seqInsertCode=seqInsertCode)
            ]

        else:
            self.resNames = []
Пример #21
0
    def __init__(self, seqCode, *args, **keywds):

        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)

        self.formatCode = None
        self.atomNames = []
        self.hasCisPeptideBond = False

        self.bonds = {}

        self.setResidueCode(*args)

        self.setFormatSpecific(*args, **keywds)

        self.secStrucInfo = None
Пример #22
0
  def setData(self,nodeMembersTableTags,i,tableTagNames):

    self.Id = nodeMembersTableTags[tableTagNames['memberID']][i]
    
    if tableTagNames.has_key('fracVal'):
      self.fracVal = nodeMembersTableTags[tableTagNames['fracVal']][i]
    
    self.chainCode = nodeMembersTableTags[tableTagNames['chainCode']][i]
    if not self.chainCode:
      self.chainCode = defaultMolCode
    
    self.resLabel = nodeMembersTableTags[tableTagNames['resLabel']][i]
    (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(nodeMembersTableTags[tableTagNames['seqCode']][i])
    self.atomName = nodeMembersTableTags[tableTagNames['atomName']][i]

    if tableTagNames.has_key('chemCompID'):
      self.chemCompID = nodeMembersTableTags[tableTagNames['chemCompID']][i]
Пример #23
0
    def apply(self):

        self.chainDict = {}

        for ccpChainLabel in self.ccpChainLabelDict.keys():

            chain = self.ccpChainLabelDict[ccpChainLabel]
            selection = self.formatChainMenu[ccpChainLabel].getSelected()

            if selection != 'Do not link':

                chainDictKey = (ccpChainLabel, selection)
                (formatChainCode,
                 seqCodesList) = self.localFormatChainDict[chainDictKey]

                selectedItems = self.ccpCodeLow[
                    ccpChainLabel].getSelectedItems()

                if not selectedItems:
                    showError(
                        "No sequence ID selected",
                        "Please select a sequence ID on the left side for chain %s!"
                        % ccpChainLabel)
                    return False

                ccpCodeLow = returnInt(
                    self.ccpChainSeqIdDict[ccpChainLabel][selectedItems[0]])

                (formatChainSeqCodeLow, seqInsertCode) = getSeqAndInsertCode(
                    self.formatChainCodeLow[ccpChainLabel].getSelectedItems()
                    [0])

                exportSeqCodesList = seqCodesList[:]

                for (tempSeqCode, tempSeqInsertCode) in seqCodesList:
                    if tempSeqCode == formatChainSeqCodeLow and tempSeqInsertCode == seqInsertCode:
                        break
                    else:
                        exportSeqCodesList.pop(0)

                self.chainDict[chain] = [
                    formatChainCode, ccpCodeLow, exportSeqCodesList
                ]

        return True
Пример #24
0
    def setData(self, t1RelaxTableTags, i):

        assignList = [['Id', 'ID', None], ['seqCode', 'Seq_ID', None],
                      ['resLabel', 'Comp_ID', None],
                      ['atomName', 'Atom_ID', None],
                      ['atomType', 'Atom_type', None],
                      ['tauEValue', 'Tau_e_val', None],
                      ['tauEError', 'Tau_e_val_fit_err', 0.0],
                      ['authorSeqCode', 'Author_seq_ID', None]]

        for (attrName, tagName, default) in assignList:

            if t1RelaxTableTags.has_key(tagName):
                if t1RelaxTableTags[tagName][i] != None:
                    setattr(self, attrName, t1RelaxTableTags[tagName][i])
                else:
                    setattr(self, attrName, default)

        # For completeness...
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(self.seqCode)
Пример #25
0
    def __init__(self,
                 value,
                 atomName,
                 seqCode,
                 spinSystemId,
                 peakId,
                 resLabel,
                 defaultMolCode,
                 iCode='i'):

        self.value = returnFloat(value)
        self.valueError = 0.0
        self.atomName = atomName
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
        self.molCode = defaultMolCode
        self.resLabel = resLabel

        self.allValues = {iCode: self.value}

        self.spinSystemId = spinSystemId
        self.peakId = peakId
Пример #26
0
    def __init__(self,
                 value,
                 atomName,
                 seqCode,
                 spinSystemId,
                 stripId,
                 resLabel,
                 defaultMolCode,
                 infoCode=None,
                 prevSpinSystemId=None):

        self.value = returnFloat(value)
        self.atomName = atomName
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(seqCode)
        self.molCode = defaultMolCode
        self.resLabel = resLabel

        self.spinSystemId = spinSystemId
        self.prevSpinSystemId = prevSpinSystemId
        self.stripId = stripId
        self.infoCode = infoCode
Пример #27
0
  def setData(self,nodeMembersTableTags,i,tableTagNames):

    self.Id = nodeMembersTableTags[tableTagNames['memberID']][i]
    
    if tableTagNames.has_key('fracVal'):
      self.fracVal = nodeMembersTableTags[tableTagNames['fracVal']][i]
    
    self.chainCode = nodeMembersTableTags[tableTagNames['chainCode']][i]
    if not self.chainCode:
      self.chainCode = defaultMolCode
    
    self.resLabel = nodeMembersTableTags[tableTagNames['resLabel']][i]
    (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(nodeMembersTableTags[tableTagNames['seqCode']][i])
    
    # This is a hack, is possible in NMR-STAR file from CNS/XPLOR data!
    if self.seqCode == None and self.chainCode:
      self.seqCode = 1
    
    self.atomName = nodeMembersTableTags[tableTagNames['atomName']][i]

    if tableTagNames.has_key('chemCompID'):
      self.chemCompID = nodeMembersTableTags[tableTagNames['chemCompID']][i]
Пример #28
0
  def setAtomMembers(self,constraintTableTags,i,tableTagNames):
   
    #
    # TODO: this is rather nasty: assuming it's DIANA if dihedral angle name given.
    #       should really be checking type... leave this for now
    #

    chainCode = constraintTableTags[tableTagNames['chainCode'] % tableTagNames['position'][0]][i]
    
    if not chainCode:
      chainCode = defaultMolCode

    # Can only handle real numbers here - no insert codes allowed...
    (seqCode,seqInsertCode) = getSeqAndInsertCode(constraintTableTags[tableTagNames['seqCode'] % tableTagNames['position'][0]][i])
    resLabel = constraintTableTags[tableTagNames['resLabel'] % tableTagNames['position'][0]][i]
    
    refAngle = self.cyanaLib.findAngle(resLabel,self.name)
    
    self.nodes.append(NmrStarDihedralConstraintItem())
    
    if refAngle:
      for atom in refAngle.atoms:

        if atom.location:
          curSeqCode = seqCode + atom.location
          curResLabel = ""

        else:
          curSeqCode = seqCode
          curResLabel = resLabel

        self.setAtomMember(self.nodes[-1],chainCode,curSeqCode,atom.name,curResLabel)

    else:
      print "  Error: no reference angle found for name %s..." % self.name
      for i in range(4):
        curSeqCode = seqCode
        curResLabel = resLabel
        self.setAtomMember(self.nodes[-1],chainCode,curSeqCode,'',curResLabel)
Пример #29
0
    def setData(self, orderParamTableTags, i):

        if self.parent.version == '2.1.1':

            assignList = [
                ['Id', 'SET', i + 1],
                ['seqCode', '_Residue_seq_code', None],
                ['resLabel', '_Residue_label', None],
                ['atomName', '_Atom_name', None],
                ['s2Value', '_S2_value', None],
                ['s2Error', '_S2_value_fit_error', 0.0],
                ['tauEValue', '_Tau_e_value', None],
                ['tauEError', '_Tau_e_value_fit_error', 0.0],
            ]

        else:

            assignList = [['Id', 'ID', None], ['seqCode', 'Seq_ID', None],
                          ['resLabel', 'Comp_ID', None],
                          ['atomName', 'Atom_ID', None],
                          ['atomType', 'Atom_type', None],
                          ['tauEValue', 'Tau_e_val', None],
                          ['tauEError', 'Tau_e_val_fit_err', 0.0],
                          ['authorSeqCode', 'Author_seq_ID', None]]

        for (attrName, tagName, default) in assignList:

            if orderParamTableTags.has_key(tagName):
                if orderParamTableTags[tagName][i] != None:
                    setattr(self, attrName, orderParamTableTags[tagName][i])
                else:
                    setattr(self, attrName, default)

            elif tagName == 'SET':
                setattr(self, attrName, default)

        # For completeness...
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(self.seqCode)
Пример #30
0
    def setData(self, chemShiftTableTags, i):

        # Values already formatted...

        if self.parent.version == '2.1.1':
            assignList = [['Id', '_Atom_shift_assign_ID', None],
                          ['seqCode', '_Residue_seq_code', None],
                          ['resLabel', '_Residue_label', None],
                          ['atomName', '_Atom_name', None],
                          ['atomType', '_Atom_type', None],
                          ['value', '_Chem_shift_value', None],
                          ['valueError', '_Chem_shift_value_error', 0.0],
                          ['ambCode', '_Chem_shift_ambiguity_code', 1],
                          ['authorSeqCode', '_Residue_author_seq_code', None]]
        else:
            # TODO can get a lot more out...
            assignList = [['Id', 'ID', None], ['seqCode', 'Seq_ID', None],
                          ['resLabel', 'Comp_ID', None],
                          ['atomName', 'Atom_ID', None],
                          ['atomType', 'Atom_type', None],
                          ['value', 'Val', None],
                          ['valueError', 'Val_err', 0.0],
                          ['figOfMerit', 'Assign_fig_of_merit', None],
                          ['ambCode', 'Ambiguity_code', 1],
                          ['details', 'Details', None],
                          ['authorSeqCode', 'Author_seq_ID', None]]

        for (attrName, tagName, default) in assignList:

            if chemShiftTableTags.has_key(tagName):
                if chemShiftTableTags[tagName][i] != None:
                    setattr(self, attrName, chemShiftTableTags[tagName][i])
                else:
                    setattr(self, attrName, default)

        # For completeness...
        (self.seqCode, self.seqInsertCode) = getSeqAndInsertCode(self.seqCode)