Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: extracting open reading frame (ORF) from a FASTA file

by borisz (Canon)
on Jul 10, 2005 at 11:10 UTC ( [id://473750]=note: print w/replies, xml ) Need Help??


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), $/;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://473750]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found