I wrote this code so I could figure out the number of molecules within a plasmid and an insert of DNA. I then get the amount of insert DNA I would need to use (in uL) for a ligation with the DNA at different insert ratios and dilutions.
How can I clean up this code? It works correctly. However, I feel like I typed this out all the extremely long way and I would love to know how to make this more performant.
In my next project I would like to not have to type all of these out. I imagine that I am missing some functions or loops. I am still a very new beginner and this is my first project outside of a classroom.
print "Please put the amount of BPs: " number = int(raw_input()) solution = (number * 660) Avo = (6.022 * (10 ** 23)) Grams_Avo = ( solution / Avo) print "Put in Concentration (ng/ul): " conc = float(raw_input()) multiple = (10 ** -9) amount = (conc * multiple) total = float(amount / Grams_Avo) print "Amount of molecules: %s" % total print "Amount of ul used by the plasmid: " plasmid = float(raw_input()) particles = float(plasmid * total) print "What ratio amount will you use?: " ratio = int(raw_input()) molecules_needed = float(particles * ratio) print molecules_needed print "Conc. of your oligo?: " oligo = float(raw_input()) oligo_num = float(oligo * multiple) # amount print "Enter number of G in Oligo: " G = int(raw_input()) print "Enter number of A in Oligo: " A = int(raw_input()) print "Enter number of T in Oligo: " T = int(raw_input()) print "Enter number of C in Oligo: " C = int(raw_input()) sumG = (G * 329) sumA = (A * 313) sumT = (T * 304) sumC = (C * 289) daoligo = (sumG + sumA + sumT + sumC) # g/mol print "Total amount of your insert %s" % daoligo oligototal = float(oligo_num / (daoligo/Avo)) # molecules for insert complete = float(molecules_needed/oligototal) #amount of insert needed from stock ul print "What dilution will you use?" print "1. Stock" print "2. 1:10" print "3. 1:20" print "4. 1:30" print "5. 1:50" code = float(raw_input()) if code == 1: print complete #stock elif code == 2: code2 = (oligototal/10) complete1 = float(molecules_needed/code2) print complete1 #1:10 elif code == 3: code3 (oligototal/20) complete2 = float(molecules_needed/code3) print complete2 #1:20 elif code == 4: code4 = (oligototal/30) complete3 = float(molecules_needed/code4) print complete3 #1:30 elif code == 5: code_5 = (oligototal/50) complete4 = float(molecules_needed/code_5) print complete4 #1:50