Sha256: ed8c19a4a8783db216aabbb5fd2cf98610d1f1554dd094fa1223e794031f96e4

Contents?: true

Size: 402 Bytes

Versions: 181

Compression:

Stored size: 402 Bytes

Contents

module rna_transcription;

import std.exception;
import std.regex;
import std.string;

immutable dchar[dchar] rnaTransTable;

static this() {
 rnaTransTable = [
     'C': 'G',
     'G': 'C',
     'T': 'A',
     'A': 'U'];
}

enum dnaRegex = regex(r"^[CGTA]*$");

string dnaComplement(string dna) {
    enforce(dna.matchFirst(dnaRegex), "Invalid DNA string");
    return dna.translate(rnaTransTable);
}

Version data entries

181 entries across 181 versions & 1 rubygems

Version Path
trackler-2.1.0.25 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.24 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.23 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.22 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.21 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.20 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.19 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.18 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.17 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.16 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.15 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.14 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.13 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.12 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.11 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.10 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.9 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.8 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.7 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.6 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d