Answered step by step
Verified Expert Solution
Link Copied!

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

  1. 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:

    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) } 
    Here is some more information about the required behavior:

    • Maximum CAG repeats. We recommend that you use the substring(), equals(), and length() methods from the String library.

    • Remove whitespace. We recommend that you use the replace() method from the String library. Use to specify a newline character and \t to specify a tab character.

    • Performance requirement. The maxRepeats() and removeWhitespace()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 

image text in transcribed
disese is becated on chromotome 4 and bus a varible number of (cossersive) arpeas, ard pe the fotlowidy tatic to generate a diagnois; Write a peornm Acnt is gteos - fara to mabwe \& DVA strisg fer Huretington' prblic elea tantingtens of publie atatie int maxilepentarstring dne) publie statie string reeoweihitespacedburing s) gublie makie string diagtane(int natcpeato) publie statse vedi maindstringij args? 1 Alse is baw now informalian about ithe mquind toheviar - Mavievw CAC negows, We kicunmend the yeu ase the suba triagid. eqaedac ( ) atal lengehi) methoda fiam the steriey larary. from the Atrina litrary. the in so quevily a ow liee durater and is to igecify a ub charaner. methoda mas ake time linew in the lengit of the atieng. - Sinupde ation The asinel metbod should - Hrad de gradis apqonse bran the file hoay dee inelin- - Mamene are wtiteryare opsoes, abs, and sewloest - Count the number of CAO repeati. - Prat a acedical diagavio at tes format below. bality EXL are in the apecifinat firmot. Here are a few sinple enecutisn: nas vepata = 4 a3: cecters =64 tursagnat 'v. eas inficata =10 wand wgrea's Aas aspars o 14 a Hatingros. 5

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions