-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
“ramifarawi”
committed
Jul 12, 2024
1 parent
013ec4f
commit 9c01e87
Showing
2 changed files
with
3 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"content": "import math\nfrom opentrons.protocol_api.labware import Well\n\nmetadata = {\n 'protocolName': 'Tube Filling',\n 'author': 'Opentrons <[email protected]>',\n 'source': 'Custom Protocol Request',\n 'apiLevel': '2.11'\n}\n\n\ndef run(protocol):\n [transferVol, tubeRacks, tubeType, numRacks, srcType, srcVol,\n pipType, pipMnt, startTip, dispMode, touchTip] = get_values( # noqa: F821\n 'transferVol', 'tubeRacks', 'tubeType', 'numRacks', 'srcType', 'srcVol',\n 'pipType', 'pipMnt', 'startTip', 'dispMode', 'touchTip')\n\n # Load labware and pipettes\n\n tipNum = pipType.split('_')[0][1:]\n tipNum = '300' if tipNum == '50' else tipNum\n tipType = f'opentrons_96_tiprack_{tipNum}ul'\n tips = [protocol.load_labware(tipType, '11')]\n pip = protocol.load_instrument(pipType, pipMnt, tip_racks=tips)\n\n firstTip = startTip[0].upper()+str(int(startTip[1:]))\n pip.starting_tip = tips[0][firstTip]\n\n srcLabware = protocol.load_labware(srcType, '1')\n\n destRacks = [\n protocol.load_labware(tubeRacks+tubeType, slot) for slot in range(\n 2, 2+numRacks)]\n\n # Functions and Class creation\n if not protocol.is_simulating:\n class WellH(Well):\n def __init__(self, well, min_height=5, comp_coeff=1.15,\n current_volume=0):\n super().__init__(well._impl)\n self.well = well\n self.min_height = min_height\n self.comp_coeff = comp_coeff\n self.current_volume = current_volume\n if self.diameter is not None:\n self.radius = self.diameter/2\n cse = math.pi*(self.radius**2)\n elif self.length is not None:\n cse = self.length*self.width\n self.height = (\n current_volume/cse) - (0.2*pip._tip_racks[0].wells()[0].depth)\n if self.height < min_height:\n self.height = min_height\n elif self.height > well.parent.highest_z:\n raise Exception(\"\"\"Specified liquid volume\n can not exceed the height of the labware.\"\"\")\n\n def height_dec(self, vol):\n if self.diameter is not None:\n cse = math.pi*(self.radius**2)\n elif self.length is not None:\n cse = self.length*self.width\n dh = (vol/cse)*self.comp_coeff\n if self.height - dh > self.min_height:\n self.height = self.height - dh\n else:\n self.height = self.min_height\n if self.current_volume - vol > 0:\n self.current_volume = self.current_volume - vol\n else:\n self.current_volume = 0\n return(self.well.bottom(self.height))\n\n def height_inc(self, vol, top=False):\n if self.diameter is not None:\n cse = math.pi*(self.radius**2)\n elif self.length is not None:\n cse = self.length*self.width\n ih = (vol/cse)*self.comp_coeff\n if self.height < self.min_height:\n self.height = self.min_height\n if self.height + ih < self.depth:\n self.height = self.height + ih\n else:\n self.height = self.depth\n self.current_volume += vol\n if top is False:\n return(self.well.bottom(self.height))\n else:\n return(self.well.top())\n\n def yield_groups(list, num):\n \"\"\"\n yield lists based on number of items\n \"\"\"\n for i in range(0, len(list), num):\n yield list[i:i+num]\n\n # get number of distributes pipette can handle\n distribute_num = pip.max_volume // transferVol\n if distribute_num < 1:\n # if transfer volume is greater than pipette max volume,\n # use Transfer mode\n dispMode = 'Transfer'\n\n # create source location with WellH\n source = WellH(\n srcLabware.wells()[0], min_height=3, current_volume=srcVol*1000)\n\n # Protocol: Tube filling\n pip.pick_up_tip()\n all_wells = [well for tuberack in destRacks for well in tuberack.wells()]\n if dispMode == 'Transfer':\n for dest in all_wells:\n pip.transfer(\n transferVol, source.height_dec(transferVol), dest,\n touch_tip=touchTip, new_tip='never')\n else:\n well_groups = list(yield_groups(all_wells, int(distribute_num)))\n for wells in well_groups:\n pip.distribute(\n transferVol, source.height_dec(transferVol), wells,\n blow_out=source, touch_tip=touchTip, new_tip='never')\n pip.drop_tip()\n", | ||
"content": "import math\nfrom opentrons.protocol_api.labware import Well\n\nmetadata = {\n 'protocolName': 'Tube Filling',\n 'author': 'Opentrons <[email protected]>',\n 'source': 'Custom Protocol Request',\n 'apiLevel': '2.11'\n}\n\n\ndef run(protocol):\n [transferVol, tubeRacks, tubeType, numRacks, srcType, srcVol,\n pipType, pipMnt, startTip, dispMode, touchTip] = get_values( # noqa: F821\n 'transferVol', 'tubeRacks', 'tubeType', 'numRacks', 'srcType', 'srcVol',\n 'pipType', 'pipMnt', 'startTip', 'dispMode', 'touchTip')\n\n # Load labware and pipettes\n\n tipNum = pipType.split('_')[0][1:]\n tipNum = '300' if tipNum == '50' else tipNum\n tipType = f'opentrons_96_tiprack_{tipNum}ul'\n tips = [protocol.load_labware(tipType, '11')]\n pip = protocol.load_instrument(pipType, pipMnt, tip_racks=tips)\n\n firstTip = startTip[0].upper()+str(int(startTip[1:]))\n pip.starting_tip = tips[0][firstTip]\n\n srcLabware = protocol.load_labware(srcType, '1')\n\n destRacks = [\n protocol.load_labware(tubeRacks+tubeType, slot) for slot in range(\n 2, 2+numRacks)]\n\n # Functions and Class creation\n if not protocol.is_simulating:\n class WellH(Well):\n def __init__(self, well, min_height=5, comp_coeff=1.15,\n current_volume=0):\n super().__init__(well._impl)\n self.well = well\n self.min_height = min_height\n self.comp_coeff = comp_coeff\n self.current_volume = current_volume\n if self.diameter is not None:\n self.radius = self.diameter/2\n cse = math.pi*(self.radius**2)\n elif self.length is not None:\n cse = self.length*self.width\n self.height = (\n current_volume/cse) - (0.2*pip._tip_racks[0].wells()[0].depth)\n if self.height < min_height:\n self.height = min_height\n elif self.height > well.parent.highest_z:\n raise Exception(\"\"\"Specified liquid volume\n can not exceed the height of the labware.\"\"\")\n\n def height_dec(self, vol):\n if self.diameter is not None:\n cse = math.pi*(self.radius**2)\n elif self.length is not None:\n cse = self.length*self.width\n dh = (vol/cse)*self.comp_coeff\n if self.height - dh > self.min_height:\n self.height = self.height - dh\n else:\n self.height = self.min_height\n if self.current_volume - vol > 0:\n self.current_volume = self.current_volume - vol\n else:\n self.current_volume = 0\n return(self.well.bottom(self.height))\n\n def height_inc(self, vol, top=False):\n if self.diameter is not None:\n cse = math.pi*(self.radius**2)\n elif self.length is not None:\n cse = self.length*self.width\n ih = (vol/cse)*self.comp_coeff\n if self.height < self.min_height:\n self.height = self.min_height\n if self.height + ih < self.depth:\n self.height = self.height + ih\n else:\n self.height = self.depth\n self.current_volume += vol\n if top is False:\n return(self.well.bottom(self.height))\n else:\n return(self.well.top())\n\n def yield_groups(list, num):\n \"\"\"\n yield lists based on number of items\n \"\"\"\n for i in range(0, len(list), num):\n yield list[i:i+num]\n\n # get number of distributes pipette can handle\n distribute_num = pip.max_volume // transferVol\n if distribute_num < 1:\n # if transfer volume is greater than pipette max volume,\n # use Transfer mode\n dispMode = 'Transfer'\n\n # create source location with WellH\n source = WellH(\n srcLabware.wells()[0], min_height=3, current_volume=srcVol*1000)\n\n # Protocol: Tube filling\n pip.pick_up_tip()\n all_wells = [well\n for tuberack in destRacks for well in tuberack.wells()]\n if dispMode == 'Transfer':\n for dest in all_wells:\n pip.transfer(\n transferVol, source.height_dec(transferVol), dest,\n touch_tip=touchTip, new_tip='never')\n else:\n well_groups = list(yield_groups(all_wells, int(distribute_num)))\n for wells in well_groups:\n pip.distribute(\n transferVol, source.height_dec(transferVol), wells,\n blow_out=source, touch_tip=touchTip, new_tip='never')\n pip.drop_tip()\n", | ||
"custom_labware_defs": [ | ||
{ | ||
"brand": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters