Start taking some notes
author |
Steve Losh <steve@stevelosh.com> |
date |
Sat, 03 Nov 2018 18:20:48 -0400 |
parents |
11df545d1a41 |
children |
638d42c1ebe6 |
(in-package :rosalind)
(defparameter *input-gc* ">Rosalind_6404
CCTGCGGAAGATCGGCACTAGAATAGCCAGAACCGTTTCTCTGAGGCTTCCGGCCTTCCC
TCCCACTAATAATTCTGAGG
>Rosalind_5959
CCATCGGTAGCGCATCCTTAGTCCAATTAAGTCCCTATCCAGGCGCTCCGCCGAAGGTCT
ATATCCATTTGTCAGCAGACACGC
>Rosalind_0808
CCACCCTCGTGGTATGGCTAGGCATTCAGGAACCGGAGAACGCTTCAGACCAGCCCGGAC
TGGGAACCTGCGGGCAGTAGGTGGAAT")
(defparameter *output-gc* "Rosalind_0808
60.919540")
(define-problem gc (data stream)
*input-gc*
*output-gc*
(labels ((gcp (base)
(or (char= #\G base)
(char= #\C base)))
(gc-content (string)
(/ (count-if #'gcp string)
(length string))))
(iterate
(for (label dna) :in-fasta data)
(for gc = (gc-content dna))
(finding (format nil "~A~%~,6F" label (* 100 gc))
:maximizing gc))))
;; (problem-gc *input-gc*)
;; (solve gc)