We all know that the DNA molecules are double-stranded in living cells. Please design a Java program to prompt the user to enter a DNA sequence and then find the complement sequence of that DNA sequence, and print out a double-stranded DNA with the complement strand right beneath the original DNA sequence. See the sample output below.
Sample output:
Here is the starting DNA:
ACGGGAGGACGGGAAAATTACTACGGCATTAGC
Here is the double-stranded DNA:
ACGGGAGGACGGGAAAATTACTACGGCATTAGC
TGCCCTCCTGCCCTTTTAATGATGCCGTAATCG
Screenshot of program:
ScreenShot of Output:
Source Code:
import java.util.Scanner;
public class ComplementDNA {
public String complement(String dna_strand) {
StringBuilder complement = new
StringBuilder();
for(int i=0;i<dna_strand.length();i++){
char c = dna_strand.charAt(i);
// if 'T' is at ith index in dna_strand then add 'A'
inplace of 'T' in complement StringBuilder
if(dna_strand.charAt(i) == 'T'){
complement.append('A');
}
// if 'A' is at ith index in dna_strand then add 'T'
inplace of 'A' in complement StringBuilder
if(dna_strand.charAt(i) == 'A'){
complement.append('T');
}
// if 'C' is at ith index in dna_strand then add 'G'
inplace of 'C' in complement StringBuilder
if(dna_strand.charAt(i) == 'C'){
complement.append('G');
}
// if 'G' is at ith index in dna_strand then add 'C'
inplace of 'G' in complement StringBuilder
if(dna_strand.charAt(i) == 'G'){
complement.append('C');
}
// if 'U' is at ith index in dna_strand then add 'A'
inplace of 'U' in complement StringBuilder
if(dna_strand.charAt(i) == 'U'){
complement.append('A');
}
}
return complement.toString();
}
public static void main(String[] args) {
ComplementDNA obj = new
ComplementDNA();
Scanner in = new
Scanner(System.in);
// giving prompt to user to enter
the dna sequence
System.out.println("Please enter a
DNA sequence :");
String dna = in.nextLine();
String complementedDNA =
obj.complement(dna);
System.out.println("Here is the
double-stranded DNA :");
System.out.println(dna);
System.out.println(complementedDNA);
}
}
We all know that the DNA molecules are double-stranded in living cells. Please design a Java...
Part C this is for Genetics UUUUUUUUUUUUUUPPO 1 (UU (AA (CA 44. A double-stranded DNA molecule with the sequence shown here produces, in vivo, a polypeptide that is five amino acids long. TACATGATCATTTCACGGAATTTCTAGCATGTA ATGTACTAGTAAAGTGCCTTAAAGATCGTACAT (UA (AL a. Which strand of DNA is the template strand, and in which direction is it transcribed? b. Label the 5' and the 3' ends of each strand. c. If an inversion occurs between the second and the third triplets from the left and right...
You are given the following double-stranded DNA template (only top strand shown). Design a primer-pair to amplify all of the red (ds) sequence, and only the red sequence? Primers should be 8 nts long (note: usually 17-25 nts long) Hint: Think about direction of DNA synthesis and annealing of primer to double-stranded template ! To answer, write the primer sequence (8 nts each) into the provided space below with the indicated 5' 3' polarity. 5'---AATGCCGTCAGCCGATCTGCCTCGAGTCAATC GATGCTGGTAACTTGGGGTATAAAGCTTACCCATGG TATCGTAGTTAGATTGATTGTTAGGTTCTTAGGTTTA GGTTTCTGGTATTGGTTTAGGGTCTTTGATGCTATTA ATTGTTTGGTTTTGATTTGGTCTTTATATGGTTTATG TTTTAAGCCGGGTTTTGTCTGGGATGGTTCGTCTGAT...
6. A double-stranded DNA molecule with the sequence shown here produces a polypeptide that is 5 amino acids long. The sequence does not include the promoter. Transcription is proceeding left to right(). thlt TEAM 3' ATGradGGCTAAAGTGCCATCTAAAGATCGTACAT 5' loding 5' TACATGCCGATTTCACGCTAGATTTCTAGCATGTA 3' shar a. Label the template and coding strands. b. In the template strand, underline the nucleotides that will encode the start codon. c. The stop codon for the polypeptide is (UAA (UAG UGA).(circle the correct answer) d. In the...
Please develop a Java program to read in a piece of DNA sequence from a FASTA format sequence file (alternatively you can use the getRandomSeq(long) method of the RandomSeq class to generate a piece of DNA sequence), and then print out all the codons in three forward reading frames. Design a method called codon() that can be used to find all the codons from three reading frames. The method will take in an argument, the reading frame (1, 2, or...
package _solution; /** This program demonstrates how numeric types and operators behave in Java Do Task #1 before adding Task#2 where indicated. */ public class NumericTypesOriginal { public static void main (String [] args) { //TASK #2 Create a Scanner object here //identifier declarations final int NUMBER = 2 ; // number of scores int score1 = 100; // first test score int score2 = 95; // second test score final int BOILING_IN_F = 212; // boiling temperature double fToC;...
create a new Java application called "WeightedAvgWithExceptions" (without the quotation marks), according to the following guidelines and using try-catch-finally blocks in your methods that read from a file and write to a file, as in the examples in the lesson notes for reading and writing text files. Input File The input file - which you need to create and prompt the user for the name of - should be called 'data.txt', and it should be created according to the instructions...
Hello Guys. I need help with this its in java In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide...
A java program for this question please! Recursion: A word is considered elfish if it contains the letters: e, l, and f in it, in any order. For example, we would say that the following words are elfish: whiteleaf, tasteful, unfriendly, and waffles, because they each contain those letters. Write a recursive method called elfish(), that, given a word, tells us whether or not that word is elfish. The signature of the method should be: public static boolean elfish(String word)...
Java Please - Design and implement a class Triangle. A constructor should accept the lengths of a triangle’s 3 sides (as integers) and verify that the sum of any 2 sides is greater than the 3rd(i.e., that the 3 sides satisfy the triangle inequality). The constructor should mark the triangle as valid or invalid; do not throw an exception. Provide get and set methods for the 3 sides, and recheck for validity in the set methods. Provide a toString method...