ComputeCAI: Codon Adaptation Index

Description Usage Arguments Details Value Original code in Darwin Author(s) See Also Examples

Description

ComputeCAI Computes Codon Adaptation Index

Usage

1
ComputeCAI(cds, RA, UseCodonProb = FALSE)

Arguments

cds

Coding sequence in reading frame

RA

Relative Adaptiveness table to use

UseCodonProb

Wheter to use Codon Probabilities (default = FALSE)

Details

Should compute the same ComputeCAI or ComputeCAIVector as in Darwin and the cai of seqinr package.

Value

Numerical with CAI

Original code in Darwin

Compute CAI, the Codon Adaptation Index (Sharp and Li 1987)

 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: 

Author(s)

Roth, A.; Friberg, M.; Siegrist, F. and Cannarozzi, G. M. gina@cannarozzi.com

See Also

seqinr cai statanacoseq checkCDS

Examples

1
2
ComputeCAI('ATGTGGTACTCCGACTACGGAGGATAA', RA=SetupRA("yeast"), UseCodonProb=TRUE)
ComputeCAI(mylist(whatout=1)[[1]], RA=ComputeCarboneRA(DB=mylist(whatout=1)))

fredysiegrist/statanacoseq documentation built on May 16, 2019, 2:44 p.m.