QuestionQuestion

The information content of the molecule DNA can be represented in computer programs as a sequence of the letters A, C, G, and T. As DNA is passed down from generation to generation, the sequence of letters is usually faithfully replicated, but sometimes errors occur either during replication or in the course of a lifetime, so that the sequence has changed. If an error occurs in a germ cell line and is passed on to progeny, this is termed a mutation. The accumulation of mutations over generations helps to drive evolution.
Write a program to simulation mutation by starting with an input sequence of letters of arbitrary length up to a maximum of 80 and then for 25 generations randomly choose one letter for mutation. There should be an equal probability for a letter to be chosen, and an equal probability for which of the four letters it could become.
Your program should print the original sequence, and then the 25 resulting sequences. If it should happen that two adjacent sequences are identical, you should print an asterisk at the end of the second of the two sequences.
At the end of the output, you should print an asterisk below the column of any letter that did not change during the course of the simulation.
An example run of the program should appear like this:
$ java Student
Enter a DNA sequence up to 80 bp:
ATTCGGCTA
ATTCGGCTA
ATCCGGCTA
ATCCGTCTA
ATCCGTCTA *
...ATCCGTCTT
AACCGTCTT
AATCGTCTT
* ** **
You should not print the ellipses, of course, but rather the entire 26 lines of output.
Use an array of characters for this program. Do not use ArrayLists or strings. Write methods as necessary, and follow all the rules of the style guide.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;


public class Mutation {

public static void mutationSimulation(char[] sequence)
{
int size = sequence.length;
boolean[] change = new boolean[size];
for(int i = 0 ;i < 0; i++)
change[i] = false;
char[] letters = {'A', 'C', 'G', 'T'};
System.out.println(sequence);
for(int i = 0; i < 25; i++)
{
int position = (int)(Math.random()*size);...

By purchasing this solution you'll be able to access the following files:
Mutation.java.

50% discount

Hours
Minutes
Seconds
$10.50 $5.25
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats