Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Code Generator
#5
Hi! Thanks for your help! I've got it figured out so the mastermix and cDNA go to the right columns and wells! Here is the code:

def transfer(p_amount, p_source, p_target):
 print("Transfering {:>10}ul from {} to {}".format(p_amount, p_source, p_target))
  
mastermix_sources = ['A1', 'A2', 'A3' ]
cDNA_sources = ['B1', 'B2', 'B3' ]

for i, mm in enumerate(mastermix_sources):
  #list of targets for mastermix
  targets = []
  for j in range(len(cDNA_sources)):
    column = chr(65+i)
    row = j+1
    target = "{}{}".format(column, row)
    targets.append(target)
   
  transfer(
           6, 
           mm,
           targets
         )

for i, mm in enumerate(cDNA_sources):
  #list of targets for mastermix
  targets = []
  for j in range(len(mastermix_sources)):
    column = chr(65+j)
    row = i+1
    target = "{}{}".format(column, row)
    targets.append(target)
   
  transfer(
           4, 
           mm,
           targets
         )
The only thing I need to do now is figure out how to duplicate the experiment.

Right now the output is:

Transfering          6ul from A1 to ['A1', 'A2', 'A3']
Transfering          6ul from A2 to ['B1', 'B2', 'B3']
Transfering          6ul from A3 to ['C1', 'C2', 'C3']
Transfering          4ul from B1 to ['A1', 'B1', 'C1']
Transfering          4ul from B2 to ['A2', 'B2', 'C2']
Transfering          4ul from B3 to ['A3', 'B3', 'C3']
and I'm looking to find a way to adjust it so it can be duplicated or tripled. For example, if we duplicate it it looks like this instead:

Transfering          6ul from A1 to ['A1', 'A2', 'A3', 'A4', 'A5', 'A6' ]
Transfering          6ul from A2 to ['B1', 'B2', 'B3', 'B4', 'B5', 'B6']
Transfering          6ul from A3 to ['C1', 'C2', 'C3', 'C4', 'C5', 'C6']
Transfering          4ul from B1 to ['A1', 'B1', 'C1', 'A4', 'B4', 'C4' ]
Transfering          4ul from B2 to ['A2', 'B2', 'C2', 'A5', 'B5', 'C5' ]
Transfering          4ul from B3 to ['A3', 'B3', 'C3', 'A6', 'B6', 'C6' ]
or something to similar affect- also I can't say thank you enough for your help!
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,900 Apr-11-2023, 11:44 PM
Last Post: quazirfan
  Python returns generator instead of None Tawnwen 4 4,933 Mar-09-2018, 07:06 AM
Last Post: DeaD_EyE
  receive from a generator, send to a generator Skaperen 9 5,793 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