codfreq
is a vector of codon frequencies then
drop(freq %*% EXP$CG3)
will return for instance the G+C content
in third codon positions. Base order is the lexical order: a,
c, g, t (or u).
data(EXP)
EXP$KD
to compute the Kyte
and Doolittle hydrophaty index from codon frequencies is valid only
for the standard genetic code.An alternative for drop(freq %*% EXP$CG3)
is
sum( freq * EXP$CG3 )
, but this is less efficient in terms of CPU
time. The advantage of the latter, however, is that thanks to
recycling rules you can use either sum( freq * EXP$A )
or sum( freq * EXP$A3 )
. To do the same with the %*%
operator you have to explicit the recycling rule as in
drop( freq %*% rep(EXP$A, 16))
.
citation("seqinr")