if(map_column > -1): try: plate_id=None well_id=None value = util.convertdata(r[map_column].strip()) if(value != None and value != '' ): plate_id = util.convertdata(value,int) value = util.convertdata(r[map_column+1].strip()) if(value != None and value != '' ): well_id = value else: raise Exception(str(('Must define both plate and well (not just plate), row', current_row))) dataRecord.plate = plate_id dataRecord.well = well_id try: # TODO: what if the plate/well does not correlate to a librarymapping? i.e. if this is the plate/well for a cell/protein study? # For now, the effect of the followinlogger.info(str((g logic is that plate/well either maps a librarymapping, or is a an arbitrary plate/well dataRecord.library_mapping = LibraryMapping.objects.get(plate=plate_id,well=well_id) if(dataRecord.smallmolecule != None): if(dataRecord.smallmolecule != None and dataRecord.library_mapping.smallmolecule_batch != None and (dataRecord.smallmolecule != dataRecord.library_mapping.smallmolecule_batch.smallmolecule)): raise Exception(str(('SmallMolecule does not match the libraryMapping.smallmolecule_batch.smallmolecule pointed to by the plate/well:',plate_id,well_id, dataRecord.smallmolecule,dataRecord.library_mapping.smallmolecule_batch.smallmolecule, r,'row',current_row))) elif(dataRecord.library_mapping.smallmolecule_batch != None): dataRecord.smallmolecule = dataRecord.library_mapping.smallmolecule_batch.smallmolecule except ObjectDoesNotExist, e: logger.warn(str(('No librarymapping defined (plate/well do not point to a librarymapping), row', current_row))) mapped = True except Exception, e: