Outline Lecture 13 April 12, 2006 I. Discuss Homology Modeling A. Fixing Alignment Clashes B. Evaluation of the Model II. Introduction to Perl A. Running Perl B. Scalar variables C. Binding operator =~ D. String substitution and translation E. Reading Files #Program 1######################################################## #!/usr/bin/perl # my first Perl program print "Hello world \n"; #Program 2######################################################## #!/usr/bin/perl print "4+5\n"; print 4+5 , "\n"; print "4+5=" , 4+5 , "\n"; #Program 3######################################################## #!/usr/bin/perl #put some values in variables $sequences_analyzed = 200 ; $new_sequences = 21 ; #now we will do the work $percent_new_sequences =( $new_sequences / $sequences_analyzed) *100 ; print "% of new sequences = " , $percent_new_sequences,"\n"; #Program 4######################################################## #!/usr/bin/perl –w use strict; # Store the DNA sequence in a variable $DNA1 = 'ACGGGAGGACGGGAA'; $DNA2 = 'ATTACTACGGCATTAGC'; # print the DNA sequence out with a line feed print $DNA1,"\n"; print $DNA2,"\n"; #concatenate the strings Note error $DNA3 = $DNA1 . DNA2 print "The concatenated string are"; print "$DNA3\n"; # alternately $DNA3 = "$DNA1 $DNA2 \n"; print $DNA3; # finish the program exit; #Program 5######################################################## # Store the DNA sequence in a variable $DNA = 'ACGGGAGGACGGGAAATTACTACGGCATTAGC'; # print the DNA sequence out with a line feed print "Here is the DNA \n"; print $DNA,"\n"; # convert the DNA into RNA $RNA = $DNA; $RNA =~ s/T/U/g; # print the results print "Here is the transcribed RNA: \n"; print "$RNA\n"; # exit the program exit; #Program 6######################################################## # Store the DNA sequence in a variable $DNA = 'ACGGGAGGACGGGAAATTACTACGGCATTAGC'; # print the DNA sequence out with a line feed print $DNA,"\n"; # reverse the DNA string 3'-5' $revcom = $DNA; $revcom =~ tr/ACGTacgt/TGCAtgca/; # print the results print "Here is the complement 3'-5': \n\n"; print "$revcom\n"; # reverse the strand $revcom = reverse $revcom; print "Here is the complement 5'-3': \n\n"; print "$revcom\n"; # exit the program exit; #Program 7######################################################## print "Enter your name: "; $name = <>; print "Hello $name, happy to meet you!\n"; chomp $name; print "Hello $name, happy to meet you!\n"; #Program 8######################################################## Sample Data file save to fragment.txt MNIDDKLEGLFLKCGGIDEMQSSRTMVVMGGVSGQSTVSGELQD SVLQDRSMPHQEILAADEVLQESEMRQQDMISHDELMVHEETVKNDEEQMETHERLPQ GLQYALNVPISVKQEITFTDVSEQLMRDKKQIR #Program 8######################################################## # name the file to read $protname= 'fragment.txt'; # open the file and associate a file handle open(PROTFILE,$protname); # now read a line and print it $protein = ; # close the file because we are done close PROTFILE; # print the the results print "Here is the protein \n\n"; print $protein,"\n"; exit; #Program 9######################################################## # name the file to read $protname= 'fragment.txt'; # open the file and associate a file handle open(protfile,$protname); # now read the file into an array @protein = ; # close the file because we are done close protfile; # print the the results print "Here is the protein \n\n"; print @protein # print the second record print "/n The second record is \n"; print $protein[2],"\n"; exit; #Program 10######################################################## # read the file name print "Please type the name of the file to read: " $protname= ; #chomp $protname; # open the file and associate a file handle open(protfile,$protname) || die " Can not open file $protfile \n"; # now read the file in a loop print "Reading file \"$protname\" with a while loop \n" $count = 0; while() { print $count, $_; $count = $count +1 $protein[$count]=$_; } # close the file because we are done close protfile; exit;