Skip to content

Commit

Permalink
Merge pull request #4983 from Opentrons/normalization
Browse files Browse the repository at this point in the history
fix(protocols/normalization): update api level to 2.12
  • Loading branch information
anuwrag authored Dec 8, 2023
2 parents 73cc712 + 1b6b1ff commit 3d60fa8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions protoBuilds/normalization/normalization.ot2.apiv2.py.json
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": [
{
Expand Down Expand Up @@ -198,7 +198,7 @@
}
],
"metadata": {
"apiLevel": "2.2",
"apiLevel": "2.12",
"author": "Opentrons <[email protected]>",
"protocolName": "Normalization",
"source": "Protocol Library"
Expand Down
2 changes: 1 addition & 1 deletion protocols/normalization/normalization.ot2.apiv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 3d60fa8

Please sign in to comment.