Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Huntingtons disease detector. Huntingtons disease is an inherited and fatal neurological disorder. Although there is currently no cure, in 1993 scientists discovered a very accurate
- Huntingtons disease detector. Huntingtons disease is an inherited and fatal neurological disorder. Although there is currently no cure, in 1993 scientists discovered a very accurate genetic test. The gene that causes Huntingtons disease is located on chromosome 4 and has a variable number of (consecutive) repeats of the CAG trinucleotide. The normal range of CAG repeats is between 10 and 35. Individuals with Huntingtons disease have between 36 and 180 repeats. Doctors can use a PCR-based DNA test; count the maximum number of repeats; and use the following table to generate a diagnosis:
repeats diagnosis 09 not human 1035 normal 3639 high risk 40180 Huntingtons 181 not human Write a program
Huntingtons.java
to analyze a DNA string for Huntingtons disease and produce a diagnosis. To do so, implement the following public API:
Here is some more information about the required behavior:public class Huntingtons { // Returns the maximum number of consecutive repeats of CAG in the DNA string. public static int maxRepeats(String dna) // Returns a copy of s, with all whitespace (spaces, tabs, and newlines) removed. public static String removeWhitespace(String s) // Returns one of these diagnoses corresponding to the maximum number of repeats: // "not human", "normal", "high risk", or "Huntington's". public static String diagnose(int maxRepeats) // Sample client (see below). public static void main(String[] args) }
- Maximum CAG repeats. We recommend that you use the
substring()
,equals()
, andlength()
methods from theString
library. - Remove whitespace. We recommend that you use the
replace()
method from theString
library. Use\t
to specify a tab character. - Performance requirement. The
maxRepeats()
andremoveWhitespace()
methods must take time linear in the length of the string. - Sample client. The
main()
method should- Take the name of a file as a command-line argument.
- Read the genetic sequence from the file using the
In
class. - Remove any whitespace (spaces, tabs, and newlines).
- Count the number of CAG repeats.
- Print a medical diagnosis in the format below.
- Input format. The file format is a sequence of nucleotides (A, C, G, and T), with arbitrary amounts of whitespace separating the nucleotides. The data files repeats4.txt, repeats64.txt, chromosome4-hd.txt, and chromosome4-healthy.txt, are in the specified format.
Here are a few sample executions:
~/Desktop/oop1> cat repeats4.txt TTTTTTTTTT TTTTTTTTTT TTTTTTTTCAGCAGCAGCAG TTTCAGCAGT TTTTTTTTTT TTTTTTTTTT TTTTTTTTTT TTTTTTTTTTTTTCAGTTTT TTTTTTTTTT T ~/Desktop/oop1> java-introcs Huntingtons repeats4.txt max repeats = 4 not human ~/Desktop/oop1> cat repeats64.txt TTTTTTTTTT TTTTTTTTTT TTTTTTTTTT TTTTTTTTTT TTTTTTTTTT TTCAGCAGCA GCAGCAGCAG CAGCAGCAGC AGCAGCAGCA GCAGCAGCAG CAGCAGCAGC AGCAGCAGCA GCAGCAGCAG CAGCAGCAGC AGCAGCAGCA GCAGCAGCAG CAGCAGCAGC AGCAGCAGCA GCAGCAGCAG CAGCAGCAGC AGCAGCAGCA GCAGCAGCAG CAGCAGCAGC AGCAGCAGCA GCAGTTTTTT TTTTTTTTTT TTTTTTTTTT TTTTTTTTTT TTTTTTTTTT TTTTTTTTTT ~/Desktop/oop1> java-introcs Huntingtons repeats64.txt max repeats = 64 Huntington's ~/Desktop/oop1> java-introcs Huntingtons chromosome4-hd.txt max repeats = 79 Huntington's ~/Desktop/oop1> java-introcs Huntingtons chromosome4-healthy.txt max repeats = 19 no Huntington's
- Maximum CAG repeats. We recommend that you use the
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started