-
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.
Merge pull request #4983 from Opentrons/normalization
fix(protocols/normalization): update api level to 2.12
- Loading branch information
Showing
2 changed files
with
3 additions
and
3 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": "metadata = {\n 'protocolName': 'Normalization',\n 'author': 'Opentrons <[email protected]>',\n 'source': 'Protocol Library',\n 'apiLevel': '2.2'\n }\n\ntiprack_slots = ['1', '4', '7', '10']\n\n\ndef transpose_matrix(m):\n return [[r[i] for r in reversed(m)] for i in range(len(m[0]))]\n\n\ndef flatten_matrix(m):\n return [cell for row in m for cell in row]\n\n\ndef well_csv_to_list(csv_string):\n \"\"\"\n Takes a csv string and flattens it to a list, re-ordering to match\n Opentrons well order convention (A1, B1, C1, ..., A2, B2, B2, ...)\n \"\"\"\n data = [\n line.split(',')\n for line in reversed(csv_string.split('\\n')) if line.strip()\n if line\n ]\n if len(data[0]) > len(data):\n # row length > column length ==> \"landscape\", so transpose\n return flatten_matrix(transpose_matrix(data))\n # \"portrait\"\n return flatten_matrix(data)\n\n\ndef run(protocol):\n [volumes_csv, pip_model, pip_mount, plate_type,\n res_type, filter_tip, tip_reuse] = get_values( # noqa: F821\n 'volumes_csv', 'pip_model', 'pip_mount', 'plate_type',\n 'res_type', 'filter_tip', 'tip_reuse')\n\n # create labware\n plate = protocol.load_labware(plate_type, '3')\n\n reservoir = protocol.load_labware(res_type, '2')\n source = reservoir.wells()[0]\n\n pip_size = pip_model.split('_')[0][1:]\n\n pip_size = '300' if pip_size == '50' else pip_size\n tip_name = 'opentrons_96_tiprack_'+pip_size+'ul'\n if filter_tip == 'yes':\n pip_size = '200' if pip_size == '300' else pip_size\n tip_name = 'opentrons_96_filtertiprack_'+pip_size+'ul'\n\n tipracks = [protocol.load_labware(tip_name, slot)\n for slot in tiprack_slots]\n\n pipette = protocol.load_instrument(pip_model, pip_mount,\n tip_racks=tipracks)\n\n # create volumes list\n volumes = [float(cell) for cell in well_csv_to_list(volumes_csv)]\n\n for vol in volumes:\n if vol < pipette.min_volume:\n protocol.comment(\n 'WARNING: volume {} is below pipette\\'s minimum volume.'\n .format(vol))\n\n if tip_reuse == 'never':\n pipette.pick_up_tip()\n\n for vol, dest in zip(volumes, plate.wells()):\n if vol > 0:\n pipette.transfer(vol, source, dest, new_tip=tip_reuse)\n\n if pipette.has_tip:\n pipette.drop_tip()\n", | ||
"content": "metadata = {\n 'protocolName': 'Normalization',\n 'author': 'Opentrons <[email protected]>',\n 'source': 'Protocol Library',\n 'apiLevel': '2.12'\n }\n\ntiprack_slots = ['1', '4', '7', '10']\n\n\ndef transpose_matrix(m):\n return [[r[i] for r in reversed(m)] for i in range(len(m[0]))]\n\n\ndef flatten_matrix(m):\n return [cell for row in m for cell in row]\n\n\ndef well_csv_to_list(csv_string):\n \"\"\"\n Takes a csv string and flattens it to a list, re-ordering to match\n Opentrons well order convention (A1, B1, C1, ..., A2, B2, B2, ...)\n \"\"\"\n data = [\n line.split(',')\n for line in reversed(csv_string.split('\\n')) if line.strip()\n if line\n ]\n if len(data[0]) > len(data):\n # row length > column length ==> \"landscape\", so transpose\n return flatten_matrix(transpose_matrix(data))\n # \"portrait\"\n return flatten_matrix(data)\n\n\ndef run(protocol):\n [volumes_csv, pip_model, pip_mount, plate_type,\n res_type, filter_tip, tip_reuse] = get_values( # noqa: F821\n 'volumes_csv', 'pip_model', 'pip_mount', 'plate_type',\n 'res_type', 'filter_tip', 'tip_reuse')\n\n # create labware\n plate = protocol.load_labware(plate_type, '3')\n\n reservoir = protocol.load_labware(res_type, '2')\n source = reservoir.wells()[0]\n\n pip_size = pip_model.split('_')[0][1:]\n\n pip_size = '300' if pip_size == '50' else pip_size\n tip_name = 'opentrons_96_tiprack_'+pip_size+'ul'\n if filter_tip == 'yes':\n pip_size = '200' if pip_size == '300' else pip_size\n tip_name = 'opentrons_96_filtertiprack_'+pip_size+'ul'\n\n tipracks = [protocol.load_labware(tip_name, slot)\n for slot in tiprack_slots]\n\n pipette = protocol.load_instrument(pip_model, pip_mount,\n tip_racks=tipracks)\n\n # create volumes list\n volumes = [float(cell) for cell in well_csv_to_list(volumes_csv)]\n\n for vol in volumes:\n if vol < pipette.min_volume:\n protocol.comment(\n 'WARNING: volume {} is below pipette\\'s minimum volume.'\n .format(vol))\n\n if tip_reuse == 'never':\n pipette.pick_up_tip()\n\n for vol, dest in zip(volumes, plate.wells()):\n if vol > 0:\n pipette.transfer(vol, source, dest, new_tip=tip_reuse)\n\n if pipette.has_tip:\n pipette.drop_tip()\n", | ||
"custom_labware_defs": [], | ||
"fields": [ | ||
{ | ||
|
@@ -198,7 +198,7 @@ | |
} | ||
], | ||
"metadata": { | ||
"apiLevel": "2.2", | ||
"apiLevel": "2.12", | ||
"author": "Opentrons <[email protected]>", | ||
"protocolName": "Normalization", | ||
"source": "Protocol Library" | ||
|
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
'protocolName': 'Normalization', | ||
'author': 'Opentrons <[email protected]>', | ||
'source': 'Protocol Library', | ||
'apiLevel': '2.2' | ||
'apiLevel': '2.12' | ||
} | ||
|
||
tiprack_slots = ['1', '4', '7', '10'] | ||
|