Sha256: 87be0ecf928fe9b51ebb6673809e3a4c413d485057950b6fd5915ab828d0be85

Contents?: true

Size: 355 Bytes

Versions: 253

Compression:

Stored size: 355 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):
        return ''

    return dna_strand.translate(DNA_TO_RNA)

Version data entries

253 entries across 253 versions & 1 rubygems

Version Path
trackler-2.2.1.54 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.53 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.52 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.51 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.50 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.49 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.48 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.47 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.46 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.45 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.44 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.43 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.42 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.41 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.40 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.39 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.38 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.37 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.36 tracks/python/exercises/rna-transcription/example.py
trackler-2.2.1.35 tracks/python/exercises/rna-transcription/example.py