Python Programming Consensus and Print Matrix Profile Assignment

User Generated

uhfxlwnzrf

Programming

Description

  1. consensus(profile): Input is a list of motifs. Output is a string corresponding to the most frequently occurring letter at each position.
  2. print_matrix(profile): Input is a profile of probabilities. (example below):

>>> mymotifs = ['ACGTT','CCGTT', 'AGGTT', 'ACTTT', 'ACGAT','TTTTT']

>>> my_profile = profile(mymotifs)

>>> my_profile

{'A': [0.6666666666666666, 0.0, 0.0, 0.16666666666666666, 0.0], 'C': [0.16666666666666666, 0.6666666666666666, 0.0, 0.0, 0.0], 'G': [0.0, 0.16666666666666666, 0.6666666666666666, 0.0, 0.0], 'T': [0.16666666666666666, 0.16666666666666666, 0.3333333333333333, 0.8333333333333334, 1.0]}

>>> print_matrix(my_profile)

A 0.67 0.00 0.00 0.17 0.00

C 0.17 0.67 0.00 0.00 0.00

G 0.00 0.17 0.67 0.00 0.00

T 0.17 0.17 0.33 0.83 1.00

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

The python code ...


Anonymous
I was having a hard time with this subject, and this was a great help.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags