Motif search

From Biolecture.org

What is motif?

Motif is a sequence which has a special meaning in DNA, RNA, and protein

 

To find a motif, we can use

1. subroutine (you can refer to basic perl grammar)

2. my : an operator to make a new variable in a local space

3. @_;   : Within a subroutine the array @_ contains the parameters passed to that subroutine 1)

 

Ex) Make a subroutine to find a motif 'GAATTC' which is a recognition site of restriction enzyme EcoRI

 

sub motif_search {

   use strict;

   use warnings;

   my ($seq) = @_;

   my $motif = 'GAATTC';

   print "Motif Search Results\n";

   if ( $seq =~ /$motif/ ) {

       print "$motif found!\n";

   } else {

       print $motif not found!\n";

   }

}

 

We can use the subroutine in main program by adding this line

motif_search($seq);

Reference

1) http://stackoverflow.com/questions/4563485/what-is-the-meaning-of-in-perl

 

 

KSH_0608 Bioinformatics with Bioperl