--- a/stumpwm/bioinf.lisp Thu Jan 30 09:44:14 2025 -0500
+++ b/stumpwm/bioinf.lisp Wed Feb 05 11:30:40 2025 -0500
@@ -13,3 +13,40 @@
(defcommand random-dna (n) ((:integer "Length: "))
(pbcopy (random-dna-string n)))
+(defun random-fasta-string (entries entry-length)
+ (str:join #\newline
+ (loop :for i :from 0 :below entries
+ :collect (format nil ">seq ~D" i)
+ :collect (random-dna-string entry-length))))
+
+(defcommand random-fasta
+ (entries entry-length)
+ ((:integer "Entries: ")
+ (:integer "Entry Length: "))
+ (check-type entries (integer 1 *))
+ (check-type entry-length (integer 1 *))
+ (pbcopy (random-fasta-string entries entry-length)))
+
+
+(defun kmers-of (k seq)
+ (loop :for start :from 0
+ :for end :from k :to (length seq)
+ :collect (subseq seq start end)))
+
+(defun kmerized-string (k seq)
+ (with-output-to-string (s)
+ (loop :for i :from 0
+ :for kmer :in (kmers-of k seq)
+ :do (format s "~,,V,@A~%" i kmer))))
+
+(defcommand kmerize (k) ((:integer "k: "))
+ (pbcopy (kmerized-string k (pbpaste))))
+
+
+#; Scratch --------------------------------------------------------------------
+
+(random-fasta-string 10 100)
+
+(format nil "~,,99,@A" "hello")
+
+(kmers-of 3 "ACTTAC")