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