def setCurrentPlate(self, index): if self.currentPlateIndex == index : return self.currentPlateIndex = index if index >= 0: plate = self.plates[index].plate appindex= indexByName(plate.approximation.name) self.defaultApproximationIndex = appindex self.signalApproximationSelected.emit(appindex) else : plate = None self.signalCurrentIndexChanged.emit(self.currentPlateIndex) self.signalCurrentPlateSet.emit(plate)
def setCurrentPlate(self, index): if self.currentPlateIndex == index: return self.currentPlateIndex = index if index >= 0: plate = self.plates[index].plate appindex = indexByName(plate.approximation.name) self.defaultApproximationIndex = appindex self.signalApproximationSelected.emit(appindex) else: plate = None self.signalCurrentIndexChanged.emit(self.currentPlateIndex) self.signalCurrentPlateSet.emit(plate)
def loadFromFile(cls, fileName): ''' Read plate file and return list of plate records, or empty list if reading was unsucsessfull ''' def wellFromLine(line): column = int(line[1:])-1 row = ord(line[0])-ord('A') return row,column plateFile = open(unicode(fileName)) caption = plateFile.readline().strip() if caption.startswith(cls.inputTitle) : print('Loading plate from txt') plateNumber = 1 absorbanses = np.empty(cls.plateSize) absorbanses[:]=np.NAN plates = [] print('parsing plate',plateNumber) while True: line = plateFile.readline().split() isEndFile=not line[0].isdigit() if isEndFile or (int(line[0])>plateNumber) : # writing plate record plate = cls(absorbanses) plates.append(plate) print('Loaded plate absorbances') print(absorbanses) if isEndFile: break plateNumber+=1 absorbanses = np.zeros(cls.plateSize) print('parsing plate',plateNumber) wellline=line[2] row,column = wellFromLine(wellline) absorbanses[row, column] = float(line[-1]) line = '' while not line.strip() == 'Protocol description': line = plateFile.readline() notes = plateFile.readlines() for plate in plates : plate.notes=notes return plates elif caption == cls.outputTitle : print('Loading plate from ElisaSolver csv') plateFile.readline() plateFile.readline() absorbanses=cls.readTable(plateFile) plate = cls(absorbanses) plateFile.readline() appName = plateFile.readline().split(':')[1].strip() index= indexByName(appName) plate.setApproximation(index) plateFile.readline() strP = plateFile.readline().strip() if strP != '' : p = np.array([float(item) for item in strP.split(';')]) else: p=None plate.reference=Reference.loadFromFile(plateFile) print('Reference cells: ',plate.reference) plateFile.readline() plateFile.readline() plate.concentrations= cls.readTable(plateFile) plate.notes = plateFile.readlines() print('Approximation: ',plate.approximation.name) plate.approximation.p = p print('Coefficients: ',p) plate.dirty = False return [plate] else : return []