Biological Sequences as Python Strings
Core Operations
# Reverse complement — the only correct approach
complement_table = str.maketrans('ATGC', 'TACG')
rev_comp = dna.translate(complement_table)[::-1]
# Transcription
rna = dna.replace('T', 'U')
# All codons
codons = [mrna[i:i+3] for i in range(0, len(mrna), 3)]
# GC content
gc = (seq.count('G') + seq.count('C')) / len(seq)
Motif Scanning
# All positions (overlapping) — built-in find() loop
def find_all(seq
[Description truncada. Veja o README completo no GitHub.]