예제 #1
0
     if(dataRecord.control_type is not None and 
             dataRecord.smallmolecule is not None):
         raise Exception(str((
             'Cannot define a control type for a non-control well '
             '(well mapped to a small molecule batch)',
             dataRecord.smallmolecule,dataRecord.control_type, 
             'row',current_row)))
 if metaColumnDict['batch_id'] > -1: 
     temp = util.convertdata(r[metaColumnDict['batch_id']], int)
     if(temp != None):
         if(dataRecord.batch_id is not None and 
                 temp is not None and dataRecord.batch_id != temp):
             raise Exception(str((
                 'batch id field(1) does not match batch id set with '
                 'entity(2):',temp,dataRecord.batch_id)))
         dataRecord.batch_id = temp
 
 #dataRecord.save()
 logger.debug(str(('datarecord created:', dataRecord)))
 datapoint_batch = [] 
 for i,value in enumerate(r):
     # NOTE: shall there be an "empty" datapoint? 
     # No, since non-existance of data in the worksheet does not mean
     # "null" will mean "no value entered"
     # TODO: verify/read existing code, ask Dave
     if(value.strip()==''): continue  
     if i in dataColumnList:
         dataColumn = dataColumnList[i]
         dataPoint = _create_datapoint(dataColumn, dataset, dataRecord, value)
         #dataPoint.save()
         datapoint_batch.append(dataPoint)
예제 #2
0
 if(map_column > -1):
     try:
         value = util.convertdata(r[map_column].strip())
         if(value != None and value != '' ):
             value = value.split("-")
             if len(value) < 2: raise Exception('Small Molecule (Batch) format is #####-###(-#) **Note that (batch) is optional')
             x = value[0]
             facility = util.convertdata(x,int) 
             salt = value[1]
             try:
                 dataRecord.smallmolecule = SmallMolecule.objects.get(facility_id=facility, salt_id=salt)
             except Exception, e:
                 logger.error(str(('could not locate small molecule:', facility)))
                 raise
             if(len(value)>2):
                 dataRecord.batch_id = util.convertdata(value[2],int)
                 # TODO: validate that the batch exists?  (would need to do for all types, not just Small Molecule
             mapped = True
     except Exception, e:
         logger.error(str(("Invalid Small Molecule (or batch) identifiers: ", value, e,'row',current_row)))
         raise    
 map_column = mappingColumnDict['Plate']
 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())