예제 #1
0
파일: experiment.py 프로젝트: papagr/TheLMA
 def update(self, data):
     if IDataElement.providedBy(data):  # pylint: disable=E1101
         # FIXME: This really should be a PATCH operation.
         prx = DataElementAttributeProxy(data)
         self_entity = self.get_entity()
         changed_num_reps = prx.number_replicates != self.number_replicates
         emt_id = prx.experiment_metadata_type.get('id')
         changed_em_type = emt_id != self.experiment_metadata_type.id
         if changed_em_type or changed_num_reps:
             if changed_num_reps:
                 self_entity.number_replicates = prx.number_replicates
             if changed_em_type:
                 self_entity.experiment_metadata_type = \
                             get_experiment_metadata_type(emt_id)
             if not self_entity.experiment_design is None:
                 # invalidate data to force a fresh upload of the XLS file
                 self_entity.experiment_design.experiment_design_racks = []
                 self_entity.experiment_design.worklist_series = None
             if not self_entity.lab_iso_request is None:
                 shape = self_entity.lab_iso_request.rack_layout.shape
                 new_layout = RackLayout(shape=shape)
                 self_entity.lab_iso_request.rack_layout = new_layout
                 self_entity.lab_iso_request.owner = ''
         changed_sp = self_entity.subproject.id != prx.subproject.get('id')
         if changed_sp:
             new_sp = \
                 url_to_resource(prx.subproject.get('href')).get_entity()
             self_entity.subproject = new_sp
         self_entity.label = prx.label
         # Perform appropriate Trac updates.
         if not self_entity.lab_iso_request is None:
             if self.iso_request.owner == STOCKMANAGEMENT_USER:
                 ticket_activator = IsoRequestTicketActivator(
                     experiment_metadata=self_entity)
                 self.__run_trac_tool(ticket_activator,
                                      'Could not update the ticket: %s.')
             else:
                 if changed_em_type or changed_num_reps:
                     trac_updater = IsoRequestTicketDescriptionRemover(
                         experiment_metadata=self_entity,
                         changed_num_replicates=changed_num_reps,
                         changed_em_type=changed_em_type)
                 else:
                     url = 'http://thelma/public//LOUICe.html#' \
                           + self.path
                     iso_url = 'http://thelma/public//LOUICe.html#' \
                               + self.iso_request.path
                     trac_updater = IsoRequestTicketDescriptionUpdater(
                         experiment_metadata=self_entity,
                         experiment_metadata_link=url,
                         iso_request_link=iso_url)
                 self.__run_trac_tool(trac_updater,
                                      'Could not update the ticket: %s.')
     else:
         Member.update(self, data)
예제 #2
0
 def update(self, data):
     if IDataElement.providedBy(data): # pylint: disable=E1101
         # FIXME: This really should be a PATCH operation.
         prx = DataElementAttributeProxy(data)
         self_entity = self.get_entity()
         changed_num_reps = prx.number_replicates != self.number_replicates
         emt_id = prx.experiment_metadata_type.get('id')
         changed_em_type = emt_id != self.experiment_metadata_type.id
         if changed_em_type or changed_num_reps:
             if changed_num_reps:
                 self_entity.number_replicates = prx.number_replicates
             if changed_em_type:
                 self_entity.experiment_metadata_type = \
                             get_experiment_metadata_type(emt_id)
             if not self_entity.experiment_design is None:
                 # invalidate data to force a fresh upload of the XLS file
                 self_entity.experiment_design.experiment_design_racks = []
                 self_entity.experiment_design.worklist_series = None
             if not self_entity.lab_iso_request is None:
                 shape = self_entity.lab_iso_request.rack_layout.shape
                 new_layout = RackLayout(shape=shape)
                 self_entity.lab_iso_request.rack_layout = new_layout
                 self_entity.lab_iso_request.owner = ''
         changed_sp = self_entity.subproject.id != prx.subproject.get('id')
         if changed_sp:
             new_sp = \
                 url_to_resource(prx.subproject.get('href')).get_entity()
             self_entity.subproject = new_sp
         self_entity.label = prx.label
         # Perform appropriate Trac updates.
         if not self_entity.lab_iso_request is None:
             if self.iso_request.owner == STOCKMANAGEMENT_USER:
                 ticket_activator = IsoRequestTicketActivator(
                                         experiment_metadata=self_entity)
                 self.__run_trac_tool(ticket_activator,
                                      'Could not update the ticket: %s.')
             else:
                 if changed_em_type or changed_num_reps:
                     trac_updater = IsoRequestTicketDescriptionRemover(
                                   experiment_metadata=self_entity,
                                   changed_num_replicates=changed_num_reps,
                                   changed_em_type=changed_em_type)
                 else:
                     url = 'http://thelma/public//LOUICe.html#' \
                           + self.path
                     iso_url = 'http://thelma/public//LOUICe.html#' \
                               + self.iso_request.path
                     trac_updater = IsoRequestTicketDescriptionUpdater(
                                         experiment_metadata=self_entity,
                                         experiment_metadata_link=url,
                                         iso_request_link=iso_url)
                 self.__run_trac_tool(trac_updater,
                                      'Could not update the ticket: %s.')
     else:
         Member.update(self, data)
예제 #3
0
파일: location.py 프로젝트: helixyte/TheLMA
 def update(self, data):
     if IDataElement.providedBy(data): # pylint: disable=E1101
         prx = DataElementAttributeProxy(data)
         loc = self.get_entity()
         try:
             rack = prx.rack
         except AttributeError:
             loc.checkout_rack()
         else:
             loc.checkin_rack(rack.get_entity())
     else:
         Member.update(self, data)
예제 #4
0
파일: location.py 프로젝트: papagr/TheLMA
 def update(self, data):
     if IDataElement.providedBy(data):  # pylint: disable=E1101
         prx = DataElementAttributeProxy(data)
         loc = self.get_entity()
         try:
             rack = prx.rack
         except AttributeError:
             loc.checkout_rack()
         else:
             loc.checkin_rack(rack.get_entity())
     else:
         Member.update(self, data)
예제 #5
0
파일: iso.py 프로젝트: helixyte/TheLMA
 def __getitem__(self, name):
     if name == 'completed-iso-plates' and self.iso_type == ISO_TYPES.LAB:
         # These are the plates that can be used as input for experiment
         # job scheduling.
         iso_plate_bcs = []
         for iso in self.isos:
             if iso.status == ISO_STATUS.DONE:
                 for plt in self.__get_completed_iso_plates_for_iso(iso):
                     iso_plate_bcs.append(plt.barcode)
         iso_plates = get_root_collection(IPlate)
         iso_plates.filter = cntd(barcode=iso_plate_bcs)
         result = iso_plates
     else:
         result = Member.__getitem__(self, name)
     return result
예제 #6
0
파일: iso.py 프로젝트: papagr/TheLMA
 def __getitem__(self, name):
     if name == 'completed-iso-plates' and self.iso_type == ISO_TYPES.LAB:
         # These are the plates that can be used as input for experiment
         # job scheduling.
         iso_plate_bcs = []
         for iso in self.isos:
             if iso.status == ISO_STATUS.DONE:
                 for plt in self.__get_completed_iso_plates_for_iso(iso):
                     iso_plate_bcs.append(plt.barcode)
         iso_plates = get_root_collection(IPlate)
         iso_plates.filter = cntd(barcode=iso_plate_bcs)
         result = iso_plates
     else:
         result = Member.__getitem__(self, name)
     return result
예제 #7
0
파일: experiment.py 프로젝트: papagr/TheLMA
 def __getitem__(self, name):
     if name == 'tags':
         tags_dict = {}
         design_racks = self.__get_design_racks()
         for rack in design_racks:
             for tp in rack.rack_layout.tagged_rack_position_sets:
                 for tag in tp.tags:
                     tags_dict[tag.get_entity().slug] = tag
         tag_coll = get_root_collection(ITag)
         tag_coll.filter = cntd(id=[tag.id for tag in tags_dict.values()])
         result = tag_coll
     elif name == 'experiment-design-racks':
         result = self.__get_design_racks()
     else:
         result = Member.__getitem__(self, name)
     return result
예제 #8
0
 def __getitem__(self, name):
     if name == 'tags':
         tags_dict = {}
         design_racks = self.__get_design_racks()
         for rack in design_racks:
             for tp in rack.rack_layout.tagged_rack_position_sets:
                 for tag in tp.tags:
                     tags_dict[tag.get_entity().slug] = tag
         tag_coll = get_root_collection(ITag)
         tag_coll.filter = cntd(id=[tag.id for tag in tags_dict.values()])
         result = tag_coll
     elif name == 'experiment-design-racks':
         result = self.__get_design_racks()
     else:
         result = Member.__getitem__(self, name)
     return result
예제 #9
0
파일: iso.py 프로젝트: helixyte/TheLMA
 def update(self, data):
     if IDataElement.providedBy(data): # pylint: disable=E1101
         raise SyntaxError('Should not get here.')
     else:
         Member.update(self, data)
예제 #10
0
파일: iso.py 프로젝트: papagr/TheLMA
 def update(self, data):
     if IDataElement.providedBy(data):  # pylint: disable=E1101
         raise SyntaxError('Should not get here.')
     else:
         Member.update(self, data)
예제 #11
0
 def update(self, data):
     if IEntity.providedBy(data): # pylint: disable=E1101
         self.get_entity().molecule_designs = data.molecule_designs
     else:
         Member.update(self, data)