# Print the longest open reading frame in each line. # Prints an empty line if there are no ORFs in the line in. # Is it really fair to count the stop codon? # We use <= in comparison to give advantage to the last ORF # which might not end with a stop. $threshold = 0.5; while (<>) { $longest = ""; # while ( /(^|M)[A-Z?]*(\*|$)/go ) { while ( /[A-Z?]+/go ) { if ( length( $longest ) <= length( $& ) ) { $longest = $&; } } if ( ( length( $_ ) * $threshold ) <= length( $longest ) ) { print "$longest\n"; } }