We can make a simple tool to translate the mRNA (5′-3′) string to a peptide chain by using PHP. Following class is meant to translate a given mRNA string (from 5′ to 3′) to a peptide-chain (Chain of amino acids).

<?php
class BioTranscription
{
  function BioTranscription()
  {
      $this->amino_acids = array('Asp' => array('name' => 'Aspartic acid',
                                                'shortname' => 'Asp',
                                               ),
                                 'Glu' => array('name' => 'Glutamic acid',
                                                'shortname' => 'Glu',
                                               ),
                                 'Gly' => array('name' => 'Glycine',
                                                'shortname' => 'Gly',
                                               ),
                                 'Phe' => array('name' => 'Phenylalanine',
                                                'shortname' => 'Phe',
                                               ),
                                 'Leu' => array('name' => 'Leucine',
                                                'shortname' => 'Leu',
                                               ),
                                 'Ser' => array('name' => 'Serine',
                                                'shortname' => 'Ser',
                                               ),
                                 'Tyr' => array('name' => 'Tyrosine',
                                                'shortname' => 'Tyr',
                                               ),
                                 'Cys' => array('name' => 'Cysteine',
                                                'shortname' => 'Cys',
                                               ),
                                 'Trp' => array('name' => 'Tryptophan',
                                                'shortname' => 'Trp',
                                               ),
                                 'Pro' => array('name' => 'Proline',
                                                'shortname' => 'Pro',
                                               ),
                                 'His' => array('name' => 'Histidine',
                                                'shortname' => 'His',
                                               ),
                                 'Gln' => array('name' => 'Glutamine',
                                                'shortname' => 'Gln',
                                               ),
                                 'Arg' => array('name' => 'Arginine',
                                                'shortname' => 'Arg',
                                               ),
                                 'Ils' => array('name' => 'Isoleucine',
                                                'shortname' => 'Ils',
                                               ),
                                 'Met' => array('name' => 'Methionine',
                                                'shortname' => 'Met',
                                               ),
                                 'Thr' => array('name' => 'Threonine',
                                                'shortname' => 'Thr',
                                               ),
                                 'Asn' => array('name' => 'Asparagine',
                                                'shortname' => 'Asn',
                                               ),
                                 'Lys' => array('name' => 'Lysine',
                                                'shortname' => 'Lys',
                                               ),
                                 'Val' => array('name' => 'Valine',
                                                'shortname' => 'Val',
                                               ),
                                 'Ala' => array('name' => 'Alanine',
                                                'shortname' => 'Ala',
                                               ),
                                );
    
      $this->codons = array('G' => array('G' => array('G' => &$this->amino_acids['Gly'],
                                                      'A' => &$this->amino_acids['Gly'],
                                                      'U' => &$this->amino_acids['Gly'],
                                                      'C' => &$this->amino_acids['Gly'],
                                                     ),
                                         'A' => array('G' => &$this->amino_acids['Glu'],
                                                      'A' => &$this->amino_acids['Glu'],
                                                      'U' => &$this->amino_acids['Asp'],
                                                      'C' => &$this->amino_acids['Asp'],
                                                     ),
                                         'C' => array('G' => &$this->amino_acids['Ala'],
                                                      'A' => &$this->amino_acids['Ala'],
                                                      'U' => &$this->amino_acids['Ala'],
                                                      'C' => &$this->amino_acids['Ala'],
                                                     ),
                                         'U' => array('G' => &$this->amino_acids['Val'],
                                                      'A' => &$this->amino_acids['Val'],
                                                      'U' => &$this->amino_acids['Val'],
                                                      'C' => &$this->amino_acids['Val'],
                                                     ),
                                        ),
                            'A' => array('G' => array('G' => &$this->amino_acids['Arg'],
                                                      'A' => &$this->amino_acids['Arg'],
                                                      'U' => &$this->amino_acids['Ser'],
                                                      'C' => &$this->amino_acids['Ser'],
                                                     ),
                                         'A' => array('G' => &$this->amino_acids['Lys'],
                                                      'A' => &$this->amino_acids['Lys'],
                                                      'U' => &$this->amino_acids['Asn'],
                                                      'C' => &$this->amino_acids['Asn'],
                                                     ),
                                         'C' => array('G' => &$this->amino_acids['Thr'],
                                                      'A' => &$this->amino_acids['Thr'],
                                                      'U' => &$this->amino_acids['Thr'],
                                                      'C' => &$this->amino_acids['Thr'],
                                                     ),
                                         'U' => array('G' => &$this->amino_acids['Met'],
                                                      'A' => &$this->amino_acids['Ile'],
                                                      'U' => &$this->amino_acids['Ile'],
                                                      'C' => &$this->amino_acids['Ile'],
                                                     ),
                                        ),
                            'C' => array('G' => array('G' => &$this->amino_acids['Arg'],
                                                      'A' => &$this->amino_acids['Arg'],
                                                      'U' => &$this->amino_acids['Arg'],
                                                      'C' => &$this->amino_acids['Arg'],
                                                     ),
                                         'A' => array('G' => &$this->amino_acids['Gln'],
                                                      'A' => &$this->amino_acids['Gln'],
                                                      'U' => &$this->amino_acids['His'],
                                                      'C' => &$this->amino_acids['His'],
                                                     ),
                                         'C' => array('G' => &$this->amino_acids['Pro'],
                                                      'A' => &$this->amino_acids['Pro'],
                                                      'U' => &$this->amino_acids['Pro'],
                                                      'C' => &$this->amino_acids['Pro'],
                                                     ),
                                         'U' => array('G' => &$this->amino_acids['Leu'],
                                                      'A' => &$this->amino_acids['Leu'],
                                                      'U' => &$this->amino_acids['Leu'],
                                                      'C' => &$this->amino_acids['Leu'],
                                                     ),
                                        ),
                            'U' => array('G' => array('G' => &$this->amino_acids['Trp'],
                                                      'A' => 'stop',
                                                      'U' => &$this->amino_acids['Cys'],
                                                      'C' => &$this->amino_acids['Cys'],
                                                     ),
                                         'A' => array('G' => 'stop',
                                                      'A' => 'stop',
                                                      'U' => &$this->amino_acids['Tyr'],
                                                      'C' => &$this->amino_acids['Tyr'],
                                                     ),
                                         'C' => array('G' => &$this->amino_acids['Ser'],
                                                      'A' => &$this->amino_acids['Ser'],
                                                      'U' => &$this->amino_acids['Ser'],
                                                      'C' => &$this->amino_acids['Ser'],
                                                     ),
                                         'U' => array('G' => &$this->amino_acids['Leu'],
                                                      'A' => &$this->amino_acids['Leu'],
                                                      'U' => &$this->amino_acids['Phe'],
                                                      'C' => &$this->amino_acids['Phe'],
                                                     ),
                                        ),
                            'start' => 'AUG',
                           );
  }
  
  function mrna_to_pepchain($mrna)
  {
    $mrna = strstr($mrna, $this->codons['start']);
    for($i=3;$i<strlen($mrna);$i=$i+3)
    {
      $j=$i; $j++;
      $k=$i; $k=$k+2;
      if( $this->codons[$mrna{$i}][$mrna{$j}][$mrna{$k}] == 'stop')
      {
        break;
      }
      $pep .= $this->triplet_to_pep($mrna{$i}.$mrna{$j}.$mrna{$k}).'-';
    }
    $pep = substr($pep, 0, -1);
    return $pep;
  }
  
  function triplet_to_pep($trip)
  {
    return $peptide = $this->codons[$trip{0}][$trip{1}][$trip{2}]['shortname'];
  }
  
}


$trans = &new BioTranscription();
$pepchain = $trans->mrna_to_pepchain('AUGAAACCCUGA'); //mRNA, from 5' to 3'
print $pepchain; //Should print out "Lys-Pro" 

?>

 

Comments


We can make a simple tool to translate the mRNA (5′-3′) string to a peptide chain by using PHP....

Read Post

We can make a simple tool to translate the mRNA (5′-3′) string to a peptide chain by using PHP....

Read Post

Leave a Reply

Your email address will not be published. Required fields are marked *