Advertisement
Guest User

Untitled

a guest
Jul 12th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import sys
  2. import os
  3. from functools import reduce
  4.  
  5. if __name__ == "__main__":
  6.     profile = list(zip(*[reduce(
  7.         lambda acc, c: [x[1] + 1 if {'A': 0, 'C': 1, 'G': 2, 'T': 3}[c] == x[0] else x[1] for x in enumerate(acc)],
  8.         strand, [0, 0, 0, 0]) for strand in zip(*[line.split('\t')[1].rstrip('\n')
  9.                                                   for line in os.popen("./ffasta.sh %s" % sys.argv[1])])]))
  10.     print(''.join([{0: 'A', 1: 'C', 2: 'G', 3: 'T'}[column.index(max(column))] for column in zip(*profile)]))
  11.     for i, row in enumerate(profile):
  12.         print({0: 'A', 1: 'C', 2: 'G', 3: 'T'}[i] + ': ' + ' '.join(str(n) for n in row))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement