Description Usage Arguments Details Value Original code in Darwin Author(s) See Also Examples
ComputeCAI
Computes Codon Adaptation Index
1 | ComputeCAI(cds, RA, UseCodonProb = FALSE)
|
cds |
Coding sequence in reading frame |
RA |
Relative Adaptiveness table to use |
UseCodonProb |
Wheter to use Codon Probabilities (default = FALSE) |
Should compute the same ComputeCAI or ComputeCAIVector as in Darwin and the cai of seqinr package.
Numerical with CAI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Markus Friberg and Alexander Roth (Dec 2005)
ComputeCAI := proc(DNA:{string, Entry})
# check global variables and scan arguments
if not assigned(RA) then
error('Error in ComputeCAI: RA not assigned, use e.g. SetupRA(yeast);') fi;
if type(DNA, Entry) then dna:=copy(SearchTag('DNA', DNA))
else dna:=DNA fi;
UseCodonProb := false;
for i from 2 to nargs do
if length(args[i]) = 2 and args[i, 1] = 'UseCodonProb' then
UseCodonProb := args[i, 2]
else
error('Unknown argument ', args[i]);
fi;
od;
# compute cai
w := 0;
n := length(dna)/3;
for j to length(dna) by 3 do
cint := CodonToCInt(dna[j..j+2]);
codprob := If(UseCodonProb, CodonProb[cint], 1);
if CIntToA(cint) <> '$' then # don't consider stop codons
w := w + ln(codprob * RA[cint]) fi;
od;
exp(1/n * w)
end:
|
Roth, A.; Friberg, M.; Siegrist, F. and Cannarozzi, G. M. gina@cannarozzi.com
seqinr
cai
statanacoseq
checkCDS
1 2 | ComputeCAI('ATGTGGTACTCCGACTACGGAGGATAA', RA=SetupRA("yeast"), UseCodonProb=TRUE)
ComputeCAI(mylist(whatout=1)[[1]], RA=ComputeCarboneRA(DB=mylist(whatout=1)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.