Question: USE RUBY PROGRAMMING The most frequent k-mer problem seeks the set of substrings of length k (where integer k is an input) that occur most

USE RUBY PROGRAMMING

The most frequent k-mer problem seeks the set of substrings of length k (where integer k is an input) that occur most frequently. We add to the DNA class a most_frequent_kmers method that gets called with integer k and returns an array whose first element is the set of k-mers that occur most frequently in this DNA and whose second element is the number of times each one appears.

>> dna1 = DNA.new('ATTGATTCCG') => ATTGATTCCG

>> dna1.most_frequent_kmers(1) => [#, 4]

>> dna1.most_frequent_kmers(2) => [#, 2]

>> dna1.most_frequent_kmers(3) => [#, 2]

>> dna1.most_frequent_kmers(4) => [#, 1]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!