Skip to main content

Posts

Showing posts with the label Perl Programming

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{$cod...

Perl programming #4

Hi, We started learning perl programs in our last post. For viewing previous posts, use the links ( perl #1 #2  #3 ) Today I'm gonna give you a program for searching a specific amino acid in a protein sequence.You can easily understand the logic by yourself. Here we go, Program for searching an amino acid in a protein sequence: print "enter a protein file\n"; $proteinfile=<>; chomp($proteinfile); unless(open(PROTEINFILE,$proteinfile)) { print "file not found\n"; exit; } $protein=<PROTEINFILE>; $protein=join("",$protein); $protein=~s/\s//g; $protein=uc($protein); print "The sequence is",$protein,"\n"; $a=A; $position=0; for($i=0;$i<length($protein);$i=$position+1) { $position=index($protein,$a,$i); if($position=~-1) { last; } print $position+1,"\t"; } print "- the position(s) in which alanine is found\n"; exit; The output for the above program will be like this. Try executing!  H...

Perl programming #3

Hi, You read the first two posts about perl? Missed? Don't worry, go and read here ( perl #1 #2 ) From today, we can learn few programs that would help biology students! Ya, as a biotechnology student I use perl programs for dealing with DNA , RNA and Proteins. So, I know just something about perl (very limited) for processing sequences! Okay, let's learn some basic programs. Program to convert DNA sequence to protein sequence: print "enter a dna sequence file\n"; $dnafile=<>; chomp($dnafile); unless(open(DNAFILENAME,$dnafile)) { print "file not found\n"; } $dnafile=<DNAFILENAME>; $dna=join("",$dnafile); $dna=~s/\s//g; $dna=uc($dna); print "DNA seq. is\n",$dna; $dna=~tr/T/U/; print "mRNA seq. is\n", $dna,"\n"; my(%genetic_code)= ( 'UUU'=>'F', 'UUC'=>'F', 'UUG'=>'L', 'UUA'=>'L', ...

Perl programming #2

Hi, Yesterday we learnt about installing perl in windows (Didn't read yesterday's post? check here Perl programming #1  ) and how to “print” using perl! Today, let’s start with the basics, how to get input using perl? To get a text file from user using perl: Just it is very simple, type as follows, $variable=<STDIN>; This will get the file name. This also works in perl, $variable=<>; No need to give STDIN! Just the open and closed angular brackets are itself considered as standard input. Then, always give chomp after the standard input, this chomp is nothing but “chop” which chops the “enter” à new line character i.e., whenever you give an input, you press “enter” which will be considered as a new line character. In order to remove that new line character, chomp must be given. How to use chomp? Use as follows, $variable=<>; chomp($variable); Simple, this chops the new line character from your input. Let us l...

Perl programming #1

Perl is a programming language. This is a powerful language which has features similar "C". This is generally used for text processing. "Perl" is not an acronym officially, but, it has got backronyms(may be invented with a false etymology)  in use such as "Practical Extraction and Reporting Language". In Biotechnology, this Perl is used generally for processing text data of DNA sequences and converting them to mRNA or searching for a specific pattern in a protein sequence etc., I'm gonna write a series "Perl programming #1, #2, #3 etc.. with simple programs and explanations. Wanna learn perl with me? Let's begin from today. I'm sure, atleast you will get to know the Basics of perl. You can learn a programming language, of course, free of cost, with in a weak!!! What you need for perl programming? PERL and UNIX: If you work in UNIX, you need not install perl, just  go to terminal, and you could create a perl file just by typing as ...

Viva voce #3

Hi, During the last practical exams I shared my experience. (Read here) I shared certain questions with answers which the examiner asked me during the practicals. Even this time, I'm going to share a few questions and answers with you. Here we go, This time I had 2 lab exam (Practicals), number one - Bio informatics and two - Molecular biology. Let us start with the Bio informatics lab. Bio informatics:   In this Bio info practicals, we were provided with two exercises - one must be done using various bio info tools such as Clustal W, T-coffee, BLAST P, BLAST-N, PHYLIP etc., The other exercise is PERL programming! :( :'(  The first exercise using tools is very simple, but, I find the programming, let it be any programming, it's very difficult :'( Even in the model practicals, I couldn't debug the program :( So, I worked really hard to learn the PERL! I was working with my lap for a whole day. And atlast, I got good confidence that I could write my own pro...