Open main menu

Biolecture.org β

Changes

Motif search

1,404 bytes added, 11:27, 16 June 2016
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 (..."
<p>What is motif?</p>

<p>Motif is a sequence which has a special meaning in DNA, RNA, and protein</p>

<p>&nbsp;</p>

<p>To find a motif, we can&nbsp;use</p>

<p>1. subroutine (you can refer to basic perl grammar)</p>

<p>2. my&nbsp;:&nbsp;an operator to make a new variable in a local space</p>

<p>3. @_;&nbsp;&nbsp; : Within a subroutine the array <code>@_</code> contains the parameters passed to that subroutine <sup>1)</sup></p>

<p>&nbsp;</p>

<p>Ex) Make a subroutine to find a motif &#39;GAATTC&#39; which is a recognition site of restriction enzyme EcoRI</p>

<p>&nbsp;</p>

<p>sub motif_search {</p>

<p>&nbsp;&nbsp; use strict;</p>

<p>&nbsp;&nbsp; use warnings;</p>

<p>&nbsp;&nbsp; my ($seq) = @_;</p>

<p>&nbsp;&nbsp; my $motif = &#39;GAATTC&#39;;</p>

<p>&nbsp;&nbsp; print &quot;Motif Search Results\n&quot;;</p>

<p>&nbsp;&nbsp; if ( $seq =~ /$motif/ ) {</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;$motif found!\n&quot;;</p>

<p>&nbsp;&nbsp; } else {</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print $motif not found!\n&quot;;</p>

<p>&nbsp;&nbsp; }</p>

<p>}</p>

<p>&nbsp;</p>

<p>We can use the subroutine in main program by adding this line</p>

<p>motif_search($seq);</p>

<h3>Reference</h3>

<p>1) <a href="http://stackoverflow.com/questions/4563485/what-is-the-meaning-of-in-perl">http://stackoverflow.com/questions/4563485/what-is-the-meaning-of-in-perl</a></p>