ComputeCAIVector: Codon Adaptation Index Vector

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

Description

ComputeCAIVector Computes Codon Adaptation Index

Usage

1

Arguments

cds

Coding sequence in reading frame

Details

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

Value

Vector of all 65 codon values

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
ComputeCAIVector := proc(e:Entry)
 if not assigned(RA) then
   error('Error in ComputeCAI: RA not assigned, use e.g. SetupRA(yeast);') fi;
 dna := SearchTag('DNA', e);
 wa := CreateArray(1..20);
 na := CreateArray(1..20);
 for j to length(dna) by 3 do
   cint := CodonToCInt(dna[j..j+2]);
   a := CIntToInt(cint);
   if a <= 20 then
     wa[a] := wa[a] + ln(RA[cint]);
     na[a] := na[a]+1;
   fi;
 od;
 res := CreateArray(1..21);
 for i to 20 do
   res[i] := If(na[i]=0, 'NA', exp(1/na[i] * wa[i])) od;
 res[21] := exp(1/sum(na) * sum(wa));
 res
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
ComputeCAIVector('ATGTGGTACTCCGACTACGGAGGATAA', RA=SetupRA("yeast"))
ComputeCAIVector(c2s(mylist(whatout=1)[[1]]), RA=ComputeCarboneRA(DB=mylist(whatout=1)))

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