Sha256: 1787b20cd02ad1ef77a52b197559319e5955e57ac146d34ca251989fd7189b6e

Contents?: true

Size: 405 Bytes

Versions: 124

Compression:

Stored size: 405 Bytes

Contents

import sys

if sys.version_info[0] == 2:
    from string import maketrans
else:
    maketrans = str.maketrans


DNA_CHARS = 'AGCT'
DNA_TO_RNA = maketrans(DNA_CHARS, 'UCGA')


def to_rna(dna_strand):
    valid_chars = set(DNA_CHARS)
    if any(char not in valid_chars for char in dna_strand):
        raise ValueError("Input DNA strand contains invalid bases")

    return dna_strand.translate(DNA_TO_RNA)

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.77 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.76 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.75 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.74 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.73 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.72 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.71 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.70 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.69 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.68 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.67 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.66 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.65 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.64 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.63 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.62 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.61 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.60 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.59 tracks/python/exercises/rna-transcription/example.py