def calcAdditionalMetrics(self,metric,normType,newMetric): # calculate the Calpha weights for each dataset (see CalphaWeight class for details) # for metric "metric" (loss, gain, mean etc.) # 'newMetric' takes values ('Calpha','netChange','linreg','subtract1') options = ['Calpha','netChange','linreg','subtract1','average'] if newMetric == 'Calpha': print 'Calculating Calpha weights at each dataset...' CAweights = CalphaWeight(self.atomList) CAweights.calculateWeights(metric) # loop over all atoms in list and calculate additional metrics for each atom in atomList counter = 0 numAtoms = self.getNumAtoms() for atom in self.atomList: counter += 1 progress(counter, numAtoms, suffix='') # unessential loading bar add-in if newMetric == 'Calpha': atom.CalphaWeightedDensChange(CAweights,metric) elif newMetric == 'linreg': atom.calcLinReg(self.numLigRegDatasets,'Standard',metric) elif newMetric == 'netChange': atom.calcNetChangeMetric('Standard') elif newMetric == 'subtract1': atom.calcFirstDatasetSubtractedMetric('Standard',metric) elif newMetric == 'average': atom.calcAvMetric(normType,metric) else: print 'new metric type not recognised.. choose from: {}'.format(options) return
def processAtomList(self): # process the input multiPDB list of atom objects to create new # list of atom objects from processedAtom class processedList = [] # calculate the Calpha weights for each dataset (see CalphaWeight class for details) print 'Calculating Calpha weights at each dataset...' CAweights = CalphaWeight(self.unprocessedAtomList) CAweights.calculateWeights() # loop over all atoms in list and determine new atom info (defined by processedAtom class) print 'Creating new list of atom objects within class processedAtom...' counter = 0 num_atoms = len(self.unprocessedAtomList) for oldAtom in self.unprocessedAtomList: counter += 1 progress(counter, num_atoms, suffix='') #unessential loading bar add-in newAtom = processedAtom() newAtom.cloneInfo(oldAtom) newAtom.CalphaWeightedDensChange(CAweights) newAtom.calculateAdditionalMetrics() newAtom.calculateLinReg(self.numDatasets,'Standard') # newAtom.calculateLinReg(self.numDatasets,'Calpha normalised') processedList.append(newAtom) self.processedAtomList = processedList