Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the two following methods; findFrequency and hasMutation; how do I write a method that counts the number of mutated DNA sequences that occur within

Using the two following methods; findFrequency and hasMutation; how do I write a method that counts the number of mutated DNA sequences that occur within an array. This must be done by building on the technique for findFrequency and adding calls to hasMutation.

Parameters:

seqArray - An array of DNA sequences, as described in the CSC110 Assignment 5 instructions. 

Returns:

The number of mutated DNA sequences found within the array. 

Note that DNA sequences contain two to four of the following characters: {A,C,G,T} in any order. A mutated sequence contains adjacent repeated characters , so ACCG, TTCCA, and AACC are all mutated sequences.

public static int findFrequency(String target, String[] strings) {

int maxFrequency = 0;

for ( String DNACode : strings ) {

if ( DNACode.equals(target) ) {

maxFrequency = maxFrequency + 1;

}

}

return maxFrequency;

}

public static boolean hasMutation(String DNACode) {

for ( int i = 0 ; i < DNACode.length() ; i++ ) {

for ( int j = i + 1 ; j < DNACode.length() ; j++ ) {

if ( DNACode.charAt(i) == DNACode.charAt(j) ) {

return true;

}

}

}

return false;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

How does a freemium business model work?

Answered: 1 week ago

Question

Use a customer presentation card.

Answered: 1 week ago

Question

=+How should it be delivered?

Answered: 1 week ago

Question

=+4 How does one acquire a global mindset?

Answered: 1 week ago