1
0
Fork 0
factor-puzzles/rosalind/kmer/kmer.factor

15 lines
509 B
Factor
Raw Normal View History

2020-11-29 08:22:10 +01:00
! Copyright (C) 2020 Bubbler.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs grouping io io.encodings.utf8 io.files kernel
math.combinatorics math.parser rosalind.common sequences sorting
;
IN: rosalind.kmer
: kmer ( str -- counts )
[ "ACGT" 4 selections [ 0 ] H{ } map>assoc ] dip
4 clump [ over inc-at ] each sort-keys values ;
: kmer-main ( -- ) "datasets/rosalind/kmer.txt" utf8 file-contents
fasta>assoc values first kmer [ 10 >base ] map " " join print ;
MAIN: kmer-main