Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Code Generator
#7
To make the functions replicate I just added in a variable to replicate it. It's basically the same code but:

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' ]

replicate = 2

for i, mm in enumerate(mastermix_sources):
  #list of targets for mastermix
  targets = []
  for j in range(len(cDNA_sources * replicate)):
    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 * replicate):
  #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
         )
I'm still working to collaborate all the results into one line, so results are all put together, i.e. there aren't two lines for cDNA where 

B= values

However, as I work through that, I was wondering, if alternatively, there was is a way to transfer plate numbers (A1, A2,) to just numbers (1,2,3,4,5,6)

so A1 = 1
A12 = 12
B1 = 13
B12 = 24 

and so on. What would be the easiest way of working towards this?

What I've tried so far is assigning A1 = 1 and so on but I get an error that says I can't assign it to literal - which makes sense becaues it is a number. I find the A1, B1, C1 format easier to understand, but for some plates we require combinations that go past H1 (which is the last letter we have for a column). Do I need to make a list of consecutive numbers somewhere?
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