src/problems/revc.lisp @ bd06f66ba88f
More problems
| author | Steve Losh <steve@stevelosh.com> |
|---|---|
| date | Fri, 02 Nov 2018 21:08:20 -0400 |
| parents | 6088027147e1 |
| children | 11df545d1a41 |
(in-package :rosalind) ;; In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' ;; and 'G'. ;; ;; The reverse complement of a DNA string s is the string sc formed by reversing ;; the symbols of s, then taking the complement of each symbol (e.g., the ;; reverse complement of "GTCA" is "TGAC"). ;; ;; Given: A DNA string s of length at most 1000 bp. ;; ;; Return: The reverse complement sc of s. (define-problem revc (data string) "AAAACCCGGT" "ACCGGGTTTT" (flet ((dna-complement (base) (case base (#\A #\T) (#\T #\A) (#\G #\C) (#\C #\G) (t base)))) ; newline etc (map-into data #'dna-complement data) (nreverse data)))