everyboy. I am a beginner with R. I´d like to ask how could you assign a codon to a number I mean this: AAA is 1 AAC is 2 AAG is 3 AAT or AAU is 4 . . . And subsequently. Thanks to everybody
Asked
Active
Viewed 39 times
0
-
[See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on making an R question that folks can help with. That includes a sample of data, all necessary code, and a clear explanation of what you're trying to do and what hasn't worked. – camille Jan 22 '20 at 16:43
2 Answers
1
Something like this?
BASES = c("A","C","G","T")
triN = apply(expand.grid(BASES,BASES,BASES),1,paste,collapse="")
data.frame(number=1:length(triN),codon=sort(triN))
number codon
1 1 AAA
2 2 AAC
3 3 AAG
4 4 AAT
5 5 ACA
6 6 ACC
7 7 ACG
8 8 ACT
9 9 AGA
10 10 AGC
11 11 AGG
12 12 AGT

StupidWolf
- 45,075
- 17
- 40
- 72
-
Yes, something like that and the with all the condons. It will be better in alphabetic orden. – Lorenzo Gutiérrez Avilés Jan 22 '20 at 17:06
-
-
1
bases <- c("A","C","G","T")
x <- levels(interaction(bases,bases,bases, sep = ""))
x <- x[order(x)]
data.frame(number=1:length(x), codon=x)

Justin Landis
- 1,981
- 7
- 9