Question

In: Computer Science

USING JAVA: complete these one method in the BasicBioinformatics class /** * Class BasicBioinformatics contains static...

USING JAVA: complete these one method in the BasicBioinformatics class
/**
* Class BasicBioinformatics contains static methods for performing common DNA-based operations in
* bioinformatics.
*
*
*/
public class BasicBioinformatics {

/**
* Calculates and returns the reverse complement of a DNA sequence. In DNA sequences, 'A' and 'T'
* are complements of each other, as are 'C' and 'G'. The reverse complement is formed by
* reversing the symbols of a sequence, then taking the complement of each symbol (e.g., the
* reverse complement of "GTCA" is "TGAC").
*
* @param dna a char array representing a DNA sequence of arbitrary length, containing only the
* characters A, C, G and T
*
* @return a char array representation of the reverse complement of the given sequence
*/
public static char[] reverseComplement(char[] dna) {
// TODO
}
/**
* Calculates and returns the reverse complement of a DNA sequence. In DNA sequences, 'A' and 'T'
* are complements of each other, as are 'C' and 'G'. The reverse complement is formed by
* reversing the symbols of a sequence, then taking the complement of each symbol (e.g., the
* reverse complement of "GTCA" is "TGAC").
*
* @param dna a string representing a DNA sequence of arbitrary length, containing only the
* characters A, C, G and T
*
* @return a String representation of the reverse complement of the given sequence
*/
public static String reverseComplement(String dna) {
return new String(reverseComplement(dna.toCharArray()));
} }

Solutions

Expert Solution

Code

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author JOSEE
*/
public class BasicBioinformatics {

/**
* Calculates and returns the reverse complement of a DNA sequence. In DNA sequences, 'A' and 'T'
* are complements of each other, as are 'C' and 'G'. The reverse complement is formed by
* reversing the symbols of a sequence, then taking the complement of each symbol (e.g., the
* reverse complement of "GTCA" is "TGAC").
*
* @param dna a char array representing a DNA sequence of arbitrary length, containing only the
* characters A, C, G and T
*
* @return a char array representation of the reverse complement of the given sequence
*/
public static char[] reverseComplement(char[] dna)
{
int i, k;
char temp;
int size=dna.length;
//reverse the dna array
for (i = 0; i < size / 2; i++) {
temp = dna[i];
dna[i] = dna[size - i - 1];
dna[size - i - 1] = temp;
}
//then change DNA sequences to its complements
for (i = 0; i < size ; i++)
{
if(dna[i]=='A')
dna[i]='T';
else if(dna[i]=='T')
dna[i]='A';
else if(dna[i]=='C')
dna[i]='G';
else if(dna[i]=='G')
dna[i]='C';
}
return dna;
}
/**
* Calculates and returns the reverse complement of a DNA sequence. In DNA sequences, 'A' and 'T'
* are complements of each other, as are 'C' and 'G'. The reverse complement is formed by
* reversing the symbols of a sequence, then taking the complement of each symbol (e.g., the
* reverse complement of "GTCA" is "TGAC").
*
* @param dna a string representing a DNA sequence of arbitrary length, containing only the
* characters A, C, G and T
*
* @return a String representation of the reverse complement of the given sequence
*/
public static String reverseComplement(String dna) {
return new String(reverseComplement(dna.toCharArray()));
}    
}

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.


Related Solutions

USING JAVA: complete the method below in the BasicBioinformatics class. /** * Class BasicBioinformatics contains static...
USING JAVA: complete the method below in the BasicBioinformatics class. /** * Class BasicBioinformatics contains static methods for performing common DNA-based operations in * bioinformatics. * * */ public class BasicBioinformatics { /** * Calculates and returns the number of times each type of nucleotide occurs in a DNA sequence. * * @param dna a char array representing a DNA sequence of arbitrary length, containing only the * characters A, C, G and T * * @return an int array...
JAVA PROGRAM: FINISH THE FOLLOWING METHOD IN THE CLASS BasicBioinformatics. public class BasicBioinformatics { /** *...
JAVA PROGRAM: FINISH THE FOLLOWING METHOD IN THE CLASS BasicBioinformatics. public class BasicBioinformatics { /** * Calculates and returns the reverse complement of a DNA sequence. In DNA sequences, 'A' and 'T' * are complements of each other, as are 'C' and 'G'. The reverse complement is formed by * reversing the symbols of a sequence, then taking the complement of each symbol (e.g., the * reverse complement of "GTCA" is "TGAC"). * * @param dna a char array representing...
USING JAVA: Complete the following class. input code where it says //TODO. public class BasicBioinformatics {...
USING JAVA: Complete the following class. input code where it says //TODO. public class BasicBioinformatics { /** * Calculates and returns the complement of a DNA sequence. In DNA sequences, 'A' and 'T' are * complements of each other, as are 'C' and 'G'. The complement is formed by taking the * complement of each symbol (e.g., the complement of "GTCA" is "CAGT"). * * @param dna a char array representing a DNA sequence of arbitrary length, * containing only...
Java Programming Using the class below, please ), write a static method called parse that parses...
Java Programming Using the class below, please ), write a static method called parse that parses a String for balanced parentheses. we seek only to determine that the symbol ‘{‘ is balanced with ‘}’. parse accepts a single String parameter and returns an int. If parse returns a minus 1, then there are no errors, otherwise, parse should return the position within the String where an error occurred. For example parse(“{3 + {4/2} }”)   would return -1 parse(“{ { 4*X}”)...
in Java language, in most simple algorithm Using a stack class, write a static method called...
in Java language, in most simple algorithm Using a stack class, write a static method called parse that parses a String for balanced parentheses. we seek only to determine that the symbol ‘{‘ is balanced with ‘}’. parse accepts a single String parameter and returns an int. If parse returns a minus 1, then there are no errors, otherwise, parse should return the position within the String where an error occurred. For example parse(“{3 + {4/2} }”)   would return -1...
You shall implement six static methods in a class named BasicBioinformatics. Each of the methods will...
You shall implement six static methods in a class named BasicBioinformatics. Each of the methods will perform some analysis of data considered to be DNA. DNA shall be represented arrays of chars containing only the characters A, C, G and T. In addition to the six methods you will implement, six other methods exist in the class, which use Strings instead of char arrays to represent DNA. These other methods simply invoke the methods you are to implement, so all...
Question 3 A java source module contains the following class with the static methods main and...
Question 3 A java source module contains the following class with the static methods main and procedure1, and the instance method procedure2 (assume given the bodies of procedure1 and procedure2): public class TestQuestion3             {                         static int result, num1 = 10;                         public static void Main( String [ ] args )                         {                                     int [ ] list1 =   { 2, 4, 6, 8, 10}, list2;                                     .    .    .                         }                         static void procedure1( void )                         {                                     .   .   .                         } void procedure2( void )...
PLEASE CODE THIS IN JAVA Create a driver class Playground that contains the function, public static...
PLEASE CODE THIS IN JAVA Create a driver class Playground that contains the function, public static void main(String[] args) {}. Create 2 SportsCar and 2 Airplane instances using their constructors. (SPORTSCAR AND AIRPLANE CLASSES LISTED BELOW THIS QUESTION. Add all 4 instances into a single array called, “elements.” Create a loop that examines each element in the array, “elements.” If the elements item is a SportsCar, run the sound method and if the item is an Aeroplane, run it’s ChangeSpeed...
Using maps in Java. Make a public class called ExampleOne that provides a single class (static)...
Using maps in Java. Make a public class called ExampleOne that provides a single class (static) method named firstOne. firstOne accepts a String array and returns a map from Strings to Integer. The map must count the number of passed Strings based on the FIRST letter. For example, with the String array {“banana”, “apples”, “blueberry”, “orange”}, the map should return {“b”:2, “a”:1, “o”:1}. Disregard empty Strings and zero counts. Retrieve first character of String as a char using charAt, or,...
Java program Write a class called Animal that contains a static variable called count to keep...
Java program Write a class called Animal that contains a static variable called count to keep track of the number of animals created. Your class needs a getter and setter to manage this resource. Create another variable called myCount that is assigned to each animal for each animal to keep track of its own given number. Write a getter and setter to manage the static variable count so that it can be accessed as a class resource
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT