Difference between revisions of "Motif search"
imported>Seung-hoon Kim (Created page with "<p>What is motif?</p> <p>Motif is a sequence which has a special meaning in DNA, RNA, and protein</p> <p> </p> <p>To find a motif, we can use</p> <p>1. subroutine (...") |
(No difference)
|
Revision as of 11:27, 16 June 2016
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