A while ago, I made a program to translate from DNA/RNA to amino acids. It can translate from:
- the original DNA strand that that the mRNA is complimentary to, (select ANTI in the menu)
- the other strand of the original DNA, (select CODON)
- the mRNA codons, (CODON)
- and the tRNA anti-codons, (ANTI)
Use the first row of keys (Y=, WINDOW, ZOOM, and TRACE to enter the bases, and GRAPH to return to the menu.) You have to press ON to quit
The on-screen labels might not line up on your calculator, because I'm using the nSpire with 84 keypad
It's really nice to use in biology class, especially if your teacher gives you a lot of work that requires you to translate to amino acids.
:Lbl M :“T/U C A G “->Str1 ‘Set default label :ClrHome :Disp “- ‘add line so first codon will be aligned :Menu(“N”,”ANTI”,A,”CODON”,C,"EXIT",B :Lbl A :” A G T/U C “->Str1 ‘Set anticodon/DNA label :Lbl C :While 1 :For(A,1,3 ‘3 bases per codon :0->B ‘reset B :Repeat B and B<15 ‘wait until user presses one of the buttons :getKey->B :If B :10fPart(B/10->L1(A) ‘get second digit of key code :If B=15 :Goto M ‘retrun to menu :Output(8,1,Str1 ‘show label :End :Output(8,1,” “ ‘17 spaces, to cover up lable so it doesn’t scroll :Disp sub(Str1,3L1(A)-2,3 ‘display part of label corresponding to chosen base :L1(1)->Y:L1(2)->Z:L1(3)->θ ‘convert list to variables, to save space in If statements :End :Disp “ ‘1 space, to skip a line :If Y=1 :Then :If Z=1 :Then :If θ<3 :Disp “PHEnylalanine '111 / 112 :If θ>2 :Disp “LEUcine '113 / 114 :End :If Z=2 :Disp “SERine '12_ :If Z=3 :Then :If θ<3 :Disp “TYRosine '131 / 132 :If θ>2 :Disp “STOP '133 / 134 :End :If Z=4 :Then :If θ>3 :Disp “CYStine '141 / 142 :If θ=3 :Disp “STOP '143 :If θ=4 :Disp “TRyPtophan '144 :End :End :If Y=2 :Then :If Z=1 :Disp “LEUcine '21_ :If Z=2 :Disp “PROline '22_ :IF Z=3 :Then :If θ<3 :Disp “HIStidine '231 / 232 :If θ>2 :Disp “GLutamiNe '233 / 234 :End :If Z=4 :Disp “ARGinine '24_ ::End :If Y=3 :Then :If Z=1 :Then :If θ<4 :Disp “Iso LEucine '311 / 312 / 313 :If θ=4 :Disp “METhionine '314 :End :If Z=2 :Disp THReonine '32_ :If Z=3 :Then :If θ<3 :Disp “ASparagiNe '331 / 332 :If θ>2 :Disp “LYSine '333 / 334 :End :If Z=4 :Then :If θ<3 :Disp “SERine '341/342 :If θ>2 :Disp “ARGinine '343/344 :End :End :If Y=4 :Then :If Z=1 :Disp “VALine '41_ :If Z=2 :Disp “ALAnine '42_ :If Z=3 :Then :If θ<3 :Disp “ASPartic acid '431/432 :If θ>2 :Disp “GLUtamic acid '433/434 :End :If Z=4 :Disp “GLYcine '44_ :End :Disp “-” ‘show - to separate codon/amino acid groups :End :Lbl B
(I use ' to show notes because it is used in most forms of BASIC, and also / is the divide sign, so it might be confusing?()
anyway, I was wondering if it is possible to optimize. Currently it just uses a MASSIVE block of If statements, which is organised and easy to program, but takes up a lot of space
And, yes, I know that lowercase letters are 2 bytes, but I designed this program to be easy to use, and I wanted you to be able to see the full amino acid name AND the 3 letter abbrieveation, so I put the letters used in it in UPPERCASE, and the rest of the name in small letters.
If you want, you can just type the uppercase parts, since most of the time you only need to know the abbreviation and it's not hard to memorize the full names.