Question

Use python 2.7 to write this code: This code takes in a bunch of protein sequences...

Use python 2.7 to write this code: This code takes in a bunch of protein sequences as input listed below and tracks the highest average TM value (number under each protein) and If a protein has the highest TM value of all proteins found so far, track it. At the very end, the program should print out that as well:

For example, at the very end when run, it should print something like this:

Protein with the highest TM value: Protein 18: MFFFFKK...|

Average TM value:   0.6

test code to run the code:

AverageTMValues=

protein 1:'MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR'

aveTMValue:0.6

protein2:'MARKCSVPLVMAWLTWTTSRAPLPH',

aveTMValue: 0.5

protein3:'MPWPTSITXXXXXXSWSPEWLSSGLRSILGWEQPRVSHKGHSHEWHRRP'

aveTMValue:0.1

protein4: 'MAVLHAGRLHVSADRAGLPHQLPHALRHRPAQEAAHASQLHPAQPSRG'

aveTMValue:0.5

HighestAverageTMvalue=highestAveTMValue(AverageTMValues)

The code should output/print out: (it should also print out the protein corresponding with the highest TM value)

protein 1:'MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR'

aveTMValue:0.6

clearly show work and run it. THANK YOU a ton!!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Screenshot

#Function to find highest average TM value from the passed list e C:\WINDOWS\system32\cmd.exe def highestAve TMValue (Average

Program

#Function to find highest average TM value from the passed list
def highestAveTMValue(AverageTMValues):
    #index start
    i=1
    #result index
    index=i
    #set highest TM
    avg=float(AverageTMValues[i].split(':')[1])
    #Loopuntil end of the list
    while(i<len(AverageTMValues)):
        #Compare average with eac protein averages in the list
        #Accordingly change index and average
        if(avg<float(AverageTMValues[i].split(':')[1])):
            avg=float(AverageTMValues[i].split(':')[1])
            index=i
        i=i+2
    #Return protein details
    return AverageTMValues[index-1]+"\n"+AverageTMValues[index]
#Test list
AverageTMValues=["protein 1:'MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR'","aveTMValue:0.6",
"protein2:'MARKCSVPLVMAWLTWTTSRAPLPH'","aveTMValue:0.5",
"protein3:'MPWPTSITXXXXXXSWSPEWLSSGLRSILGWEQPRVSHKGHSHEWHRRP'","aveTMValue:0.1",
"protein4:'MAVLHAGRLHVSADRAGLPHQLPHALRHRPAQEAAHASQLHPAQPSRG'","aveTMValue:0.5"]
#Call method
HighestAverageTMvalue=highestAveTMValue(AverageTMValues)
#Display result
print(HighestAverageTMvalue)

Output

protein 1:'MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR'
aveTMValue:0.6

Add a comment
Know the answer?
Add Answer to:
Use python 2.7 to write this code: This code takes in a bunch of protein sequences...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • USE Python 1. Assign value 555 to the variable x, write code to square the variable...

    USE Python 1. Assign value 555 to the variable x, write code to square the variable x and print out the result. 2. Given a string x, write a program to check if its first character is the same as its last character. If yes, the code should output "True" . 3. We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate the two numbers (the result should be 'Python3.0').

  • Write a python program where you create a list (you an create it in code you...

    Write a python program where you create a list (you an create it in code you do not have to use input() statements) that represents the total rainfall for each of 12 months (assume that element 0 is January and element 11 is December). The program should calculate and display the: 1) total rainfall for the year; 2) the average monthly rainfall; 3) the months with the highest and lowest amounts. You need to figure out how to access each...

  • Write python code on computer, No handwritten code You will implement a program which asks the...

    Write python code on computer, No handwritten code You will implement a program which asks the user to enter scores of different courses in different semesters. The program should read the input and output some simple statistics 1. An example input string by the user is given below. Fal12016-coursel:82, course2:80,course3:85;Spring2018- course4:82;Fall2018-course5:85, course6:50, course7:78 Info from different semesters are separated by a ";", courses in each semester are separated by a,and score and corresponding course is separated by a, information of...

  • Write a Python class called polynomial that represents a polynomial in the following fashion, The initializer...

    Write a Python class called polynomial that represents a polynomial in the following fashion, The initializer of your polynomial class will be designed to take any number of numeric coefficients, The coefficient with the highest power will be the first coefficient. The last coefficient will be the constant value, that is, the value that is associated with . power 0. • Therefore, the number of the coefficients specified will directly indicate the highest power of the polynomial to be represented....

  • Use python to code! Q1 - You need to keep track of book titles. Write code...

    Use python to code! Q1 - You need to keep track of book titles. Write code using function(s) that will allow the user to do the following. 1. Add book titles to the list. 2. Delete book titles anywhere in the list by value. 3. Delete a book by position. Note: if you wish to display the booklist as a vertical number booklist , that is ok (that is also a hint) 4. Insert book titles anywhere in the list....

  • Python please help! Thanks you Write a code to get an unlimited number of grades from...

    Python please help! Thanks you Write a code to get an unlimited number of grades from the user (the user can press enter to finish the grades input, or use a sentinel, for example-1), and then calculate the GPA of all the grades and displays the GPA To do this you might need some help. Try to follow the following process (and check your progress by printing different values to make sure they are as they supposed to be): 1-...

  • Python GPA calculator: Assume the user has a bunch of courses they took, and need to...

    Python GPA calculator: Assume the user has a bunch of courses they took, and need to calculate the overall GPA. We will need to get the grade and number of units for each course. It is not ideal to ask how many courses they took, as they have to manually count their courses. Programming is about automation and not manual work. We will create a textual menu that shows 3 choices. 1. Input class grade and number of units. 2....

  • how to make my code of python work probely my q is how to write a...

    how to make my code of python work probely my q is how to write a code to find the average actual water level, average error by using python and my program should be flexible where user can select the column no. If you can see in the main program, it asked which column to know the maximum or average, the column number is passed to the function. The function should look which column to do. #THIS PROGRAMMING IS ABLE...

  • Please answere using python language codes. Write a program to print out Collatz sequence for a...

    Please answere using python language codes. Write a program to print out Collatz sequence for a user-supplied number. Prompt the user for a positive integer which will become the first number in the sequence. Next number in the sequence is derived as follows: If previous number is odd, the next number is 3 times the previous, plus 1. If previous number is even, the next number is half of the previous According to Collatz proposition, the sequence ultimately reaches 1...

  • Could anyone help add to my python code? I now need to calculate the mean and...

    Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT