def determineColumns(self, data, profileTree): firstDataRow = data[1].split('\t') # first column entry that is numeric is assumed to be from first sample firstSampleIndex = 0 for entry in firstDataRow: if isNumber(entry): break firstSampleIndex += 1 # get hierarchical and sample names headings = data[0].split('\t') profileTree.hierarchyHeadings = headings[0:firstSampleIndex] profileTree.sampleNames = headings[firstSampleIndex:]
def determineColumns(self, data, profileTree): firstDataRow = data[1].split('\t') # first column entry that is numeric is assumed to be from first sample firstSampleIndex = 0 for entry in firstDataRow: if isNumber(entry): break firstSampleIndex += 1 # get hierarchical and sample names headings = data[0].split('\t') headings = map(string.strip, headings) profileTree.hierarchyHeadings = headings[0:firstSampleIndex] profileTree.sampleNames = headings[firstSampleIndex:]
def sort(self, Ncol, order): ''' Sort table by given column number. ''' if len(self.arraydata) == 0: return self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()")) dataIsNumeric = isNumber(self.arraydata[0][Ncol]) if dataIsNumeric: self.arraydata = sorted(self.arraydata , key = operator.itemgetter(Ncol)) else: self.arraydata = SortTableStrCol(self.arraydata, Ncol) if order == QtCore.Qt.DescendingOrder: self.arraydata.reverse() self.emit(QtCore.SIGNAL("layoutChanged()"))
def sort(self, Ncol, order): ''' Sort table by given column number. ''' if len(self.arraydata) == 0: return self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()")) dataIsNumeric = isNumber(self.arraydata[0][Ncol]) if dataIsNumeric: self.arraydata = SortTableNumericStrCol(self.arraydata, Ncol) else: self.arraydata = SortTableStrCol(self.arraydata, Ncol) if order == QtCore.Qt.DescendingOrder: self.arraydata.reverse() self.emit(QtCore.SIGNAL("layoutChanged()"))