Open main menu

Biolecture.org β

DNA and Protein Length

$DNA = "TAATTTATATATCTATTTTTTTTATTAAAAAATTTATATTTTTGTTAAAATTTTATTTGATTAGAAATAT

TTTTACTATTGTTCATTAATCGTTAATTAAAGATAGCACAGCACATGTAAGAATTCTAGGTCATGCGAAA

TTAAAAATTAAAAATATTCATATTTCTATAATAATTAAATTATTGTTTTAATTTAAGTAAAAAAATTTCT

AAGAAATCAAAAATTTGTTGTAATATTGAAACAAAATTTTGTTGTCTGCTTTTTATAGTAACTAATAAAT

ATTTAATAAAAAATTACTTTATTTAATATTTTATAATAAATCAAATTGTCCAATTTGAAATTTATTTTAT

CACTAAAAATATCTTTATTATAGTCAATATTTTTTGTTAGGTTTAAATAATTGTTAAAATTAGAAAATGA

TCGATATTTTCAAATAGTACGTTTAACTAATACTTAAGTGAAAGGTAAAGCGGTTATTTAAAATATTGAT

TTATAATATTCGTGACATAATATATTTATAAATAGATTATATATATATATATACATCAAAATATTATACG

AGAACTAGAAAATATTACAGATGCAAAATAAATTAAATTTTGTAAATGTTACAGAATTAAAAATCGAAGT";

$len = length($DNA);

print "$len";
$mRNA = ();
$revDNA = reverse $DNA;

  1. print "$revDNA";


for($i=0;$i<$len;$i++)
{
 if(substr($revDNA,$i,1) eq "A")
 {
  $mRNA .= "U";

 }elsif(substr($revDNA,$i,1) eq "C")
 {
  $mRNA .= "G";

 }elsif(substr($revDNA,$i,1) eq "G")
 {
  $mRNA .= "C";

 }elsif(substr($revDNA,$i,1) eq "T")
 {
  $mRNA .= "A";

 }
}
print "$mRNA\n";
$mlen = length($mRNA);
$start = index($mRNA,'AUG');


$NmRNA1 = substr($mRNA,0,($start),"");
print "$NmRNA1\n";
print "$mRNA\n";

#for($j=0;$j<$start;$j++)

  1. {
  2. if(substr($mRNA,$j,3) eq "UAA")
  3. {

$p1stop1 = index($mRNA,'UAA');

  1. }

$p1stop2 = index($mRNA,'UAG');
$p1stop3 = index($mRNA,'UGA');

  1. }

$pro1len1 = ($p1stop1-1)/3;
$pro1len2 = ($p1stop2-1)/3;
$pro1len3 = ($p1stop3-1)/3;
print "$pro1len1\n";
print "$pro1len2\n";
print "$pro1len3\n";