Cool project!
I wrote this example for you that 'transfers' mastermix to a series of wells as you wanted. Note that I used a dummy transfer function to generate some output. You'll need to adjust this of course.
The idea is: first you make a list of sources for both your mastermix and cDNA. Then, for each mastermix, you must make a list of target wells to transfer them to. Then you make the transfer.
If anything else is unclear don't hesitate to ask.
Now try and see if you can adapt this example so you can generate the transfers from the cDNA_sources to the wells as well.
I wrote this example for you that 'transfers' mastermix to a series of wells as you wanted. Note that I used a dummy transfer function to generate some output. You'll need to adjust this of course.
The idea is: first you make a list of sources for both your mastermix and cDNA. Then, for each mastermix, you must make a list of target wells to transfer them to. Then you make the transfer.
# dummy transfer function, just to test def transfer(p_amount, p_source, p_target): print("Transfering {:>5}ul from {} to {}".format(p_amount, p_source, p_target)) # list of sources of mastermix and cDNA mastermix_sources = ['A1', 'A2'] cDNA_sources = ['B1', 'B2', 'B3'] # loop through each source of mastermixes for i, mm in enumerate(mastermix_sources): # make a list of all targets for this mastermix targets =list("{}{}".format(chr(65+i), j+1) for j in range(len(cDNA_sources))) # transfer mastermixes to wells transfer( 10, mm, targets )Which gives me the output:
Output:Transfering 10ul from A1 to ['A1', 'A2', 'A3']
Transfering 10ul from A2 to ['B1', 'B2', 'B3']
Now this line is a bit complicated, so let me explain:targets = list( "{}{}".format(chr(65+i), j+1) for j in range(len(cDNA_sources)) )It generates a list of targets like this:
- for j in range(len(cDNA_sources))
loops j through numbers 0 up to the amount of cDNA sources you have
- "{}{}".format( chr(65+i), j+1)
format replaces {} in the string with the arguments given:- chr(65+i)
chr returns an ASCII character, chr(65) is A, chr(66) is B, etc. i is the index of this mastermix which we have because we used enumerate
- j comes from the for loop. We want the first target to be A1, and j starts at 0, so we add 1
- chr(65+i)
- list makes it into a list (obviously :p)
If anything else is unclear don't hesitate to ask.
Now try and see if you can adapt this example so you can generate the transfers from the cDNA_sources to the wells as well.