Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Code Generator
#1
I'm new to coding, but I've taken on a project to write a python code that generates plating for PCR set up.

At my lab we use a machine called OpenTrons hood and within it through python you can program protocols. This part is generally straightforward. Below is one code I set up for a PCR set up:

   from opentrons import robot, containers, instruments

robot.head_speed(x=3000,  y=3000,  z=800, a=300, b=300)

# containers
plate = containers.load('96-PCR-short', 'D1', 'plate')
tube_rack = containers.load('tube-rack-.75ml', 'C1', 'tube_rack')

# a tip rack for our pipette
p10rack = containers.load('tiprack-10ul', 'B1', 'tiprack')
trash = containers.load('point', 'A1', 'trash' )

# p10 pipette on robot axis A
p10 = instruments.Pipette(
    trash_container=trash,
    name="p10",
    axis= "a",
    min_volume=1,
    max_volume=10,
    tip_racks=[p10rack]
)

# simple, atomic commands to control fine details
p10.pick_up_tip()

p10.transfer(
    6,
    tube_rack.wells('A1'),
    plate.wells('A1', 'A2', 'A3', 'B1', 'B2', 'B3', 'C1', 'C2', 'C3', 'G1', 'G2', 'G3'),
    blow_out=True

)

p10.transfer(
    6,
    tube_rack.wells('A2'),
    plate.wells('D1', 'D2', 'D3', 'E1', 'E2', 'E3', 'F1', 'F2', 'F3', 'H1', 'H2', 'H3'),
    blow_out=True

)


p10.transfer(
    4,
    tube_rack.wells('B1'),
    plate.wells('A1', 'B1', 'C1', 'D1', 'E1', 'F1'),
    blow_out=True
)

p10.transfer(
    4,
    tube_rack.wells('B2'),
    plate.wells('A2', 'B2', 'C2', 'D2', 'E2', 'F2'),
    blow_out=True
)

p10.transfer(
    4,
    tube_rack.wells('B3'),
    plate.wells('A3', 'B3', 'C3', 'D3', 'E3', 'F3',),
    blow_out=True
)

p10.transfer(
    4,
    tube_rack.wells('B4'),
    plate.wells('G1', 'G2', 'G3', 'H1', 'H2', 'H3',),
    blow_out=True
)
What this code does is first it pipettes different master mixes (liquid) into a certain amount of holes (wells). Then, it transfer another liquid (cDNA samples) into certain wells to test each mastermix against each cDNA sample 3 times. Lastly, it transfers water into 3 wells for each mastermix as a negative. The code above is for 2 mastermixes and 3 samples of cDNA and preforms this trice.

What I want to do though, is set up a code that allows you to enter in a number of mastermixes, a number of cDNA samples, and generates the plating for you (as you can see it dictates exactly what plate to transport liquid into in the code).

Here is what I want the code to do:

1. Assign mastermix to the x or y axis
The plate has rows A-H (y) and columns (1-12) (x). Assign mastermix to any number of rows or columns

I.e. say we had 3 mastermixes we could arrange it as

Mastermix 1 (A)
Mastermix 2 (B)... and so on

2. Assign cDNA & water to the remaining axis
Say we were testing 3 cDNA samples and we wanted to preform this test twice it would look something like this...

cDNA 1 (1-2)
cDNA 2 (3-4)
cDNA 3 (5-6)

then water for our negatives

water (7-8)

The code would then generate the plating for you.

In the code you might also notice tubing - there is a tube rack where we aspirate liquid from and it (will have) default set up as

A1 - Ax for mastermix
B1 - Bx for cDNA
C1 - water

I'm very new to coding and I was wondering how I could first approach creating this code.

**in the code I posted water is B4 but I will move it to C1 for simplicity
Reply


Messages In This Thread
Python Code Generator - by KatherineHov - Jul-24-2017, 05:58 PM
RE: Python Code Generator - by MTVDNA - Jul-24-2017, 10:00 PM
RE: Python Code Generator - by KatherineHov - Jul-25-2017, 04:13 PM
RE: Python Code Generator - by MTVDNA - Jul-25-2017, 04:52 PM
RE: Python Code Generator - by KatherineHov - Jul-25-2017, 05:40 PM
RE: Python Code Generator - by MTVDNA - Jul-25-2017, 06:03 PM
RE: Python Code Generator - by KatherineHov - Jul-25-2017, 09:16 PM
RE: Python Code Generator - by MTVDNA - Jul-25-2017, 09:54 PM
RE: Python Code Generator - by KatherineHov - Jul-26-2017, 05:15 PM
RE: Python Code Generator - by MTVDNA - Jul-26-2017, 09:56 PM
RE: Python Code Generator - by KatherineHov - Jul-27-2017, 01:22 AM
RE: Python Code Generator - by MTVDNA - Jul-27-2017, 10:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is the following code returning a generator expression? quazirfan 8 1,867 Apr-11-2023, 11:44 PM
Last Post: quazirfan
  Python returns generator instead of None Tawnwen 4 4,898 Mar-09-2018, 07:06 AM
Last Post: DeaD_EyE
  receive from a generator, send to a generator Skaperen 9 5,722 Feb-05-2018, 06:26 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020