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...
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...
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.
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
Write a program in python such that There exists a list of emails List Ls =...
Write a program in python such that There exists a list of emails List Ls = ['[email protected]','[email protected]','[email protected]','[email protected]',[email protected]'] Count the number of emails IDS which ends in "ac.in" Write proper program with proper function accepting the argument list of emails and function should print the number of email IDs and also the email IDS ending with ac.in output 2 [email protected] [email protected] ================================= i am trying like this but getting confused len [True for x in Ls if x.endswith('.ac.in')] please write complete...
IN PYTHON Write a program that takes in a positive integer as input, and outputs a...
IN PYTHON Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string....
Design a function in python that takes a list of strings as an argument and determines...
Design a function in python that takes a list of strings as an argument and determines whether the strings in the list are getting decreasingly shorter from the front to the back of the list
Python 3 Function which takes the head Node of a linked list and sorts the list...
Python 3 Function which takes the head Node of a linked list and sorts the list into non-descending order. PARAM: head_node The head of the linked list RETURNS: The node at the head of the sorted linked list. ''' def sort(head_node): #Code goes here ''' Test code goes here '' ' if __name__ == '__main__':
python Write a program that prints your name 100 times to the screen. Write a function...
python Write a program that prints your name 100 times to the screen. Write a function that takes a string s and an integer n as parameters and prints the string s a total of n times (once per line). Write a for loop that prints all the integers from 3141 to 5926, skipping every other one. Write a for loop that prints every 5th integer from 5926 down to 3141. Write a program (using a for loop) to print...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT