Question: PYTHON Q1 ) I have a homework where I should convert a 4 lenght protein sequence to an integer using ASCII and applying this formula.

PYTHON

Q1 ) I have a homework where I should convert a 4 lenght protein sequence to an integer using ASCII and applying this formula. Each protein sequences can be converted into an integer value by multiplying the ASCII value of its right most character by 1280, that its second right most character by 1281, etc, and then adding up the resulting 4 values (The ASCII value for A = 65, B = 66, C = 67, , Y = 89.)

For example the integer value for the sequence AFDE is:

(65 1283) + (70 1282) + (68 1281) + (69 1280) = 137470533

I've solved this one by doing this (input from user)

def string_int(my_str): num = [ord(c) for c in my_str] to_int = num[0]*128**3 + num[1]*128**2 + num[2]*128 + num[3] return int 

Q2) convert a given integer into a protein sequence of length 4 (example input: 21408712 the output(example): ADER

Q3) convert the protein sequences form a text file test.txt (contains 1000 protein sequence) into their respective integers and store them into a direct addressing table. A sample from the text file: AAQV AAYA ACFA ACHQ ACTS AETA AETQ AFCV AFNA AGGI

And then write a method to search a given protein sequence from the direct addressing table.

Q4) convert the protein sequences form the same text file "test.txt into their respective integers and store them into a hash table with chaining using a linked list to store a chain.

using a division function: h(k) = k mod m

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!