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

Write a program that takes as input an alignment, and outputs the PWM and the in

ID: 3854114 • Letter: W

Question

Write a program that takes as input an alignment, and outputs the PWM and the information content of the PWM. To prevent prob = 0 from happening, add a pseducount 1 for each nucleotide. i.e., p_A = (c_A + 1) / (c_A + c_C + c_G + c_T + 4), where c_A is the number of A's observed in the column. (It is best to implement the main functionality as a function so that you can reuse it in Problem 4 or possibly also Problem 3.) Apply your program on the following alignment and report the results. Also use the web tool enoLogos to compute the sequence logo. Make sure you set %GC to "equiprobable". Click on textout to check the probability matrix and information content there. Do they match your results?

GTGTAGC
GTGTTGT
GGGTTGC
GTGTAGC
GTGCTGC
GTGTAGC
TTGTTGC
GTGTAGC
ATGTTGC
GTGGTGC
GTGTTCC
GCGTTGC
GTGTTAC
GCGTTGC
GTGCTGC
GTTTTGC
TTGTTGC
GTCTTGC
GTGATGC
GTGTTGA

Explanation / Answer

def count_char(word, count_dict):
for s in word:
count_dict[s] += 1
return count_dict

count_dict = {}
for x in range(0, 26):
count_dict[chr(x + ord('A'))] = 0

while(1):
try:
word = raw_input()
except EOFError:
break
count_dict = count_char(word, count_dict)

c_A = count_dict['A']
c_C = count_dict['C']
c_G = count_dict['G']
c_T = count_dict['T']

p_A = (c_A + 1)/(c_A + c_C + c_G + c_T + 4.0)
print p_A

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote