[BioPython] New function ready (dna melting temperature)

Sebastian Bassi sbassi at asalup.org
Thu Nov 27 12:52:39 EST 2003


Hello,

As I promised before (back to Nov-4), I wrote a function to get the DNA 
melting temperature. Since I don't have CVS access, I'll post it here.

It would be trivial to make a version for RNA, with a optional parameter 
that if checked would mean is RNA. What do you think?


import string
import math

def Tm_dan(s,dnac=50,saltc=50):
     """Returns DNA mt using nearest neighbor thermodynamics. dnac is
     DNA concentration [nM] and saltc is salt concentration [mM]
     Works as EMBOSS dan, taken from (Breslauer et al. Proc. Natl. Acad.
     Sci. USA 83, 3746-3750 and Baldino et al. Methods in Enzymol. 168, 
761-777).
     Overcount function thanks to Greg Singer <singerg at tcd.ie>, rest by
     Sebastian Bassi <sbassi at genesdigitales.com>"""

     def overcount(st,p):
         """Returns how many p are on st, works even for overlapping"""
         ocu=0
         x=0
         while 1:
             try:
                 i=st.index(p,x)
             except ValueError:
                 break
             ocu=ocu+1
             x=i+1
         return ocu

     sup=string.upper(s)
     r = 1.98717
     LogDNA = r * math.log(c/4e9)
     vh=0
     vs=0
 
vh=(overcount(sup,"AA"))*7.9+(overcount(sup,"TT"))*7.9+(overcount(sup,"AT"))*7.2+(overcount(sup,"TA"))*7.2+(overcount(sup,"CA"))*8.5+(overcount(sup,"TG"))*8.5+(overcount(sup,"GT"))*8.4+(overcount(sup,"AC"))*8.4
 
vh=vh+(overcount(sup,"CT"))*7.8+(overcount(sup,"AG"))*7.8+(overcount(sup,"GA"))*8.2+(overcount(sup,"TC"))*8.2
 
vh=vh+(overcount(sup,"CG"))*10.6+(overcount(sup,"GC"))*9.8+(overcount(sup,"GG"))*8+(overcount(sup,"CC"))*8
 
vs=(overcount(sup,"AA"))*22.2+(overcount(sup,"TT"))*22.2+(overcount(sup,"AT"))*20.4+(overcount(sup,"TA"))*21.3
 
vs=vs+(overcount(sup,"CA"))*22.7+(overcount(sup,"TG"))*22.7+(overcount(sup,"GT"))*22.4+(overcount(sup,"AC"))*22.4
 
vs=vs+(overcount(sup,"CT"))*21.0+(overcount(sup,"AG"))*21.0+(overcount(sup,"GA"))*22.2+(overcount(sup,"TC"))*22.2
 
vs=vs+(overcount(sup,"CG"))*27.2+(overcount(sup,"GC"))*24.4+(overcount(sup,"GG"))*19.9+(overcount(sup,"CC"))*19.9
     entropy = -10.8 - vs
     entropy = entropy + ((len(s)-1) * (math.log10(saltconc/1000.0))*0.368)
     dTm = ((-vh*1000) / (entropy+LogDNA)) - 273.15
     print vh,vs,entropy
     return dTm



-- 
Best regards,

//=\ Sebastian Bassi - Diplomado en Ciencia y Tecnologia, UNQ   //=\
\=// IT Manager Advanta Seeds - Balcarce Research Center -      \=//
//=\ Pro secretario ASALUP - www.asalup.org - PGP key available //=\
\=// E-mail: sbassi at genesdigitales.com - ICQ UIN: 3356556 -     \=//

                 http://Bioinformatica.info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: primertm3fun.zip
Type: application/x-zip-compressed
Size: 911 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/biopython/attachments/20031127/72f38c8a/primertm3fun.bin


More information about the BioPython mailing list