Relative frequency. Where's the error?
0
0
Entering edit mode
3.3 years ago
USER • 0

those are the data

Phe UUU 1483 1.14 Ser UCU 1094 1.47 Tyr UAU 1000 1.12 Cys UGU  434 1.18 
    UUC 1117 0.86     UCC  773 1.04     UAC  789 0.88     UGC  303 0.82 
Leu UUA 1349 1.55     UCA  882 1.19 TER UAA   47 1.27 TER UGA   36 0.97 
    UUG 1549 1.78     UCG  487 0.66     UAG   28 0.76 Trp UGG  665 1.00 

    CUU  698 0.80 Pro CCU  747 1.27 His CAU  677 1.15 Arg CGU  328 0.86 
    CUC  364 0.42     CCC  415 0.71     CAC  499 0.85     CGC  171 0.45 
    CUA  671 0.77     CCA  911 1.55 Gln CAA 1388 1.35     CGA  151 0.39 
    CUG  604 0.69     CCG  281 0.48     CAG  668 0.65     CGG  103 0.27 

Ile AUU 1612 1.35 Thr ACU 1052 1.38 Asn AAU 1778 1.17 Ser AGU  717 0.97 
    AUC 1018 0.85     ACC  660 0.87     AAC 1262 0.83     AGC  500 0.67 
    AUA  943 0.79     ACA  883 1.16 Lys AAA 2118 1.13 Arg AGA 1038 2.71 
Met AUG 1156 1.00     ACG  444 0.58     AAG 1645 0.87     AGG  504 1.32 

Val GUU 1184 1.49 Ala GCU 1055 1.40 Asp GAU 1905 1.25 Gly GGU 1284 1.87 
    GUC  674 0.85     GCC  765 1.01     GAC 1145 0.75     GGC  552 0.80 
    GUA  622 0.78     GCA  836 1.11 Glu GAA 2371 1.41     GGA  557 0.81 
    GUG  690 0.87     GCG  368 0.49     GAG  995 0.59     GGG  355 0.52

53400 codons (used Universal Genetic code)

How do I calculate the relative frequency of each codon and generate a new table?

I have a database with tables like this and I would like to calculate the relative frequency as follows:

1483 (codon value) / 53400 (total codon value) = 0.02777153558 (relative frequency)

I tried to do it that way and was unsuccessful

code:

   import pymysql as MySQLdb



    conexao = MySQLdb.connect(
        host = "localhost",
        user = "xxx",
        passwd = "xxx",
        db = "name_table"
    )

    banco = conexao.cursor()

    #Frequency relative
    banco.execute(
        select * from name_table;
        set @total = (select total from name_table);
        set @ni = (select AAA, BBB from name_table)
        @ni/@total
    )
    banco.fetchall()

    for i in banco.fetchall():
        print(i)

    conexao.close()
gene sequencing genome assembly RNA-Seq • 483 views
ADD COMMENT

Login before adding your answer.

Traffic: 3131 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6