#!/usr/bin/perl -w
#use strict;

# Extracts gene from within a larger sequence

########################### Variables #################################

my $sequence;              # holds entire sequence read from file
my $start = 203;           # start coordinate of dmtB in sequence
my $end = 1083;            # end coordinate of dmtB in sequence
my $dmtB;                  # will hold sequence of gene

############################# Files ###################################

my $sequence_file = 'dmtB_region.txt';

########################## Main Program ###############################

$sequence  = get_FastA_sequence($sequence_file);

#your statement goes here;

print $dmtB;

######################## Subroutines ##################################

sub get_FastA_sequence {

#  Reads given file containing sequence in FastA format
#  File must already be open
#  FastA format is:
#     > description
#     sequence
#     more sequence
#  Returns sequence

   my ($path) = @_;
   open SEQUENCE_FILE, "<$path" 
      or die "Can't open $path: $!\n";
   my $line = <SEQUENCE_FILE>; # discard first line
   print $path;
   print $line;
   my $header = substr($line, 2);          # Discards ">"
   my $sequence = "";

   while (<SEQUENCE_FILE>) {
      chomp($_);                  # Remove line break
      s/\r//;                     # And carriage return
      $sequence = $sequence . $_; # Append the line to the sequence
   }
   return $sequence;
}

