Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def robotize_static(well_ref, well_count, col_count):
if isinstance(well_ref, list):
return [
ContainerType.robotize_static(well, well_count, col_count)
for well in well_ref
]
if not isinstance(well_ref, (str, int, Well)):
raise TypeError(
f"ContainerType.robotize(): Well reference "
f"({well_ref}) given is not of type 'str', 'int', "
f"or 'Well'."
)
if isinstance(well_ref, Well):
well_ref = well_ref.index
well_ref = str(well_ref)
m = re.match(r"([a-z])([a-z]?)(\d+)$", well_ref, re.I)
if m:
row = ord(m.group(1).upper()) - ord("A")
if m.group(2):
row = 26 * (row + 1) + ord(m.group(2).upper()) - ord("A")
col = int(m.group(3)) - 1
row_count = well_count // col_count
return ContainerType.well_from_coordinates_static(
row, row_count, col, col_count
)
else:
m = re.match(r"\d+$", well_ref)
if m:
well_num = int(m.group(0))
def robotize_static(well_ref, well_count, col_count):
if isinstance(well_ref, list):
return [
ContainerType.robotize_static(well, well_count, col_count)
for well in well_ref
]
if not isinstance(well_ref, (str, int, Well)):
raise TypeError(
f"ContainerType.robotize(): Well reference "
f"({well_ref}) given is not of type 'str', 'int', "
f"or 'Well'."
)
if isinstance(well_ref, Well):
well_ref = well_ref.index
well_ref = str(well_ref)
m = re.match(r"([a-z])([a-z]?)(\d+)$", well_ref, re.I)
if m:
row = ord(m.group(1).upper()) - ord("A")
if m.group(2):
row = 26 * (row + 1) + ord(m.group(2).upper()) - ord("A")
col = int(m.group(3)) - 1
row_count = well_count // col_count
in the specified location
See Also LiquidHandle.builders.transport
Returns
-------
dict
location parameters for a LiquidHandle instruction
Raises
------
TypeError
If locations aren't str/well
ValueError
If transports are specified, but empty
"""
if not (location is None or isinstance(location, (Well, str))):
raise TypeError(f"Location {location} is not of type str or Well")
if transports is not None:
if not isinstance(transports, Iterable):
raise ValueError(f"Transports: {transports} is not iterable")
transports = [self.transport(**_) for _ in transports]
if len(transports) < 1:
raise ValueError(
f"transports {transports} must be nonempty if specified"
)
return {"location": location, "transports": transports}
def _refify(self, op_data):
if type(op_data) is dict:
return {k: self._refify(v) for k, v in op_data.items()}
elif type(op_data) is list:
return [self._refify(i) for i in op_data]
elif isinstance(op_data, Well):
return self._ref_for_well(op_data)
elif isinstance(op_data, WellGroup):
return [self._ref_for_well(w) for w in op_data.wells]
elif isinstance(op_data, Container):
return self._ref_for_container(op_data)
elif isinstance(op_data, Unit):
return str(op_data)
else:
return op_data
The gel lane for the source sample to be run on
gel : int, optional
The number of the gel if using multiple gels
Returns
-------
dict
gel_purify extract parameters
Raises
------
TypeError
If source is not a Well
"""
if not isinstance(source, Well):
raise TypeError(f"source: {source} is not a Well")
if not isinstance(band_list, list):
band_list = [band_list]
band_list = [self.band(**_) for _ in band_list]
return {"source": source, "band_list": band_list, "lane": lane, "gel": gel}
Parameters
----------
well : Well or WellGroup or list(Well)
Parameter to validate is type Well, WellGroup, list of Wells.
Returns
-------
bool
Returns True if param is of type Well, WellGroup or list of type Well.
"""
from autoprotocol.container import Well, WellGroup
if not isinstance(well, (Well, WellGroup, list)):
return False
if isinstance(well, list):
if not all(isinstance(well, Well) for well in well):
return False
return True
Parameters
----------
other : Well, WellGroup.
Returns
-------
WellGroup
WellGroup with appended wells
Raises
------
TypeError
Input given is not of type Well or WellGroup
"""
if not isinstance(other, (Well, WellGroup)):
raise TypeError("You can only add a Well or WellGroups " "together.")
if isinstance(other, Well):
return WellGroup(self.wells + [other])
else:
return WellGroup(self.wells + other.wells)
def __init__(self, id, container_type, name=None, storage=None, cover=None):
self.name = name
self.id = id
self.container_type = container_type
self.storage = storage
self.cover = cover
self._wells = [Well(self, idx) for idx in range(container_type.well_count)]
if self.cover and not (self.is_covered() or self.is_sealed()):
raise AttributeError(f"{cover} is not a valid seal or cover type.")
raise TypeError("Source must be of type Well, list of Wells, or "
"WellGroup.")
Parameters
----------
well : Well or WellGroup or list(Well)
Parameter to validate is type Well, WellGroup, list of Wells.
Returns
-------
bool
Returns True if param is of type Well, WellGroup or list of type Well.
"""
from autoprotocol.container import Well, WellGroup
if not isinstance(well, (Well, WellGroup, list)):
return False
if isinstance(well, list):
if not all(isinstance(well, Well) for well in well):
return False
return True