Advertisement
hiddenGem

DNA strand to Amino Acids

Jun 29th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.48 KB | None | 0 0
  1. %% DNA to Amino Acids
  2. % converts a DNA strand to amino acids
  3.  
  4. A = {'A' 'T'
  5.      'C' 'G'
  6.      'G' 'C'
  7.      'T' 'A'};
  8.  seq_file = fopen('KIF11.txt');
  9.  template3_5 = fscanf(seq_file,'%s');
  10.  seq_len = length(template3_5);
  11.  synth3_5 = [];
  12.  for i = 1:seq_len
  13.     template_base = template3_5(i);
  14.     row_A = strcmp(template_base,A(:,2));
  15.     synth_base = A(row_A);
  16.     synth_base = char(synth_base);
  17.     synth3_5(i) = (synth_base);
  18.  end
  19.  synth3_5 = char(synth3_5);
  20.  B = {'A' 'U'
  21.      'C' 'G'
  22.      'G' 'C'
  23.      'T' 'A'};
  24.  RNA5_3 = [];
  25.  for i = 1:seq_len
  26.     DNA_base = synth3_5(i);    
  27.     row_B = strcmp(DNA_base,B(:,1));
  28.     RNA_base = B(row_B,2);
  29.     RNA_base = char(RNA_base);
  30.     RNA5_3(i) = (RNA_base);      
  31. end
  32.  RNA5_3 = char(RNA5_3);
  33.  C = {'UUU' 'F'
  34.      'UUC' 'F'
  35.      'UUA' 'L'
  36.      'UUG' 'L'
  37.      'CUU' 'L'
  38.      'CUC' 'L'
  39.      'CUA' 'L'
  40.      'CUG' 'L'
  41.      'AUU' 'I'
  42.      'AUC' 'I'
  43.      'AUA' 'I'
  44.      'AUG' 'M'
  45.      'GUU' 'V'
  46.      'GUC' 'V'
  47.      'GUA' 'V'
  48.      'GUG' 'V'
  49.      'UCU' 'S'
  50.      'UCC' 'S'
  51.      'UCA' 'S'
  52.      'UCG' 'S'
  53.      'CCU' 'P'
  54.      'CCC' 'P'
  55.      'CCA' 'P'
  56.      'CCG' 'P'
  57.      'ACU' 'T'
  58.      'ACC' 'T'
  59.      'ACA' 'T'
  60.      'ACG' 'T'
  61.      'GCU' 'A'
  62.      'GCC' 'A'
  63.      'GCA' 'A'
  64.      'GCG' 'A'
  65.      'UAU' 'Y'
  66.      'UAC' 'Y'
  67.      'UAA' '*'
  68.      'UAG' '*'
  69.      'CAU' 'H'
  70.      'CAC' 'H'
  71.      'CAA' 'Q'
  72.      'CAG' 'Q'
  73.      'AAU' 'N'
  74.      'AAC' 'N'
  75.      'AAA' 'K'
  76.      'AAG' 'K'
  77.      'GAU' 'D'
  78.      'GAC' 'D'
  79.      'GAA' 'E'
  80.      'GAG' 'E'
  81.      'UGU' 'C'
  82.      'UGC' 'C'
  83.      'UGA' '*'
  84.      'UGG' 'W'
  85.      'CGU' 'R'
  86.      'CGC' 'R'
  87.      'CGA' 'R'
  88.      'CGG' 'R'
  89.      'AGU' 'S'
  90.      'AGC' 'S'
  91.      'AGA' 'R'
  92.      'AGG' 'R'
  93.      'GGU' 'G'
  94.      'GGA' 'G'
  95.      'GGC' 'G'
  96.      'GGG' 'G'};
  97. ORF = RNA5_3(155:3358);
  98. AA_seq = NaN;
  99. AA_pos = 1;
  100. ORF_pos = 1:3;
  101. while ~strcmp(char(AA_seq(end)),'*')
  102.     codon = ORF(ORF_pos);
  103.     row_C = strcmp(codon,C(:,1));
  104.     AA = C(row_C,2);
  105.     AA = char(AA);
  106.     AA_seq(AA_pos) = AA;
  107.     AA_pos = AA_pos + 1;
  108.     ORF_pos = ORF_pos + 3;
  109. end
  110.  
  111. %{
  112. I guess this code can be used for others. I really just put this here for me
  113.     so I wouldn't lose it when I have to get a new computer :(
  114. To edit the text file being scanned edit line 8
  115. The code will transcribe the whole DNA strand but will only translate the
  116.     DNA strand at the start codon. The range of bases are in line 97.
  117.     There is probably some code that will determine the start sequence
  118.     but I am not putting that in here.
  119. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement