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.5 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.4 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.3 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.2 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.1 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.1.0.0 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.55 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.54 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.53 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.52 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.51 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.50 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.49 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.48 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.47 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.46 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.45 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.44 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.43 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d
trackler-2.0.8.42 tracks/dlang/exercises/rna-transcription/rna_transcription_example.d