Open Reading Frames

AUTHOR

L. Grondin

http://rosalind.info/problems/orf/

Sample input

>Rosalind_99
    AGCCATGTAGCTAACTCAGGTTACATGGGGATGACCCCGCGACTTGGATTAGAGTCTCTTTTGGAATAAGCCTGAATGATCCGAGTAGCATCTCAG

Sample output

MLLGSFRLIPKETLIQVAGSSPCNLS
    M
    MGMTPRLGLESLLE
    MTPRLGLESLLE
use v6;



constant DNA-codon = Hash.new: <
    TTT F      CTT L      ATT I      GTT V
    TTC F      CTC L      ATC I      GTC V
    TTA L      CTA L      ATA I      GTA V
    TTG L      CTG L      ATG M      GTG V
    TCT S      CCT P      ACT T      GCT A
    TCC S      CCC P      ACC T      GCC A
    TCA S      CCA P      ACA T      GCA A
    TCG S      CCG P      ACG T      GCG A
    TAT Y      CAT H      AAT N      GAT D
    TAC Y      CAC H      AAC N      GAC D
    TAA Stop   CAA Q      AAA K      GAA E
    TAG Stop   CAG Q      AAG K      GAG E
    TGT C      CGT R      AGT S      GGT G
    TGC C      CGC R      AGC S      GGC G
    TGA Stop   CGA R      AGA R      GGA G
    TGG W      CGG R      AGG R      GGG G
>;

my $default-input = "AGCCATGTAGCTAACTCAGGTTACATGGGGATGACCCCGCGACTTGGATTAGAGTCTCTTTTGGAATAAGCCTGAATGATCCGAGTAGCATCTCAG";

sub revc($dna) {
    $dna.comb.reverse.join.trans:
    [<A C T G>] => [<T G A C>]
}

sub orf($dna) {
    my %match;
    my @match = (gather for $dna, revc $dna {
        take .match: rx/ ATG [ <[ACGT]>**3 ]*? <before TAA|TAG|TGA> /, :overlap;
    })>>.list.flat;

    %match{
        [~] map { DNA-codon{$_} }, .match: rx/ <[ACGT]>**3 /, :g
    }++ for @match;

    return %match.keys.sort;
}

sub MAIN(Str $input = $default-input) {
    .say for orf $input;
}

# vim: expandtab shiftwidth=4 ft=perl6

See Also

afrq-grondilu.raku

Counting Disease Carriers

aspc-grondilu.raku

Introduction to Alternative Splicing

cons-grondilu.raku

Consensus and Profile

conv-grondilu.raku

Comparing Spectra with the Spectral Convolution

cstr-grondilu.raku

Creating a Character Table from Genetic Strings

ctbl-grondilu.raku

Creating a Character Table

dbpr-grondilu.raku

Introduction to Protein Databases

dna-gerdr.raku

Counting DNA Nucleotides

dna-grondilu.raku

Counting DNA Nucleotides

eubt-grondilu.raku

Enumerating Unrooted Binary Trees

eval-grondilu.raku

Expected Number of Restriction Sites

fib-grondilu.raku

Rabbits and Recurrence Relations

fibd-grondilu.raku

Mortal Fibonacci Rabbits

gc-gerdr.raku

Computing GC Content

grph-grondilu.raku

Overlap Graphs

hamm-grondilu.raku

Counting Point Mutations

iev-grondilu.raku

Calculating Expected Offspring

indc-grondilu.raku

Independent Segregation of Chromosomes

iprb-grondilu.raku

Mendel's First Law

itwv-grondilu.raku

Finding Disjoint Motifs in a Gene

lcsq-grondilu.raku

Finding a Shared Spliced Motif

lia-grondilu.raku

Independent Alleles

lrep-grondilu-p5.raku

mmch-grondilu.raku

Maximum Matchings and RNA Secondary Structures

mprt-grondilu.raku

Finding a Protein Motif

mrna-grondilu.raku

Inferring mRNA from Protein

nwck-grondilu.raku

Distances in Trees

pmch-grondilu.raku

Perfect Matchings and RNA Secondary Structures

pper-grondilu.raku

Partial Permutations

prob-grondilu.raku

Introduction to Random Strings

qrt-grondilu.raku

Quartets

README.md

revc-gerdr.raku

Complementing a Strand of DNA

rna-gerdr.raku

Transcribing DNA into RNA

rstr-grondilu.raku

Matching Random Motifs

sexl-grondilu.raku

Sex-Linked Inheritance

sgra-grondilu.raku

Using the Spectrum Graph to Infer Peptides

spec-grondilu.raku

Inferring Protein from Spectrum

sseq-grondilu.raku

Finding a Spliced Motif

subs-grondilu.raku

Finding a Motif in DNA

suff-grondilu.raku

Encoding Suffix Trees

tran-grondilu.raku

Transitions and Transversions

trie-grondilu.raku

Introduction to Pattern Matching

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.