5) Extracting a sequence MKKTGIKG from ASMKATAHQMKKTGIKGMSTYALLRL

From Biolecture.org
Revision as of 16:07, 11 June 2017 by imported>S
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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