Difference between revisions of "BuKyung Extract a sequence MKKTGIKG from ASMKATAHQMKKTGIKGMSTYALLRL and print it out in a file"

From Biolecture.org
imported>Baik BuKyung
(Created page with "<p>Back to Baik BuKyung</p> <hr /> <p> </p>")
 
imported>Baik BuKyung
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
  
 
<hr />
 
<hr />
 +
<p><span style="font-size:24px">Source code:</span></p>
 +
 +
<hr />
 +
<div>
 +
<div>#!/usr/bin/perl<br />
 +
&nbsp;use strict;<br />
 +
&nbsp;use warnings;<br />
 +
&nbsp;open FH, &quot;&gt;&quot;, &quot;outer.fasta&quot; or die &quot;$!\n&quot;;<br />
 +
&nbsp;<br />
 +
&nbsp;my $Original_sequence=&quot;ASMKATAHQMKKTGIKGMSTYALLRL&quot;;<br />
 +
&nbsp;my $Extracted_sequence=&quot;MKKTGIKG&quot;;<br />
 +
&nbsp;if($Original_sequence =~ /$Extracted_sequence/){<br />
 +
&nbsp;&nbsp;print FH (&quot;Original sequence is :&quot;,$Original_sequence,&quot;\nExtracted sequence is :&quot;,$Extracted_sequence);<br />
 +
}<br />
 +
&nbsp;else{<br />
 +
&nbsp;&nbsp;print FH ($Extracted_sequence, &quot; is not in the &quot;, $Original_sequence);<br />
 +
&nbsp;}</div>
 +
 +
<div>
 +
<hr />
 +
<p><img alt="" src="/ckfinder/userfiles/images/%EC%BA%A1%EC%B2%9820(1).PNG" style="height:272px; width:767px" /></p>
 +
</div>
 +
</div>
 +
 
<p>&nbsp;</p>
 
<p>&nbsp;</p>
 +
 +
<div>
 +
<hr />
 +
<p>&nbsp;</p>
 +
 +
<p><span style="font-size:24px">Result</span></p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p><img alt="" src="/ckfinder/userfiles/images/%EC%BA%A1%EC%B2%9821.PNG" style="height:25px; width:220px" /></p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p><span style="font-size:16px">After the 7.pl is executed, the outer.fasta file is created.</span></p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p><span style="font-size:16px">In outer.fasta file,</span></p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p><em>Original sequence is :ASMKATAHQMKKTGIKGMSTYALLRL<br />
 +
Extracted sequence is :MKKTGIKG</em></p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p><span style="font-size:16px">If MKKTGIKG is not in ASMKATAHQMKKTGIKGMSTYALLRL, </span></p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p><em>MKKTGIKG is not in the ASMKATAHQMKKTGIKGMSTYALLRL</em></p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p><span style="font-size:16px">is in the outer.fasta file.</span></p>
 +
</div>

Latest revision as of 21:42, 16 June 2016

Back to Baik BuKyung


Source code:


#!/usr/bin/perl

 use strict;
 use warnings;
 open FH, ">", "outer.fasta" or die "$!\n";
 
 my $Original_sequence="ASMKATAHQMKKTGIKGMSTYALLRL";
 my $Extracted_sequence="MKKTGIKG";
 if($Original_sequence =~ /$Extracted_sequence/){
  print FH ("Original sequence is :",$Original_sequence,"\nExtracted sequence is :",$Extracted_sequence);
}
 else{
  print FH ($Extracted_sequence, " is not in the ", $Original_sequence);

 }

 


 

Result

 

 

After the 7.pl is executed, the outer.fasta file is created.

 

In outer.fasta file,

 

Original sequence is :ASMKATAHQMKKTGIKGMSTYALLRL
Extracted sequence is :MKKTGIKG

 

If MKKTGIKG is not in ASMKATAHQMKKTGIKGMSTYALLRL,

 

MKKTGIKG is not in the ASMKATAHQMKKTGIKGMSTYALLRL

 

is in the outer.fasta file.