convert_RSCU_mat_into_codon_freq_df <- function (mat) {
mat.df<-as.data.frame(mat)
mat.df.new<-mat.df
mat.df.new$Lys_AAA<-mat.df$Lys_AAA/(mat.df$Lys_AAA+mat.df$Lys_AAG)
mat.df.new$Asn_AAC<-mat.df$Asn_AAC/(mat.df$Asn_AAC+mat.df$Asn_AAU)
mat.df.new$Lys_AAG<-mat.df$Lys_AAG/(mat.df$Lys_AAA+mat.df$Lys_AAG)
mat.df.new$Asn_AAU<-mat.df$Asn_AAU/(mat.df$Asn_AAC+mat.df$Asn_AAU)
mat.df.new$Thr_ACA<-mat.df$Thr_ACA/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACC<-mat.df$Thr_ACC/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACG<-mat.df$Thr_ACG/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACU<-mat.df$Thr_ACU/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Arg_AGA<-mat.df$Arg_AGA/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Ser_AGC<-mat.df$Ser_AGC/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Arg_AGG<-mat.df$Arg_AGG/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Ser_AGU<-mat.df$Ser_AGU/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ile_AUA<-mat.df$Ile_AUA/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Ile_AUC<-mat.df$Ile_AUC/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Met_AUG<-mat.df$Met_AUG/(mat.df$Met_AUG)
mat.df.new$Ile_AUU<-mat.df$Ile_AUU/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Gln_CAA<-mat.df$Gln_CAA/(mat.df$Gln_CAA+mat.df$Gln_CAG)
mat.df.new$His_CAC<-mat.df$His_CAC/(mat.df$His_CAC+mat.df$His_CAU)
mat.df.new$Gln_CAG<-mat.df$Gln_CAG/(mat.df$Gln_CAA+mat.df$Gln_CAG)
mat.df.new$His_CAU<-mat.df$His_CAU/(mat.df$His_CAC+mat.df$His_CAU)
mat.df.new$Pro_CCA<-mat.df$Pro_CCA/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCC<-mat.df$Pro_CCC/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCG<-mat.df$Pro_CCG/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCU<-mat.df$Pro_CCU/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Arg_CGA<-mat.df$Arg_CGA/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGC<-mat.df$Arg_CGC/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGG<-mat.df$Arg_CGG/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGU<-mat.df$Arg_CGU/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Leu_CUA<-mat.df$Leu_CUA/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUC<-mat.df$Leu_CUC/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUG<-mat.df$Leu_CUG/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUU<-mat.df$Leu_CUU/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Glu_GAA<-mat.df$Glu_GAA/(mat.df$Glu_GAA+mat.df$Glu_GAG)
mat.df.new$Asp_GAC<-mat.df$Asp_GAC/(mat.df$Asp_GAC+mat.df$Asp_GAU)
mat.df.new$Glu_GAG<-mat.df$Glu_GAG/(mat.df$Glu_GAA+mat.df$Glu_GAG)
mat.df.new$Asp_GAU<-mat.df$Asp_GAU/(mat.df$Asp_GAC+mat.df$Asp_GAU)
mat.df.new$Ala_GCA<-mat.df$Ala_GCA/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCC<-mat.df$Ala_GCC/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCG<-mat.df$Ala_GCG/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCU<-mat.df$Ala_GCU/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Gly_GGA<-mat.df$Gly_GGA/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGC<-mat.df$Gly_GGC/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGG<-mat.df$Gly_GGG/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGU<-mat.df$Gly_GGU/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Val_GUA<-mat.df$Val_GUA/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUC<-mat.df$Val_GUC/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUG<-mat.df$Val_GUG/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUU<-mat.df$Val_GUU/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$ter_UAA<-mat.df$ter_UAA/(mat.df$ter_UAA+mat.df$ter_UAG+mat.df$ter_UGA)
mat.df.new$Tyr_UAC<-mat.df$Tyr_UAC/(mat.df$Tyr_UAC+mat.df$Tyr_UAU)
mat.df.new$ter_UAG<-mat.df$ter_UAG/(mat.df$ter_UAA+mat.df$ter_UAG+mat.df$ter_UGA)
mat.df.new$Tyr_UAU<-mat.df$Tyr_UAU/(mat.df$Tyr_UAC+mat.df$Tyr_UAU)
mat.df.new$Ser_UCA<-mat.df$Ser_UCA/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCC<-mat.df$Ser_UCC/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCG<-mat.df$Ser_UCG/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCU<-mat.df$Ser_UCU/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$ter_UGA<-mat.df$ter_UGA/(mat.df$ter_UAA+mat.df$ter_UAG+mat.df$ter_UGA)
mat.df.new$Cys_UGC<-mat.df$Cys_UGC/(mat.df$Cys_UGC+mat.df$Cys_UGU)
mat.df.new$Trp_UGG<-mat.df$Trp_UGG/(mat.df$Trp_UGG)
mat.df.new$Cys_UGU<-mat.df$Cys_UGU/(mat.df$Cys_UGC+mat.df$Cys_UGU)
mat.df.new$Leu_UUA<-mat.df$Leu_UUA/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Phe_UUC<-mat.df$Phe_UUC/(mat.df$Phe_UUC+mat.df$Phe_UUU)
mat.df.new$Leu_UUG<-mat.df$Leu_UUG/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Phe_UUU<-mat.df$Phe_UUU/(mat.df$Phe_UUC+mat.df$Phe_UUU)
return (mat.df.new)
}

convert_RSCU_mat_into_codon_freq_df_transposed <- function (mat) {
mat.df<-as.data.frame(t(mat))
mat.df.new<-mat.df
mat.df.new$Lys_AAA<-mat.df$Lys_AAA/(mat.df$Lys_AAA+mat.df$Lys_AAG)
mat.df.new$Asn_AAC<-mat.df$Asn_AAC/(mat.df$Asn_AAC+mat.df$Asn_AAU)
mat.df.new$Lys_AAG<-mat.df$Lys_AAG/(mat.df$Lys_AAA+mat.df$Lys_AAG)
mat.df.new$Asn_AAU<-mat.df$Asn_AAU/(mat.df$Asn_AAC+mat.df$Asn_AAU)
mat.df.new$Thr_ACA<-mat.df$Thr_ACA/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACC<-mat.df$Thr_ACC/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACG<-mat.df$Thr_ACG/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACU<-mat.df$Thr_ACU/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Arg_AGA<-mat.df$Arg_AGA/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Ser_AGC<-mat.df$Ser_AGC/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Arg_AGG<-mat.df$Arg_AGG/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Ser_AGU<-mat.df$Ser_AGU/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ile_AUA<-mat.df$Ile_AUA/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Ile_AUC<-mat.df$Ile_AUC/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Met_AUG<-mat.df$Met_AUG/(mat.df$Met_AUG)
mat.df.new$Ile_AUU<-mat.df$Ile_AUU/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Gln_CAA<-mat.df$Gln_CAA/(mat.df$Gln_CAA+mat.df$Gln_CAG)
mat.df.new$His_CAC<-mat.df$His_CAC/(mat.df$His_CAC+mat.df$His_CAU)
mat.df.new$Gln_CAG<-mat.df$Gln_CAG/(mat.df$Gln_CAA+mat.df$Gln_CAG)
mat.df.new$His_CAU<-mat.df$His_CAU/(mat.df$His_CAC+mat.df$His_CAU)
mat.df.new$Pro_CCA<-mat.df$Pro_CCA/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCC<-mat.df$Pro_CCC/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCG<-mat.df$Pro_CCG/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCU<-mat.df$Pro_CCU/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Arg_CGA<-mat.df$Arg_CGA/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGC<-mat.df$Arg_CGC/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGG<-mat.df$Arg_CGG/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGU<-mat.df$Arg_CGU/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Leu_CUA<-mat.df$Leu_CUA/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUC<-mat.df$Leu_CUC/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUG<-mat.df$Leu_CUG/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUU<-mat.df$Leu_CUU/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Glu_GAA<-mat.df$Glu_GAA/(mat.df$Glu_GAA+mat.df$Glu_GAG)
mat.df.new$Asp_GAC<-mat.df$Asp_GAC/(mat.df$Asp_GAC+mat.df$Asp_GAU)
mat.df.new$Glu_GAG<-mat.df$Glu_GAG/(mat.df$Glu_GAA+mat.df$Glu_GAG)
mat.df.new$Asp_GAU<-mat.df$Asp_GAU/(mat.df$Asp_GAC+mat.df$Asp_GAU)
mat.df.new$Ala_GCA<-mat.df$Ala_GCA/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCC<-mat.df$Ala_GCC/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCG<-mat.df$Ala_GCG/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCU<-mat.df$Ala_GCU/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Gly_GGA<-mat.df$Gly_GGA/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGC<-mat.df$Gly_GGC/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGG<-mat.df$Gly_GGG/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGU<-mat.df$Gly_GGU/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Val_GUA<-mat.df$Val_GUA/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUC<-mat.df$Val_GUC/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUG<-mat.df$Val_GUG/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUU<-mat.df$Val_GUU/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$ter_UAA<-mat.df$ter_UAA/(mat.df$ter_UAA+mat.df$ter_UAG+mat.df$ter_UGA)
mat.df.new$Tyr_UAC<-mat.df$Tyr_UAC/(mat.df$Tyr_UAC+mat.df$Tyr_UAU)
mat.df.new$ter_UAG<-mat.df$ter_UAG/(mat.df$ter_UAA+mat.df$ter_UAG+mat.df$ter_UGA)
mat.df.new$Tyr_UAU<-mat.df$Tyr_UAU/(mat.df$Tyr_UAC+mat.df$Tyr_UAU)
mat.df.new$Ser_UCA<-mat.df$Ser_UCA/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCC<-mat.df$Ser_UCC/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCG<-mat.df$Ser_UCG/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCU<-mat.df$Ser_UCU/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$ter_UGA<-mat.df$ter_UGA/(mat.df$ter_UAA+mat.df$ter_UAG+mat.df$ter_UGA)
mat.df.new$Cys_UGC<-mat.df$Cys_UGC/(mat.df$Cys_UGC+mat.df$Cys_UGU)
mat.df.new$Trp_UGG<-mat.df$Trp_UGG/(mat.df$Trp_UGG)
mat.df.new$Cys_UGU<-mat.df$Cys_UGU/(mat.df$Cys_UGC+mat.df$Cys_UGU)
mat.df.new$Leu_UUA<-mat.df$Leu_UUA/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Phe_UUC<-mat.df$Phe_UUC/(mat.df$Phe_UUC+mat.df$Phe_UUU)
mat.df.new$Leu_UUG<-mat.df$Leu_UUG/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Phe_UUU<-mat.df$Phe_UUU/(mat.df$Phe_UUC+mat.df$Phe_UUU)
return (mat.df.new)
}


convert_RSCU_mat_into_codon_freq_df_ter_removed_data <- function (mat) {
mat.df<-as.data.frame(mat)
mat.df.new<-mat.df
mat.df.new$Lys_AAA<-mat.df$Lys_AAA/(mat.df$Lys_AAA+mat.df$Lys_AAG)
mat.df.new$Asn_AAC<-mat.df$Asn_AAC/(mat.df$Asn_AAC+mat.df$Asn_AAU)
mat.df.new$Lys_AAG<-mat.df$Lys_AAG/(mat.df$Lys_AAA+mat.df$Lys_AAG)
mat.df.new$Asn_AAU<-mat.df$Asn_AAU/(mat.df$Asn_AAC+mat.df$Asn_AAU)
mat.df.new$Thr_ACA<-mat.df$Thr_ACA/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACC<-mat.df$Thr_ACC/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACG<-mat.df$Thr_ACG/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Thr_ACU<-mat.df$Thr_ACU/(mat.df$Thr_ACA+mat.df$Thr_ACC+mat.df$Thr_ACG+mat.df$Thr_ACU)
mat.df.new$Arg_AGA<-mat.df$Arg_AGA/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Ser_AGC<-mat.df$Ser_AGC/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Arg_AGG<-mat.df$Arg_AGG/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Ser_AGU<-mat.df$Ser_AGU/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ile_AUA<-mat.df$Ile_AUA/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Ile_AUC<-mat.df$Ile_AUC/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Met_AUG<-mat.df$Met_AUG/(mat.df$Met_AUG)
mat.df.new$Ile_AUU<-mat.df$Ile_AUU/(mat.df$Ile_AUA+mat.df$Ile_AUC+mat.df$Ile_AUU)
mat.df.new$Gln_CAA<-mat.df$Gln_CAA/(mat.df$Gln_CAA+mat.df$Gln_CAG)
mat.df.new$His_CAC<-mat.df$His_CAC/(mat.df$His_CAC+mat.df$His_CAU)
mat.df.new$Gln_CAG<-mat.df$Gln_CAG/(mat.df$Gln_CAA+mat.df$Gln_CAG)
mat.df.new$His_CAU<-mat.df$His_CAU/(mat.df$His_CAC+mat.df$His_CAU)
mat.df.new$Pro_CCA<-mat.df$Pro_CCA/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCC<-mat.df$Pro_CCC/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCG<-mat.df$Pro_CCG/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Pro_CCU<-mat.df$Pro_CCU/(mat.df$Pro_CCA+mat.df$Pro_CCC+mat.df$Pro_CCG+mat.df$Pro_CCU)
mat.df.new$Arg_CGA<-mat.df$Arg_CGA/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGC<-mat.df$Arg_CGC/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGG<-mat.df$Arg_CGG/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Arg_CGU<-mat.df$Arg_CGU/(mat.df$Arg_AGA+mat.df$Arg_AGG+mat.df$Arg_CGA+mat.df$Arg_CGC+mat.df$Arg_CGG+mat.df$Arg_CGU)
mat.df.new$Leu_CUA<-mat.df$Leu_CUA/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUC<-mat.df$Leu_CUC/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUG<-mat.df$Leu_CUG/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Leu_CUU<-mat.df$Leu_CUU/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Glu_GAA<-mat.df$Glu_GAA/(mat.df$Glu_GAA+mat.df$Glu_GAG)
mat.df.new$Asp_GAC<-mat.df$Asp_GAC/(mat.df$Asp_GAC+mat.df$Asp_GAU)
mat.df.new$Glu_GAG<-mat.df$Glu_GAG/(mat.df$Glu_GAA+mat.df$Glu_GAG)
mat.df.new$Asp_GAU<-mat.df$Asp_GAU/(mat.df$Asp_GAC+mat.df$Asp_GAU)
mat.df.new$Ala_GCA<-mat.df$Ala_GCA/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCC<-mat.df$Ala_GCC/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCG<-mat.df$Ala_GCG/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Ala_GCU<-mat.df$Ala_GCU/(mat.df$Ala_GCA+mat.df$Ala_GCC+mat.df$Ala_GCG+mat.df$Ala_GCU)
mat.df.new$Gly_GGA<-mat.df$Gly_GGA/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGC<-mat.df$Gly_GGC/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGG<-mat.df$Gly_GGG/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Gly_GGU<-mat.df$Gly_GGU/(mat.df$Gly_GGA+mat.df$Gly_GGC+mat.df$Gly_GGG+mat.df$Gly_GGU)
mat.df.new$Val_GUA<-mat.df$Val_GUA/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUC<-mat.df$Val_GUC/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUG<-mat.df$Val_GUG/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Val_GUU<-mat.df$Val_GUU/(mat.df$Val_GUA+mat.df$Val_GUC+mat.df$Val_GUG+mat.df$Val_GUU)
mat.df.new$Tyr_UAC<-mat.df$Tyr_UAC/(mat.df$Tyr_UAC+mat.df$Tyr_UAU)
mat.df.new$Tyr_UAU<-mat.df$Tyr_UAU/(mat.df$Tyr_UAC+mat.df$Tyr_UAU)
mat.df.new$Ser_UCA<-mat.df$Ser_UCA/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCC<-mat.df$Ser_UCC/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCG<-mat.df$Ser_UCG/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Ser_UCU<-mat.df$Ser_UCU/(mat.df$Ser_AGC+mat.df$Ser_AGU+mat.df$Ser_UCA+mat.df$Ser_UCC+mat.df$Ser_UCG+mat.df$Ser_UCU)
mat.df.new$Cys_UGC<-mat.df$Cys_UGC/(mat.df$Cys_UGC+mat.df$Cys_UGU)
mat.df.new$Trp_UGG<-mat.df$Trp_UGG/(mat.df$Trp_UGG)
mat.df.new$Cys_UGU<-mat.df$Cys_UGU/(mat.df$Cys_UGC+mat.df$Cys_UGU)
mat.df.new$Leu_UUA<-mat.df$Leu_UUA/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Phe_UUC<-mat.df$Phe_UUC/(mat.df$Phe_UUC+mat.df$Phe_UUU)
mat.df.new$Leu_UUG<-mat.df$Leu_UUG/(mat.df$Leu_CUA+mat.df$Leu_CUC+mat.df$Leu_CUG+mat.df$Leu_CUU+mat.df$Leu_UUA+mat.df$Leu_UUG)
mat.df.new$Phe_UUU<-mat.df$Phe_UUU/(mat.df$Phe_UUC+mat.df$Phe_UUU)
return (mat.df.new)
}