Sha256: 6cd7bc1555c1e54f01872e783e3085f3cb60a09d3bb70ef55b0065c5203eab49

Contents?: true

Size: 725 Bytes

Versions: 317

Compression:

Stored size: 725 Bytes

Contents

module ProteinTranslation

open System

let codonToProtein = 
    function
    | "AUG" -> "Methionine"
    | "UUC" -> "Phenylalanine"
    | "UUU" -> "Phenylalanine"
    | "UUA" -> "Leucine"
    | "UUG" -> "Leucine"
    | "UCU" -> "Serine"
    | "UCC" -> "Serine"
    | "UCA" -> "Serine"
    | "UCG" -> "Serine"
    | "UAU" -> "Tyrosine"
    | "UAC" -> "Tyrosine"
    | "UGU" -> "Cysteine"
    | "UGC" -> "Cysteine"
    | "UGG" -> "Tryptophan"
    | "UAA" -> "STOP"
    | "UAG" -> "STOP"
    | "UGA" -> "STOP"
    | _ -> failwith "Invalid codon"

let translate (input: string) =
    input 
    |> Seq.chunkBySize 3 
    |> Seq.map (String >> codonToProtein)
    |> Seq.takeWhile (fun str -> str <> "STOP")
    |> Seq.toList

Version data entries

317 entries across 317 versions & 1 rubygems

Version Path
trackler-2.2.1.99 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.98 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.97 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.96 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.95 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.94 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.93 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.92 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.91 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.90 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.89 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.88 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.87 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.86 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.85 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.84 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.83 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.82 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.81 tracks/fsharp/exercises/protein-translation/Example.fs
trackler-2.2.1.80 tracks/fsharp/exercises/protein-translation/Example.fs