(in-package :cl-user) (defun each-enzyme-synonyms (function) (and (config :enzyme) (with-open-file (f (config :enzyme)) (loop with collecting = :nothing with id and names for line = (read-line f nil :eof) until (eq line :eof) do (loop for (field value) in (all-matches line "^([A-Z]*)\\s+(.*)" 1 2) do (cond ((string= field "NAME") (setq collecting :names)) ((string= field "ENTRY") (setq id value)) ((string= field "")) (t (when (eq collecting :names) (funcall function id names) (setq collecting :nothing names nil)))) (when (eq collecting :names) (push value names)))))))