rosalind/dna.rb
Code:
# Rosalind Problem DNA: Counting DNA Nucleotides
# https://rosalind.info/problems/dna/
require_relative './helpers.rb'
dataset = get_dataset(problem: 'DNA')[0]
def solve(dataset)
['A', 'C', 'G', 'T'].map { |x| dataset.count(x) }.join(' ')
end
puts solve('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC')
puts solve(dataset)
Output:
20 12 17 21
196 202 186 224