Example #1
0
 def _get_robot_uuid(self) -> str:
     if self._automation_system_name.value in app.config["BIOSERO_ROBOTS"].keys():
         val: str = app.config["BIOSERO_ROBOTS"][self._automation_system_name.value]["uuid"]
         if val is None:
             raise RetrievalError(f"Unable to determine a uuid for robot '{self._automation_system_name.value}'")
         return val
     else:
         raise RetrievalError(f"Robot with barcode {self._automation_system_name.value} not found")
Example #2
0
 def _source_barcodes(self):
     val = set()
     for sample in self._wells_from_destination.value:
         sample_type = sample.get("type")
         if sample_type is None:
             raise RetrievalError(
                 f"Cannot extract type from the well: {sample}")
         if sample_type == "sample":
             sample_source_barcode = sample.get("source_barcode")
             if sample_source_barcode is None:
                 raise RetrievalError(
                     f"Cannot extract source barcode from the well: {sample}"
                 )
             if sample_source_barcode not in val:
                 val.add(sample_source_barcode)
     return list(val)
 def _is_valid_positive_and_negative_present(self, wells):
     control_types = [well["control"] for well in wells]
     control_types.sort()
     if control_types != ["negative", "positive"]:
         raise RetrievalError(
             "We were expecting one positive and one negative control to be present."
         )
 def _is_valid_destination_coordinate_not_duplicated(self, wells):
     coordinates = [well["destination_coordinate"] for well in wells]
     duplicates = set(
         [coor for coor in coordinates if coordinates.count(coor) > 1])
     if len(duplicates) > 0:
         raise RetrievalError(
             f"Some coordinates have clashing samples/controls: { duplicates }"
         )
Example #5
0
 def value(self):
     with self.retrieval_scope():
         val = self.get_source_plate_uuid(self._barcode_property.value)
         if val is None:
             raise RetrievalError(
                 f"Unable to determine a UUID for source plate '{self._barcode_property.value}'"
             )
         return val
 def _get_sample_with_uuid(self, samples, uuid):
     for sample in samples:
         if sample[FIELD_CHERRYTRACK_LH_SAMPLE_UUID] == uuid:
             return sample
     raise RetrievalError(
         f"We could not find sample with lh sample uuid {uuid}")
 def _is_valid_no_duplicate_uuids(self, uuids):
     duplicates = set([uuid for uuid in uuids if uuids.count(uuid) > 1])
     if len(duplicates) > 0:
         raise RetrievalError(
             f"There is duplication in the lh sample uuids provided: { list(duplicates) }"
         )