http://qs321.pair.com?node_id=473750


in reply to extracting open reading frame (ORF) from a FASTA file

local $_ = $your_input_string; while ( /ATG/g ) { my $start = pos() - 3; if ( /T(?:AA|AG|GA)/g ) { my $stop = pos; print $start, " ", $stop, " ", $stop - $start, " ", substr ($_, $start, $stop - $start), $/; } }
Boris

Replies are listed 'Best First'.
Re^2: extracting open reading frame (ORF) from a FASTA file
by Nadiah (Novice) on Jul 12, 2005 at 07:28 UTC
    Hi Boris,

    about ur codes right.. may i know what this line means and why do we need to minus 3?
    my $start = pos() - 3;

    secondly, substr ($_, $start, $stop - $start), $/;

      -3 since the position is after ATG. $/ is just the newline for the print statement.
      Boris
Re^2: extracting open reading frame (ORF) from a FASTA file
by Nadiah (Novice) on Jul 12, 2005 at 08:01 UTC
    Hi Boris,

    Thanks for your help.. but I need further explainations on the codings.

    About the codes right.. may i know what this line means and why do we need to minus the pos() by 3?
    my $start = pos() - 3;
    Secondly, why is there a need for this substr statement? substr ($_, $start, $stop - $start), $/;