Skip to main content

Perl Programming #5

Hi,
Didn't read the previous perl posts? Go here, perl #1 #2 #3  #4)

In the previous post of perl programming, we learnt how to search an aminoacid in a protein sequence. Now, we are going to look at a program by which the "start and stop codons" in a protein sequence could be easily identified. Here, we go,

Program to identify start and stop codons easily: 

print "enter a file containing Dna sequence\n";
$dnafile=<>;
chomp($dnafile);
unless(open(DNAFILENAME,$dnafile))
{
print "file not found\n";
exit;
}
$dna=<DNAFILENAME>;
$dna=join("",$dna);
$dna=~s/\s//g;
$dna=uc($dna);
$dna=~tr/T/U/;
print "The mrna is:\t",$dna,"\n";
my(%code)=
(
'AUG'=>'Start',
'UGA'=>'Stop',
'UAA'=>'Stop',
'UAG'=>'Stop',
);
for($i=0;$i<(length($dna)-2);$i+=3)
{
$codon=substr($dna,$i,3);
if($codon=~AUG)
{
$out.=$code{$codon};
}
elsif($codon=~UAG)
{
$out.=$code{$codon};
}
elsif($codon=~UAA)
{
$out.=$code{$codon};
}
else
{
$out.=$codon;
}
}
$out=~tr/U/T/;
print "the dna seq is\t",$out;
exit; 


When you run the above program, you would get the result just like this:

PERL
Happy perl-ing, Any doubts, just comment, I'll try to clear.
Bye. :)

Comments

Popular posts from this blog

Sea Butterfly!

Neih hou!  Don't roll you eyes wondering what it is! "Neih hou" is how you say "hello" in Cantonese. Guess what, I am in Hong Kong and therefore the language Cantonese. I came to Hong Kong this summer as an intern before officially joining as a PhD Student. This is my second experience abroad, far away from home, new language, new culture, I expected me to have a "really" bad cultural shock, but, actually I experienced only 50% of what I expected. For a girl who have used the marina beach only for eating "sundal", bikini in beach was a shock (FEEL FREE TO JUDGE ME!). The first time, I went to the big wave beach here, I was the only one who was totally covered, when everyone was enjoying their Beer, I was slowly sipping my lemon juice (THE ODD ONE OUT!). I realized how beautifully different the world outside is! There is no single standard for right or wrong, it varies in different countries, in different regions around the world. And it ...

The Butterfly flew for the first time!

Hi dear sweet lovely reader, Didn't meet you for a long time... Just after complaining about the stipend problem in the last post, I actually wanted to write a lot here, but, couldn't find time (Such a lazy girl, I am!). As you might be knowing, the author (me) is the butterfly here :P And, I flew for the first time!! YEAH! I FLEW! I flew like a butterfly! It was an awesome experience flying for the very first time! (ow, no! I dint put a trans-gene in my body and fly after getting  a pair of wings, but with a passport and VISA). I'm this girl, full of dreams wishing to do "this", "that" and "all kind of stuffs that one can do". And, one among those dreams was to fly one day! TO FLY FREE!(I mean, not free of cost :P, but liberation) I always wanted to fly in those big, big airplanes, but, I always have avoided that mode of transport. Reason? Obviously, it would burn a big hole in my dad's pocket (actually he can afford if I wan...

Plant Tissue culture - Basics

Hi, I know a bit about Plant tissue culture and I would like to share it here. Plant Tissue culture Rack Plant Tissue culture, to be simple, it is growing plants in laboratory (invitro). To be more simple, you grow plants in test tubes and bottles by providing them light, nutrient by mimicking the natural conditions. It is effectively used as tool for producing GM(Genetically Modified) plants. Don't confuse "plant tissue culture" with "HORTICULTURE" The basic of Plant Tissue Culture : Totipotency:  The ability of a single plant cell to grow into an entire plant is generally referred as totipotency. Plasticity:  The ability of plants to survive in extreme conditions by modifying their metabolism is generally referred as plasticity. Things you need to do plant tissue culture 1) Laminar air hood 2) Plant growth chamber 3)Chemicals for preparing medium 4)Autoclave 5)pH meter 6) Test tubes or Bottles with caps 7) Cotton plugs 8) Scalpels, Fo...