Open main menu

Biolecture.org β

5) Extracting a sequence MKKTGIKG from ASMKATAHQMKKTGIKGMSTYALLRL

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