1. Homepage
  2. Programming
  3. COSI 12B Advanced Programming Techniques in Java - Programming Assignment 2: DNA

COSI 12B Advanced Programming Techniques in Java - Programming Assignment 2: DNA

Engage in a Conversation
USBrandeis UniversityCOSI 12BAdvanced Programming Techniques in JavaDNAComputer Science 12BJava

PROGRAMMING ASSIGNMENT 2

DNA

Program Description:

This assignment focuses on arrays and file/text processing. Your project should contain a file named DNA.java. You will also need the two input files dna.txt and ecoli.txt in the same project. CourseNana.COM

The assignment involves processing data from genome files. Your program should work with the two given input files. CourseNana.COM

Important: You are limited to language features discussed in Chapters 1 through 7, or up to lecture 7 (without the Object-Oriented Programming part). Please read and follow the standard Google Java Style Guide posted on Latte. CourseNana.COM

For now, focus on guidelines related to: • names of local variables, methods, etc. CourseNana.COM

  • when to use camelCase, vs. UpperCamelCase, vs. ALL_CAPS • curly braces • indentation • comments: at the beginning of your program; on each method; and on complex sections of code

Background Information About DNA:

Note: This section explains some information from the field of biology that is related to this assignment. It is for your information only; you do not need to fully understand it to complete the assignment. CourseNana.COM

Deoxyribonucleic acid (DNA) is a complex biochemical macromolecule that carries genetic information for cellular life forms and some viruses. DNA is also the mechanism through which genetic information from parents is passed on during reproduction. DNA consists of long chains of chemical compounds called nucleotides. Four nucleotides are present in DNA: Adenine (A), Cytosine (C), Guanine (G), and Thymine (T). DNA has a double-helix structure (see diagram below) containing complementary chains of these four nucleotides connected by hydrogen bonds. Certain regions of the DNA are called genes. Most genes encode instructions for building proteins (they're called "protein-coding" genes). These proteins are responsible for carrying out most of the life processes of the organism. CourseNana.COM

Nucleotides in a gene are organized into codons. Codons are groups of three nucleotides and are written as the first letters of their nucleotides (e.g., TAC or GGA). Each codon uniquely encodes a single amino acid, a building block of proteins. CourseNana.COM

The process of building proteins from DNA has two major phases called transcription and translation, in which a gene is replicated into an intermediate form called mRNA, which is then processed by a structure called a ribosome to build the chain of amino acids encoded by the codons of the gene CourseNana.COM

DNA translation The chemical structure of DNA CourseNana.COM

The sequences of DNA that encode proteins occur between a start codon (which we will assume to be ATG) and a stop codon (which is any of TAA, TAG, or TGA). Not all regions of DNA are genes; large portions that do not lie between a valid start and stop codon are called intergenic DNA and have other (possibly unknown) function. Computational biologists examine large DNA data files to find patterns and important information, such as which regions are genes. Sometimes they are interested in the percentages of mass accounted for by each of the four nucleotide types. Often high percentages of Cytosine (C) and Guanine (G) are indicators of important genetic data. For more information, visit the Wikipedia page about DNA: http://en.wikipedia.org/wiki/DNA In this assignment you read an input file containing named sequences of nucleotides and produce information about them. For each nucleotide sequence, your program counts the occurrences of each of the four nucleotides (A, C, G, and T). The program also computes the mass percentage occupied by each nucleotide type, rounded to one digit past the decimal point. Next the program reports the codons (trios of nucleotides) present in each sequence and predicts whether or not the sequence is a protein-coding gene. For us, a protein-coding gene is a string that matches all of the following constraints*: CourseNana.COM

  • begins with a valid start codon (ATG)
  • ends with a valid stop codon (one of the following: TAA, TAG, or TGA)
  • contains at least 5 total codons (including its initial start codon and final stop codon)
  • Cytosine (C) and Guanine (G) combined account for at least 30% of its total mass

(*These are approximations for our assignment, not exact constraints used in computational biology to identify proteins.) CourseNana.COM

The DNA input data consists of line pairs. The first line has the name of the nucleotide sequence, and the second is the nucleotide sequence itself. Each character in a sequence of nucleotides will be A, C, G, T, or a dash character, "-". The nucleotides in the input can be either upper or lowercase. Input file dna.txt (partial): CourseNana.COM

cure for cancer protein
ATGCCACTATGGTAG
captain picard hair growth protein
ATgCCAACATGgATGCCcGATAtGGATTgA
bogus protein
CCATt-AATgATCa-CAGTt
...

The dash "-" characters represent "junk" or "garbage" regions in the sequence. For most of the program they should be ignored in your computations, though they do contribute to the total mass of the sequence as described later. CourseNana.COM

Program Behavior:

Your program begins with an introduction and prompts for input and output file names. You may assume the user will type the name of an existing input file that is in the proper format. Your program reads the input file to process its nucleotide sequences and outputs the results into the given output file. Notice the nucleotide sequence is output in uppercase, and that the nucleotide counts, and mass percentages are shown in A, C, G, T order. A given codon such as GAT might occur more than once in the same sequence. CourseNana.COM

Log of execution (user input underlined):

This program reports information about DNA
nucleotide sequences that may encode proteins.
Input file name? dna.txt
Output file name? output.txt

Output file output.txt after above execution (partial):

Region Name:
Nucleotides:
Nuc. Counts:
Total Mass%:
Codons List:
Is Protein?:

cure for cancer protein
ATGCCACTATGGTAG
[4, 3, 4, 4]
[27.3, 16.8, 30.6, 25.3] of 1978.8
[ATG, CCA, CTA, TGG, TAG]
YES

Region Name:
Nucleotides:
Nuc. Counts:
Total Mass%:

captain picard hair growth protein
ATGCCAACATGGATGCCCGATATGGATTGA
[9, 6, 8, 7]
[30.7, 16.8, 30.5, 22.1] of 3967.5

Codons List: [ATG, CCA, ACA, TGG, ATG, CCC, GAT, ATG, GAT, TGA]
Is Protein?: YES
Region Name:
Nucleotides:
Nuc. Counts:
Total Mass%:
Codons List:
Is Protein?:

bogus protein
CCATT-AATGATCA-CAGTT
[6, 4, 2, 6]
[32.3, 17.7, 12.1, 29.9] of 2508.1
[CCA, TTA, ATG, ATC, ACA, GTT]
NO

Implementation Guidelines, Hints, and Development Strategy:

The main purpose of this assignment is to demonstrate your understanding of arrays and array traversals. Therefore, you should use arrays to store the various data for each sequence. In particular, your nucleotide counts, mass percentages, and codons should all be stored using arrays. Additionally, you should use arrays and for loops to transform the data from one form to another as follows: • from the original nucleotide sequence string to nucleotide counts; • from nucleotide counts to mass percentages; • from the original nucleotide sequence string to codon triplets. These transformations are summarized by the following diagram using the "cure for cancer" protein data: CourseNana.COM

Nucleotides:
Counts:

"ATGCCACTATGGTAG"

What is computed
{4, 3, 4, 4}

Mass %: {27.3, 16.8, 30.6, 25.3}
Codons: {ATG, CCA, CTA, TGG, TAG}

Output to file
Nuc. Counts: [4, 3, 4, 4]
Total Mass%: [27.3, 16.8, 30.6, 25.3] of 1978.8

Codons List: [ATG, CCA, CTA, TGG, TAG]
Is protein?: YES

Recall that you can print any array using the method Arrays.toString. For example: int[] numbers = {10, 20, 30, 40}; CourseNana.COM

System.out.println("my data is " + Arrays.toString(numbers)); // my data is [10, 20, 30, 40] CourseNana.COM

To compute mass percentages, use the following as the mass of each nucleotide (grams/mol). The dashes representing "junk" regions are excluded from many parts of your computations, but they do contribute mass to the total. CourseNana.COM

• Adenine (A): 135.128 • Cytosine (C): 111.103 • Guanine (G): 151.128 • Thymine (T): 125.107 • Junk (-): 100.000 CourseNana.COM

For example, the mass of the sequence ATGG-AC is (135.128 + 125.107 + 151.128 + 151.128 + 100.000 + 135.128 + 111.103) or 908.722. Of this, 270.256 (29.7%) is from the two Adenines; 111.103 (12.2%) is from the Cytosine; 302.256 (33.3%) is from the two Guanines; 125.107 (13.8%) is from the Thymine; and 100.000 (11.0%) is from the "junk" dash. CourseNana.COM

We suggest that you start this program by writing the code to read the input file. Try writing code to simply read each protein's name and sequence of nucleotides and print them. Read each line from the input file using Scanner’s nextLine method. This will read an entire line of input and return it as a String. CourseNana.COM

Next, write code to pass over a nucleotide sequence and count the number of As, Cs, Gs, and Ts. Put your counts into an array of size 4. To map between nucleotides and array indexes, you may want to write a method that converts a single character (i.e. A, C, T, G) into indices (i.e. 0 to 3). CourseNana.COM

Once you have the counts working correctly, you can convert your counts into a new array of percentages of mass for each nucleotide using the preceding nucleotide mass values. If you've written code to map between nucleotide letters and array indexes, it may also help you to look up mass values in an array such as the following: double[] masses = {135.128, 111.103, 151.128, 125.107}; CourseNana.COM

You may store your mass percentages already rounded to one digit past the decimal or you can round when printing the mass percentages array using printf. If you choose to store the percentages pre-rounded, use Math.round. CourseNana.COM

Remember that the "junk" dashes do contribute mass to the total. For other parts of your program, you may want to remove dashes from the input. CourseNana.COM

After computing mass percentages, you must break apart the sequence into codons and examine each codon. The only String methods you are allowed to use are substring, charAt, toUpperCase, and toLowerCase, length. CourseNana.COM

We also suggest that you first get your program working correctly printing its output to the console before you save the output to a file. Once you have your program printing correct output to the console, save the output to a file by using a PrintStream. CourseNana.COM

You may assume that the input file exists, is readable, and contains valid input. (In other words, you should not re-prompt for input or output file names.) You may assume that each sequence's number of nucleotides (without dashes) will be a multiple of 3, although the nucleotides on a line might be in either uppercase or lowercase or a combination. Your program should overwrite any existing data in the output file (this is the default PrintStream behavior). CourseNana.COM

Style Guidelines: For this assignment you are required to have the following four class constants: CourseNana.COM

  • one for the minimum number of codons a valid protein must have, as an integer (default of 5)
  • a second for the percentage of mass from C and G in order for a protein to be valid, as an integer (default of 30)
  • a third for the number of unique nucleotides (4, representing A, C, G, and T)
  • a fourth for the number of nucleotides per codon (3)

For full credit it should be possible to change the first two constant values (minimum codons and minimum mass percentage) and cause your program to change its behavior for evaluating protein validity. The other two constants won't ever be changed but are still useful to make your program more readable. Refer to these constants in your code and do not refer to the bare number such as 4 or 3 directly. Do not use any other constants in your program besides the ones above. Modularity is very important use at least four nontrivial static methods besides main. These methods should use parameters and returns, including arrays, as appropriate. The methods should be well-structured and avoid redundancy. No one method should do too large a share of the overall task. CourseNana.COM

In particular, we require that you have the following particular method in your program: CourseNana.COM

A method to print all file output for a given potential protein (nucleotides, counts, %, is it a protein, etc.) CourseNana.COM

In other words, all output to the file should be done through one method called on each nucleotide sequence from the input. Your other methods should do the computations to gather information to be passed to this output method. Your main method should be a concise summary of the overall program. It is okay for main to contain some code such as println statements. But main should not perform too large a share of the overall work itself, such as examining each character of an input line. Also avoid "chaining," when many methods call each other without ever returning to main. We will also check strictly for redundancy on this assignment. If you have a very similar piece of code that is repeated several times in your program, eliminate the redundancy such as by creating a method, by using for loops over the elements of arrays, and/or by factoring if/else code. Since arrays are a key component of this assignment, part of your grade comes from using arrays properly. For example, you should reduce redundancy as appropriate by using traversals over arrays (for loops over the array's elements). This is preferable to writing out a separate statement for each array element (a statement for element [0], then another for [1], then for [2], etc.). Also carefully consider how arrays should be passed as parameters and/or returned from methods as you are decomposing your program. Recall that arrays use reference semantics when passed as parameters, meaning that an array passed to a method can be modified by that method and the changes will be seen by the caller. Follow past style guidelines such as indentation, names, variables, types, line lengths, and comments (at the beginning of your program, on each method, and on complex sections of code). CourseNana.COM

Submission:

Your Java source code (program) should be submitted via Latte the day it is due. CourseNana.COM

For this assignment, you are required to use the Eclipse IDE. Use Eclipse (Refactor > Rename) to name your project Lastname_FirstnamePA2 (please make sure to use exactly this file name, including identical capitalization). Then use Eclipse’s export procedure; otherwise, a penalty will be applied, as our automated tests will fail to function. CourseNana.COM

A step-by-step guideline for exporting and importing with Eclipse is provided in the slides for Recitation 1. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
US代写,Brandeis University代写,COSI 12B代写,Advanced Programming Techniques in Java代写,DNA代写,Computer Science 12B代写,Java代写,US代编,Brandeis University代编,COSI 12B代编,Advanced Programming Techniques in Java代编,DNA代编,Computer Science 12B代编,Java代编,US代考,Brandeis University代考,COSI 12B代考,Advanced Programming Techniques in Java代考,DNA代考,Computer Science 12B代考,Java代考,UShelp,Brandeis Universityhelp,COSI 12Bhelp,Advanced Programming Techniques in Javahelp,DNAhelp,Computer Science 12Bhelp,Javahelp,US作业代写,Brandeis University作业代写,COSI 12B作业代写,Advanced Programming Techniques in Java作业代写,DNA作业代写,Computer Science 12B作业代写,Java作业代写,US编程代写,Brandeis University编程代写,COSI 12B编程代写,Advanced Programming Techniques in Java编程代写,DNA编程代写,Computer Science 12B编程代写,Java编程代写,USprogramming help,Brandeis Universityprogramming help,COSI 12Bprogramming help,Advanced Programming Techniques in Javaprogramming help,DNAprogramming help,Computer Science 12Bprogramming help,Javaprogramming help,USassignment help,Brandeis Universityassignment help,COSI 12Bassignment help,Advanced Programming Techniques in Javaassignment help,DNAassignment help,Computer Science 12Bassignment help,Javaassignment help,USsolution,Brandeis Universitysolution,COSI 12Bsolution,Advanced Programming Techniques in Javasolution,DNAsolution,Computer Science 12Bsolution,Javasolution,