http://www.perlmonks.org?node_id=1018622


in reply to Re^3: Urgent help required. Need a code to translate a given nucleotide sequence into proteins using codon table.
in thread Urgent help required. Need a code to translate a given nucleotide sequence into proteins using codon table.

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re^4: Urgent help required. Need a code to translate a given nucleotide sequence into proteins using codon table.

Replies are listed 'Best First'.
Re^5: Urgent help required. Need a code to translate a given nucleotide sequence into proteins using codon table.
by tmharish (Friar) on Feb 14, 2013 at 14:18 UTC
    suchetana
    Basically I need to find the ORFs in the thread in three reading frames. and then translate.

    I have no idea what ORFs or frames are. I dont know what this translate is ... and I dont really want to.

    What I do know is Perl ... So if you gave a chunk of input and corresponding output you expect that will help.

    suppose TATGCATGGCATATATATACGTACGTATGCATATATATGCTAA. I want to find the substring that has ATG......TAA while reading from the first T Then I want it to start reading from the second alphabet and find the substring having ATG...TAA and again then the same thing from T to get ATG....TAA.

    I dont get that completely but here is ( a simplified version of ) something that can do it:

    use strict; use warnings ; my $string = 'TATGCATGGCATATATATACGTACGTATGCATATATATGCTAA' ; my %found_strings ; for( my $start = 0; $start < length( $string ); $start++ ) { my $string_to_check = substr( $string, $start ) ; if( $string_to_check =~ /(ATG.*?TAA)/ ) { $found_strings{ $1 } = 1 ; } } my @found = keys %found_strings ; foreach my $found ( @found ) { print "$found\n"; } exit() ;

    And the output

    ATGCATATATATGCTAA ATGGCATATATATACGTACGTATGCATATATATGCTAA ATGCTAA ATGCATGGCATATATATACGTACGTATGCATATATATGCTAA

    I have no idea what the rest of that means:

    Also, I then need to store these three substrings in three different scalars/arrays. Then I need to translate them, like if the first three are ATG it should return say M, then it reads the next 3 characters of that substring and say it is CAT. Then it will return X say. Likewise. How do I go about? Please please help

    Except of course the please please part that does not help at all ... So if you explain what you want that will help us give you something.

    And finally - You have been told several times about use strict; so whats with not adding it?