src/problems/eval.lisp @ e3aefcbf364c

Cache Uniprot results on the filesystem

This will make only the first `(run-tests)` on a given computer take forever,
instead of the first `(run-tests)` of a given Lisp session.  It will also
hopefully make the Uniprot folks not hate me.
author Steve Losh <steve@stevelosh.com>
date Fri, 24 Jan 2020 23:05:16 -0500
parents 2735aa6aab79
children (none)
(defpackage :rosalind/eval (:use :cl :rosalind :losh :iterate))
(in-package :rosalind/eval)

(defparameter *input* "10
AG
0.25 0.5 0.75")

(defparameter *output* "0.422 0.563 0.422")

(define-problem eval (data stream) *input* *output*
  (let* ((string-length (read data))
         (substring (read-line data))
         (gc-contents (read-all data))
         (chances (- string-length (1- (length substring)))))
    (u:float-string (mapcar (lambda (gc-content)
                              (* chances (u:sequence-probability
                                           (coerce gc-content 'double-float)
                                           substring)))
                            gc-contents))))