Question

In: Computer Science

USE Python 2.7(screen shot program with output) the task is: takes in a list of protein...

USE Python 2.7(screen shot program with output)

the task is: takes in a list of protein sequences as input and finds all the transmembrane domains and returns them in a list for each sequence in the list with given nonpolar regions and returns the lists for those.

1. This code should call two other functions that you write: regionProteinFind takes in a protein sequence and should return a list of 10 amino acid windows, if the sequence is less than 10 amino acids, it should just return that sequence. (initially it should grab amino acids 1-10…the next time it is called it should grab amino acids 2-11…) for each sequence in the list.

testcode:

"protein='MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR''

the regionProteinFind returns:['MKLVVRPWAG','KLVVRPWAGC','LVVRPWAGCW','VVRPWAGCWW','VRPWAGCWWS','RPWAGCWWST','PWAGCWWSTL','WAGCWWSTLG','AGCWWSTLGP','GCWWSTLGPR',
'CWWSTLGPRG','WWSTLGPRGS','WSTLGPRGSL','STLGPRGSLS','TLGPRGSLSP','LGPRGSLSPL','GPRGSLSPLG','PRGSLSPLGI','RGSLSPLGIC','GSLSPLGICP','SLSPLGICPL','LSPLGICPLL','SPLGICPLLM','PLGICPLLML','LGICPLLMLL','GICPLLMLLW','ICPLLMLLWA','CPLLMLLWAT','PLLMLLWATL','LLMLLWATLR']

2nd testcode;

protein=MP

region protein sequence should return: ['ME']

2. A second function called testForTM , which should calculate and return the decimal fraction of ten amino acid window which are nonpolar for each sequence in the list. the nonpolar regions are (A,V,L,I,P,M,F,W). my code for this is:

def testForTM(AAWindow):
totalNP= 0
nonPolarList=['A', 'V', 'L', 'I', 'P', 'M', 'F', 'W']
for aa in AAWindow:   
if aa in nonPolarList:   
totalNP+=1
return totalNP/10.0 #THIS SHOULD DEVIDE BY len(AAWindow) so it works for sequences less than 10 length like 'MP'

3. The last function,tmSCANNER should call the get protein region and test for TM and Ultimately, as a result the code should be used to scan each protein sequence in the list as input generating list of numbers of non polar for each protein sequence which measures the fraction of nonpolar residues in each 10bp window(it slides 10 amino acids at a time until it is at the last aa window of a protein sequence with any length and give the lists for those. The code should output what is displayed below.

#Test code for TMFinder

input=> listOfProtein=['MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR', 'MARKCSVPLVMAWLTWTTSRAPLPH', 'MPWPTSITXXXXXXSWSPEWLSSGLRSILGWEQPRVSHKGHSHEWHRRP']

tmValuesList=TMFinder(listOfProtein)

print 'The list of TM values are:', tmValuesList

as a result it should print out this list:

["protein 1:'MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR'", 'TMValue:[0.7, 0.6, 0.7, 0.7, 0.6, 0.5, 0.6, 0.5, 0.5, 0.4, 0.4, 0.4, 0.4, 0.3, 0.4, 0.5, 0.4, 0.5, 0.4, 0.5, 0.6, 0.7, 0.7, 0.8, 0.8, 0.8, 0.9, 0.8, 0.9, 0.8]',"protein2:'MARKCSVPLVMAWLTWTTSRAPLPH'", 'TMValue:[0.6, 0.6, 0.6, 0.7, 0.8, 0.8, 0.9, 0.8, 0.7, 0.6, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]',"protein3:'MPWPTSITXXXXXXSWSPEWLSSGLRSILGWEQPRVSHKGHSHEWHRRP'",'TMValue:[0.5, 0.4, 0.3, 0.2, 0.1, 0.1, 0.2, 0.1, 0.2, 0.2, 0.3, 0.4, 0.4, 0.4, 0.4, 0.5, 0.4, 0.4, 0.4, 0.5, 0.4, 0.4, 0.4, 0.4, 0.5, 0.4, 0.5, 0.5, 0.4, 0.3, 0.3, 0.2, 0.2, 0.2, 0.1, 0.2, 0.1, 0.1, 0.1]']

This is time sensitive.Thank you for the help!!!

Solutions

Expert Solution

Please save the following code in ProteinList.py and run

# Program starts here

  
class ProteinList():   
def __init__(self, prot) :
self.protein = prot   
  
# It splits the protein into 10 amino acid windows.
def regionProteinFind(self) :
if len(self.protein) <= 10 :
return self.protein
region = ['' for i in range(len(self.protein)-9)]
for i in range(len(self.protein)-9) :
region[i] = self.protein[i:i+10]
# print(region)
return region
  
# calculate and return the decimal fraction of ten amino acid window which are
# nonpolar for each sequence in the list
def testForTM(self, region):
totalNP = 0
nonPolarList = ['A', 'V', 'L', 'I', 'P', 'M', 'F', 'W']
for i in range(len(region)) :   
if region[i:i+1] in nonPolarList:   
totalNP += 1
return totalNP / len(region)

if __name__ == "__main__" :
print ('Starting... ')
listOfProtein = ['MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR',
'MARKCSVPLVMAWLTWTTSRAPLPH',
'MPWPTSITXXXXXXSWSPEWLSSGLRSILGWEQPRVSHKGHSHEWHRRP']
count = 1
for protein in listOfProtein :
finder = ProteinList(protein)
region = finder.regionProteinFind()
print('[Protein ' + str(count) + ' : ' + protein + ',')
print('TM Value : [', end=' ')
for amino in region :
print(finder.testForTM(amino), end=',')
print('],')
count += 1
print(']')
print ('Completed... ')
  

# Program ends here.

It will generate the expected output. My screen shot is

Starting... [Protein 1: MKLVVRPWAGCWWSTLGPRGSLSPLGICPLLMLLWATLR, TM Value : [0.7,0.6,0.7,0.7,0.6,0.5,0.6,0.5,0.5,0.4,0.4.0.4,0.4,0.3,0.4,0.5,0.4,0.5,0.4,0.5,0.6, 0.7,0.7,0.8,0.8,0.8,0.9,0.8,0.9,0.8,1, [Protein 2: MARKCSVPLVMAWLTWTTSRAPLPH, TM Value: 0.6,0.6,0.6,0.7,0.8,0.8,0.9,0.8,0.7,0.6,0.5,0.5,0.5,0.5,0.5,0.5,1, [Protein 3 : MPWPTSITXXXXXXSWSPEWLSSGLRSIL GWEQPRVSHKGHSHEWHRRP, TM Value : [0.5,0.4,0-3,0.2,0.1,0.1,0.2,0.1,0.2,0.2,0.3,0.4.0.4,0.4.0.4,0.5,0.4,0.40.4,0.5,0.4, 0.4.0.4.0.4,0.5,0.4,0.5,0.5,0.4,0.3,0.3,0.2,0.2,0.2,0.1,0.2,0.1,0.1,0.1,0.2,1, Completed... I

Code screenshot is below


Related Solutions

Design and implement a program in python that takes a list of items along with quantities...
Design and implement a program in python that takes a list of items along with quantities or weights. The program should include at least two function definition that is called within the main part of your program. Each item has a price associated by quantity or weight. The user enters the item along with the quantity or weight and the program prints out a table for each item along with the quantity/weight and total price. Your program should be able...
Write a program to demonstrate the use of InetAddress. The program takes a list of names...
Write a program to demonstrate the use of InetAddress. The program takes a list of names or IP addresses as command line parameters and prints the name and an IP address of the local host, followed by names and IP addresses of the hosts specified on the command line. use java program
use python 1. Write a program that a. defines a list of countries that are members...
use python 1. Write a program that a. defines a list of countries that are members of BRICS (Brazil, Russia, India, China, Sri Lanka) b. Check whether a country is a member of BRICS or not Program run Enter the name of country: Pakistan Pakistan is not a member of BRICS Enter the name of country : India India is a member of BRICS 2. Write a program to create a list of numbers in the range of 1 to...
Python(please take a screen shot!): 1. hamming distance: write a function distance that take two bits...
Python(please take a screen shot!): 1. hamming distance: write a function distance that take two bits strings, you can assume each strings only contains 0's and 1's. (Note: the two strings might have the same length or not!) for example: hamming('010001001111', '01010100') should return 5(1 bit changed plus 4 bits "lost" from the end). 2. write a main function that ask user for two file names, open files and read the 1st line of each, and compares them using Hamming...
Python 2.7 In Rock Paper Scissors game, try below task (and also using below statements as...
Python 2.7 In Rock Paper Scissors game, try below task (and also using below statements as much as you can): - %s in print statements - \n or \t in print statements - run 100 times of RPS game simulation between two computers and print results for # of ties. - in your program, allow user to decide how many game to play. - allow program to suggest user to retype RPS if there's any typos
1. Write Python program that use a while loop to determine how long it takes for...
1. Write Python program that use a while loop to determine how long it takes for an investment to double at a given interest rate. The input will be an annualized interest rate, and the output is the number of years it takes an investment to double. Note: The amount of initial investment can be any positive value, you can use $1. 2. Write a function def DoubleInvest(initialInvest) to perform the same functionalities as question1. Make sure to include you...
programming in python Design a program that initializes a list of 5 items to zero (use...
programming in python Design a program that initializes a list of 5 items to zero (use repetition operator). It then updates that list with a series of 5 random numbers. The program should find and display the following data: -The lowest number in the list - Average of the numbers stored in the list
Chapter 6: Use a list to store the players Update the program in python so that...
Chapter 6: Use a list to store the players Update the program in python so that it allows you to store the players for the starting lineup. This should include the player’s name, position, at bats, and hits. In addition, the program should calculate the player’s batting average from at bats and hits. Console ================================================================ Baseball Team Manager MENU OPTIONS 1 – Display lineup 2 – Add player 3 – Remove player 4 – Move player 5 – Edit player...
Chapter 6: Use a list to store the players In Python, Update the program so that...
Chapter 6: Use a list to store the players In Python, Update the program so that it allows you to store the players for the starting lineup. This should include the player’s name, position, at bats, and hits. In addition, the program should calculate the player’s batting average from at bats and hits. Console ================================================================ Baseball Team Manager MENU OPTIONS 1 – Display lineup 2 – Add player 3 – Remove player 4 – Move player 5 – Edit player...
Write a program in Python that - Takes in a gross salary. - If the gross...
Write a program in Python that - Takes in a gross salary. - If the gross salary is above €50.000 taxes are 50%. - If the gross salary is above €25.000 taxes are 25%. - If the gross salary is above €10.000 taxes are 10%. - If the gross salary is below €10.000 there is no tax. - Output the gross salary and the net income. Note: Give the pseudocode of your program.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT