コード例 #1
0
ファイル: estimateReferences.py プロジェクト: VuisterLab/cing
    if molType == 'protein':
      n_points = 200
    else:
      # Less critical for DNA, RNA, ...
      n_points = 100

    for atom_type in ('H','C','N'):

      #atom_type = 'H'
      ref_cutoff = None
      normalise = True
      exclude_outliers = 4.
      n_iterations = 1

      print 'Reading raw data...'
      full_set = getPickledDict(os.path.join("../originalData/results/",database))

      for entry in full_set.keys():
        if full_set[entry].has_key(molType):
          full_set[entry] = full_set[entry][molType]
        else:
          del(full_set[entry])

      print 'Running estimation for full set...'     
      full_ref, full_stats, full_bounds, full_processed = run_estimation(full_set, n=1, n_points=n_points,
                                                                             ref_cutoff=ref_cutoff,
                                                                             atom_type=atom_type,
                                                                             molType = molType)

      if atom_type == 'C' and molType == 'protein':
コード例 #2
0
  def getVascoRerefInfo(self):

    #
    # Get VASCO reference info
    #

    dateStamp = "20100225"

    stats = getPickledDict(os.path.join(self.vascoRefDataPath,"stats_%s.pp" % dateStamp))
    bounds = getPickledDict(os.path.join(self.vascoRefDataPath,"bounds_%s.pp" % dateStamp))
    
    self.rerefInfo = {}

    for molType in ('protein',):#'RNA'):

      if molType == 'protein':
        group0 = {'arg': ('cz',), #@UnusedVariable
                  'asn': ('cg',),
                  'asp': ('cg',),
                  'gln': ('cd',),
                  'glu': ('cd',),
                  'phe': ('cg',),
                  'trp': ('cd2','ce2'),
                  'tyr': ('cg', 'cz')}

        group1 = {'arg': ('cz',),
                  'asn': ('cg',),
                  'asp': ('cg',),
                  'gln': ('cd',),
                  'glu': ('cd',),
                  'phe': ('cg',),
                  'trp': ('cd2','ce2'),
                  'tyr': ('cg', 'cz'),
                  '*': ('c',)}

        group2 = {'his': ('cd2', 'ce1'),
                  'phe': ('cd1', 'cd2', 'ce1', 'ce2', 'cz'),
                  'trp': ('cd1', 'ce3', 'ch2', 'cz2', 'cz3'),
                  'tyr': ('cd1', 'cd2', 'ce1', 'ce2')}

        group4 = {'*': ('c',)}

      if molType == 'protein':
        n_points = 200 #@UnusedVariable
      else:
        # Less critical for DNA, RNA, ...
        n_points = 100 #@UnusedVariable

      for atom_type in ('H','C','N'):

        """
        #atom_type = 'H'
        ref_cutoff = None
        normalise = True
        exclude_outliers = 4.
        n_iterations = 1

        print 'Reading raw data...'
        full_set = getPickledDict(os.path.join("../originalData/results/",database))

        for entry in full_set.keys():
          if full_set[entry].has_key(molType):
            full_set[entry] = full_set[entry][molType]
          else:
            del(full_set[entry])

        print 'Running estimation for full set...'     
        full_ref, full_stats, full_bounds, full_processed = run_estimation(full_set, n=1, n_points=n_points,
                                                                               ref_cutoff=ref_cutoff,
                                                                               atom_type=atom_type,
                                                                               molType = molType)
        """

        if atom_type == 'C' and molType == 'protein':

          #sel0 = make_selection(group0)
          sel1 = make_selection(group1)
          sel2 = make_selection(group2)
          # TODO Fix this one!
          sel3 = make_sel3(stats[atom_type][3], sel1+sel2)
          sel4 = make_selection(group4)

          tmpEntry = {'tmpEntry': self.entry}

          #set_group0 = select_entries(tmpEntry, sel0)
          set_group1 = select_entries(tmpEntry, sel1)
          set_group2 = select_entries(tmpEntry, sel2)
          set_group3 = select_entries(tmpEntry, sel3)
          set_group4 = select_entries(tmpEntry, sel4)

          groups = {1: set_group1, 2: set_group2, 3: set_group3, 4: set_group4}

        else:
          groups = {None: self.entry}

        for i, group in groups.items():
        
          if atom_type == 'C' and molType == 'protein':
            useBounds = bounds[atom_type][i]
            useStats = stats[atom_type][i]
          else:
            useBounds = bounds[atom_type]
            useStats = stats[atom_type]

          if group.has_key('tmpEntry'):
            group = group['tmpEntry']

          (rerefValue,rerefError,_void) =  estimate_reference_single(group, useStats, useBounds, entry_name='temp', atom_type=atom_type,
                                          exclude_outliers=False,molType=molType,verbose=False)
                                          
          #print atom_type, i
          if rerefValue != None:
              rerefValue = -rerefValue
          self.rerefInfo[(atom_type,i)] = (rerefValue,rerefError)
    
    #
    # Print out info
    #
    
    atomKeys = self.rerefInfo.keys()
    atomKeys.sort()
    
    if self.showMessages:
        for atomKey in atomKeys:
          print atomKey,
          print self.rerefInfo[atomKey]
コード例 #3
0
    def getVascoRerefInfo(self):

        #
        # Get VASCO reference info
        #

        dateStamp = "20100225"

        stats = getPickledDict(
            os.path.join(self.vascoRefDataPath, "stats_%s.pp" % dateStamp))
        bounds = getPickledDict(
            os.path.join(self.vascoRefDataPath, "bounds_%s.pp" % dateStamp))

        self.rerefInfo = {}

        for molType in ('protein', ):  #'RNA'):

            if molType == 'protein':
                group0 = {
                    'arg': ('cz', ),  #@UnusedVariable
                    'asn': ('cg', ),
                    'asp': ('cg', ),
                    'gln': ('cd', ),
                    'glu': ('cd', ),
                    'phe': ('cg', ),
                    'trp': ('cd2', 'ce2'),
                    'tyr': ('cg', 'cz')
                }

                group1 = {
                    'arg': ('cz', ),
                    'asn': ('cg', ),
                    'asp': ('cg', ),
                    'gln': ('cd', ),
                    'glu': ('cd', ),
                    'phe': ('cg', ),
                    'trp': ('cd2', 'ce2'),
                    'tyr': ('cg', 'cz'),
                    '*': ('c', )
                }

                group2 = {
                    'his': ('cd2', 'ce1'),
                    'phe': ('cd1', 'cd2', 'ce1', 'ce2', 'cz'),
                    'trp': ('cd1', 'ce3', 'ch2', 'cz2', 'cz3'),
                    'tyr': ('cd1', 'cd2', 'ce1', 'ce2')
                }

                group4 = {'*': ('c', )}

            if molType == 'protein':
                n_points = 200  #@UnusedVariable
            else:
                # Less critical for DNA, RNA, ...
                n_points = 100  #@UnusedVariable

            for atom_type in ('H', 'C', 'N'):
                """
        #atom_type = 'H'
        ref_cutoff = None
        normalise = True
        exclude_outliers = 4.
        n_iterations = 1

        print 'Reading raw data...'
        full_set = getPickledDict(os.path.join("../originalData/results/",database))

        for entry in full_set.keys():
          if full_set[entry].has_key(molType):
            full_set[entry] = full_set[entry][molType]
          else:
            del(full_set[entry])

        print 'Running estimation for full set...'     
        full_ref, full_stats, full_bounds, full_processed = run_estimation(full_set, n=1, n_points=n_points,
                                                                               ref_cutoff=ref_cutoff,
                                                                               atom_type=atom_type,
                                                                               molType = molType)
        """

                if atom_type == 'C' and molType == 'protein':

                    #sel0 = make_selection(group0)
                    sel1 = make_selection(group1)
                    sel2 = make_selection(group2)
                    # TODO Fix this one!
                    sel3 = make_sel3(stats[atom_type][3], sel1 + sel2)
                    sel4 = make_selection(group4)

                    tmpEntry = {'tmpEntry': self.entry}

                    #set_group0 = select_entries(tmpEntry, sel0)
                    set_group1 = select_entries(tmpEntry, sel1)
                    set_group2 = select_entries(tmpEntry, sel2)
                    set_group3 = select_entries(tmpEntry, sel3)
                    set_group4 = select_entries(tmpEntry, sel4)

                    groups = {
                        1: set_group1,
                        2: set_group2,
                        3: set_group3,
                        4: set_group4
                    }

                else:
                    groups = {None: self.entry}

                for i, group in groups.items():

                    if atom_type == 'C' and molType == 'protein':
                        useBounds = bounds[atom_type][i]
                        useStats = stats[atom_type][i]
                    else:
                        useBounds = bounds[atom_type]
                        useStats = stats[atom_type]

                    if group.has_key('tmpEntry'):
                        group = group['tmpEntry']

                    (rerefValue, rerefError,
                     _void) = estimate_reference_single(group,
                                                        useStats,
                                                        useBounds,
                                                        entry_name='temp',
                                                        atom_type=atom_type,
                                                        exclude_outliers=False,
                                                        molType=molType,
                                                        verbose=False)

                    #print atom_type, i
                    if rerefValue != None:
                        rerefValue = -rerefValue
                    self.rerefInfo[(atom_type, i)] = (rerefValue, rerefError)

        #
        # Print out info
        #

        atomKeys = self.rerefInfo.keys()
        atomKeys.sort()

        if self.showMessages:
            for atomKey in atomKeys:
                print atomKey,
                print self.rerefInfo[atomKey]