Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Code Generator
#3
Firstly, thank you SO much for your help! This has been amazing. I've been looking over the code though, and I had a few questions about adjustments I could make- here's what I wrote it as 


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' ]
cDNA_sources = ['B1', 'B2', 'B3', 'B4' ]
 
for i, mm in enumerate(mastermix_sources):

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

transfer(
           4, 
           mm,
           targets
         )

Sometimes we run the test twice or thrice so we need the mastermix to dispense into more wells. For example, if we had 3 mastermixes and 2 cDNA samples we would have

3 x 2 = 6 platings of mastermix, but if we wanted to preform it double it would be 12 (x2). How could I incorporate a double or triple feature into the code?

I also tried to copy what you did with the first part with mastermix and apply it to cDNA because first we dispense mastermix and then we dispense cDNA - do you know where I went wrong? The output I got was 

Transfering          6ul from A1 to ['A1', 'A2', 'A3', 'A4']
Transfering          6ul from A2 to ['B1', 'B2', 'B3', 'B4']
Transfering          4ul from B4 to ['B1', 'B2']

And so the first part with mastermixes worked great - but not the part I did with cDNA. For cDNA In this case with 2 mastermixes and 4 cDNA samples I would want it to dispense 

from B1 into (on the wells of a plate) into A1, B1
from B2 into (on the wells of a plate) into A2, B2 and so on (assuming we wanted to run the experiment just once, not twice or thrice. 

Thank you for all 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,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