title: Open a file.txt and find the possible start and end positions of its genes
body: <p>Hi I have a file and I would like to open it and find the start and end positions of its genes,also I have some extra imformations.The beginning of each gene is mapped by the following pattern. There is an 8 letter consensus known as the Shine-Dalgarno sequence (TAAGGAGG) followed by 4-10 bases downstream before the initiation codon (ATG). However there are variants of the Shine-Dalgarno sequence with the most common of which being [TA][AC]AGGA[GA][GA].The end of the gene is specified by the stop codon TAA, TAG and TGA. It must be taken care the stop codon is found after the correct Open.Reading Frame (ORF).
      Now I have make a txt file with genome and I open it with this code,and the error begin when I go to read the genome and put start and end.Any help?Thanks a lot.:        </p>
  
  <pre><code>#!/usr/bin/perl -w
      use strict;
      use warnings;
      # Searching for motifs
      # Ask the user for the filename of the file containing
      my $proteinfilename = "yersinia_genome.fasta";
      print "\nYou open the filename of the protein sequence data: yersinia_genome.fasta \n";
      # Remove the newline from the protein filename
      chomp $proteinfilename;
      # open the file, or exit
      unless (open(PROTEINFILE, $proteinfilename) ) 
      {
        print "Cannot open file \"$proteinfilename\"\n\n";
        exit;
      }
      # Read the protein sequence data from the file, and store it
      # into the array variable @protein
      my @protein = &lt;PROTEINFILE&gt;;
      # Close the file - we've read all the data into @protein now.
      close PROTEINFILE;
      # Put the protein sequence data into a single string, as it's easier
      # to search for a motif in a string than in an array of
      # lines (what if the motif occurs over a line break?)
      my $protein = join( '', @protein);
      # Remove whitespace.
      $protein =~ s/\s//g;
      # In a loop, ask the user for a motif, search for the motif,
      # and report if it was found.
      my $motif='TAAGGAGG';
      do 
      {
        print "\n Your motif is:$motif\n";
        # Remove the newline at the end of $motif
        chomp $motif;
        # Look for the motif
          if ( $protein =~ /$motif/ ) 
          {
            print "I found it!This is the motif: $motif in line $.. \n\n";
          } 
          else 
          {
            print "I couldn't find it.\n\n";
          }
      }
      until ($motif =~ /TAAGGAGG/g); 
      my $reverse=reverse $motif;
      print "Here is the reverse Motif: $reverse. \n\n";
      #HERE STARTS THE PROBLEMS,I DONT KNOW WHERE I MAKE THE MISTAKES
      #$genome=$motif;
      #$genome = $_[0];
      my $ORF = 0;
      while (my $genome = $proteinfilename) {
          chomp $genome;
          print "processing $genome\n";
          my $mrna = split(/\s+/, $genome);
          while ($mrna =~ /ATG/g) {
            # $start and $stop are 0-based indexes
            my $start = pos($mrna) - 3; # back up to include the start sequence
            # discard remnant if no stop sequence can be found
            last unless $mrna=~ /TAA|TAG|TGA/g;
      #m/^ATG(?:[ATGC]{3}){8,}?(?:TAA|TAG|TGA)/gm;
        my $stop    = pos($mrna);
        my $genlength = $stop - $start;
        my $genome    = substr($mrna, $start, $genlength);
        print "\t" . join(' ', $start+1, $stop, $genome, $genlength) . "\n";
        #      $ORF ++;
              #print "$ORF\n";
         }
      }
      exit;
  </code></pre>