Difference between revisions of "5) Extracting a sequence MKKTGIKG from ASMKATAHQMKKTGIKGMSTYALLRL"
From Biolecture.org
imported>S (Created page with "<p><span style="font-size:14px"><strong>There is given sequence, and if there is MKKTGIKG in sequence, it will match and print it to the new "output.txt" file.</strong>...") |
imported>S |
||
Line 1: | Line 1: | ||
− | <p><span style="font-size:14px"><strong>There is given sequence, and | + | <p><span style="font-size:14px"><strong>There is a given sequence, and this script can extract "MKKTGIKG" from the sequence and print it to the new "output.txt" file.</strong></span> </p> |
<p><span style="font-size:14px">#!/usr/bin/perl<br /> | <p><span style="font-size:14px">#!/usr/bin/perl<br /> | ||
use strict;<br /> | use strict;<br /> | ||
use warnings;<br /> | use warnings;<br /> | ||
− | open( | + | <strong> open(OUT, ">output.txt")</strong> or die "Can't open file $_\n";<br /> |
− | my | + | my $seq ="ASMKATAHQMKKTGIKGMSTYALLRL";<br /> |
− | | + | print OUT "Original sequence: $seq\n";<br /> |
− | | + | <strong>$seq =~ s/MKKTGIKG//g;</strong><br /> |
− | + | print OUT "After extraction: $seq\n";</span></p> | |
− | + | ||
− | </p> | + | <p>-----------------------------------------------------</p> |
+ | |||
+ | <p><strong>The output file content:</strong></p> | ||
+ | |||
+ | <p>Original sequence: ASMKATAHQMKKTGIKGMSTYALLRL<br /> | ||
+ | After extraction: ASMKATAHQMSTYALLRL</p> | ||
+ | |||
+ | <p> </p> |
Latest revision as of 16:07, 11 June 2017
There is a given sequence, and this script can extract "MKKTGIKG" from the sequence and print it to the new "output.txt" file.
#!/usr/bin/perl
use strict;
use warnings;
open(OUT, ">output.txt") or die "Can't open file $_\n";
my $seq ="ASMKATAHQMKKTGIKGMSTYALLRL";
print OUT "Original sequence: $seq\n";
$seq =~ s/MKKTGIKG//g;
print OUT "After extraction: $seq\n";
-----------------------------------------------------
The output file content:
Original sequence: ASMKATAHQMKKTGIKGMSTYALLRL
After extraction: ASMKATAHQMSTYALLRL