BuKyung Extract a sequence MKKTGIKG from ASMKATAHQMKKTGIKGMSTYALLRL and print it out in a file

From Biolecture.org

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.