Stage 1 (max score 80) Write a python script that prompts for .The name of a FAS
ID: 3598296 • Letter: S
Question
Stage 1 (max score 80) Write a python script that prompts for .The name of a FASTA formatted file4 containing a protein sequence * The name of an amino acid hydrophobicity table The script should read the protein sequence from the FASTA file, and read the hydrophobicity table. The hydrophobicity table associates each of the 20 standard amino acids with a hydrophobicity value (see hydropathy_table.txt for arn example). Use the hydrophobicity table to calculate the average of the hydrophobicity values over all amino acids in the protein. Also, calculate the average net charge of the protein. The equation for net charge uses the counts of aspartic acids (count_D), glutamic acids (count_E), lysines (count_K), arginines (count R), and histidines (count_H) in the sequence: net charge count_K+count_R +0.5 * count H - count D - count_E The average net charge is net charge divided by the protein length. Use the calculated average hydrophobicity (HD) and net charge (CH) values to predict whether a protein is extended or collapsed using the equation given in the background The script should output 4 values. Label each. Floating-point numbers should have at least 3 significant digits. Order is not important Average hydrophobicity Average net charge The value of the extended-collapsed equation (prediction) The class of the protein: 'extended' if prediction 2 0.5, 'collapsed' if predictionExplanation / Answer
class Vector(tuple): '''"Class to calculate the usual operations with vectors in bi and tridimensional coordinates. Too with n-dimmensinal.''' # __slots__=('V') #It's not possible because V is a variable list of param. def __new__(cls, *V): '''The new method, we initialize the coordinates of a vector. You can initialize a vector for example: V = Vector() or V = Vector(a,b) or V = Vector(v1, v2, ..., vn)''' if not V: V = (0, 0) elif len(V) == 1: raise ValueError('A vector must have at least 2 coordinates.') return tuple.__new__(cls, V) def __add__(self, V): '''The operator sum overloaded. You can add vectors writing V + W, where V and W are two vectors.''' if len(self) != len(V): raise IndexError('Vectors must have same dimmensions.') else: added = tuple(a + b for a, b in zip(self, V)) return Vector(*added) __radd__ = __add__ def __sub__(self, V):
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.