[BioPython] Tm with RNA support

Sebastian Bassi sbassi at asalup.org
Thu Nov 27 15:37:21 EST 2003


Here is the version with RNA support (by default is DNA), to enable the 
RNA tm, use rna=1 as argument.



import string
import math

def Tm_dan(s,dnac=50,saltc=50,rna=0):
     """Returns DNA/RNA tm using nearest neighbor thermodynamics. dnac is
     DNA/RNA concentration [nM] and saltc is salt concentration [mM]
     rna=0 is for DNA (default), for RNA, rna should be <>0.
     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
     if rna==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
     else:
 
vh=(overcount(sup,"AA"))*6.6+(overcount(sup,"TT"))*6.6+(overcount(sup,"AT"))*5.7+(overcount(sup,"TA"))*8.1+(overcount(sup,"CA"))*10.5+(overcount(sup,"TG"))*10.5+(overcount(sup,"GT"))*10.2+(overcount(sup,"AC"))*10.2
 
vh=vh+(overcount(sup,"CT"))*7.6+(overcount(sup,"AG"))*7.6+(overcount(sup,"GA"))*13.3+(overcount(sup,"TC"))*13.3
 
vh=vh+(overcount(sup,"CG"))*8.0+(overcount(sup,"GC"))*14.2+(overcount(sup,"GG"))*12.2+(overcount(sup,"CC"))*12.2
 
vs=(overcount(sup,"AA"))*18.4+(overcount(sup,"TT"))*18.4+(overcount(sup,"AT"))*15.5+(overcount(sup,"TA"))*16.9
 
vs=vs+(overcount(sup,"CA"))*27.8+(overcount(sup,"TG"))*27.8+(overcount(sup,"GT"))*26.2+(overcount(sup,"AC"))*26.2
 
vs=vs+(overcount(sup,"CT"))*19.2+(overcount(sup,"AG"))*19.2+(overcount(sup,"GA"))*35.5+(overcount(sup,"TC"))*35.5
 
vs=vs+(overcount(sup,"CG"))*19.4+(overcount(sup,"GC"))*34.9+(overcount(sup,"GG"))*29.7+(overcount(sup,"CC"))*29.7

     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: tm.zip
Type: application/x-zip-compressed
Size: 1131 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/biopython/attachments/20031127/43a0f1c1/tm.bin


More information about the BioPython mailing list