Create five functions and A formatted table (which was displayed to the screen) of the sorted list (from lightest to heaviest) which contains the amino acid name (left hand justified), the molecular weight, and the chemical formula as shown in the ex

1 view (last 30 days)
You are given a data file called aminoacids.dat containing a table of amino acids and their constituent molecular compositions. The file contains columns that hold the amino acid name, # of carbon atoms, # of hydrogen atoms, # of oxygen atoms, # of nitrogen atoms and the # of sulfur atoms as shown below, AminoAcid,C,H,O,N,S Alanine,3,7,2,1,0 Arginine,6,15,2,4,0 Asparagine,4,8,3,2,0 Aspartic,4,6,4,1,0 Cysteine,3,7,2,1,1 Glutamic,5,8,4,1,0 Glutamine,5,10,3,2,0 Glycine,2,5,2,1,0 Histidine,6,10,2,3,0 Isoleucine,6,13,2,1,0 Leucine,6,13,2,1,0 Lysine,6,15,2,2,0 Methionine,5,11,2,1,1 Phenylanlanine,9,11,2,1,0 Proline,5,10,2,1,0 Serine,3,7,3,1,0 Threonine,4,9,3,1,0 Tryptophan,11,11,2,2,0 Tyrosine,9,11,3,1,0 Valine,5,11,2,1,0 You also have another data file called elements.dat that contains a list of element symbols (a single character) and atomic weights for the necessary elements: hydrogen, carbon, nitrogen, oxygen, and sulfur. This file has the format: H,1.00794 C,12.011 N,14.00674 O,15.9994 S,32.066 Use MATLAB to complete the following task: 1. Create a function called read_data_files to read in these two data files. Use a low level formatted I/O fgetl function to read the data. Put the results into two structures (one for the amino acid structure and one for the element data) The fieldnames for amino should be name, elem, mass and for element are elem, mw. 2. Create a function called calc_molec_wt to determine the molecular weights of the individual amino acids. The result is put into the amino acid structure. 3. Create a function called sort_data to sort the amino acids by weight (use MATLAB’s sort function). Put the results back into the amino acid structure. 4. Create a function called average_amino_acid to determine the average amino weight and determine which of these amino acids is closest to that weight. Put the amino acid weights back into the amino acid structure. 5. Create a function called output_data to produce a table of the results as shown below. The following tasks are required: (a) Within this function, create a sub-function to put together a string that contains the molecular formula. (b) This function will print the table to the screen (formatted) and output it to a file named aminoacids.out using fprintf. (c) This function will also display the average molecular weight and the name of the amino acid that is closest to this average weight to the screen. The functions listed above have the following input and output parameters Refer to attached table..
The report is to include: 1. A formatted table (which was displayed to the screen) of the sorted list (from lightest to heaviest) which contains the amino acid name (left hand justified), the molecular weight, and the chemical formula as shown in the example output below. 2. The average molecular weight and report which amino acid is closest to this average weight (as shown below). 3 ENCP 100: Engineering Programming # Amino Acid Molecular Weight Molecular Formula 01 amino_acid_name xxx.xx CxHxOxNxSx 02 amino_acid_name xxx.xx CxHxOxNxSx .... .... .... 19 amino_acid_name xxx.xx CxHxOxNxSx 20 amino acid name xxx.xx CxHxOxNxSx The average molecular weight of the amino acids: xxx.xx The amino acid closest to the average weight : amino acid name Note: Other than the clear all and clc commands, and various comments in your code, your main program may only contain calls to your functions!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!