Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python In the following code cell, write a function named create_pssm() that tak

ID: 3593366 • Letter: P

Question

Python

In the following code cell, write a function named create_pssm() that takes sequences, a list of sequences as strings, and returns matrix, a list of 4 rows and columns equal to the number of length of the sequence. The list of sequences in the code cell below, will return a PSSM that has 9 columns, as the length of each sequence is 9 nucleotides.

The 1st, 2nd, 3rd and 4th row of matrix must correspond to counts for A, C, G and T, respectively.

sequences1 = ['GAGGTAAAC',
'TCCGTAAGT',
'CAGGTTGGA',
'ACAGTCAGT',
'TAGGTCATT',
'TAGGTACTG',
'ATGGTAACT',
'CAGGTATAC',
'TGTGTGAGT',
'AAGGTAAGT',
]

def create_pssm(sequences):
'''
Takes a list of sequences (of equal length),
computes the pssm and returns the resulting matrix.
  
Parameters
---------
sequence: List. List of DNA sequences as strings.
  
Returns
-------
matrix: 4 x sequence positions list containing scores as int.
The 1st, 2nd, 3rd and 4th rows of this matrix must correspond to counts of A, C, G and T respectively.
The rows need to be in this order to pass the assertion tests.
'''
#initializing the matrix with zeros
matrix = [[0] * len(sequences[0]) for i in range(4)]
# YOUR CODE HERE
  
return matrix

Explanation / Answer

def foo(x): ... return x + 1 ... >>> name = 'unpredictable_words' >>> >>> globals()['test_' + name] = foo >>> >>> test_unpredictable_words(1) 2 >>> >>> def some_function(): ... locals()['test_' + name] = foo ... return test_unpredictable_words(1) ... >>> some_function() 2