Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the two following methods; findFrequency and hasMutation; how do I write a

ID: 3604549 • Letter: U

Question

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:

Returns:

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;

}

Explanation / Answer

Code - For all the six methods code were written .Please check and provide feedback if any thing else required .

public static class DNASequencing extends Objects{

public static void main(String[] args){

//Method to print string array with each element in new line

public static void printArray(String[] strings){

}

//Method to find longest string in string array

public static String findLongest(String[] strings){

}

//Method to find frequency of a sting in array

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

}

//Method to find number of times a DNA sequence appered to in DNA array

public static int findFreqWithMutations(String target, String[] seqArray){

}

//METHOD TO FIND NUMBER OF TIMES PARTICULAR DNA SEQUENCE ARRIVED IN ARRAY WITH MUTED .

public static int countTotalMutations(String[] seqArray){

}

//Method to check wheather sequence as repeated characters

public static boolean hasMutation(String sequence){

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

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

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

                    return true; }

} }

        return false;

    }

}

}

}