Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- from functools import reduce
- if __name__ == "__main__":
- profile = list(zip(*[reduce(
- 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)],
- strand, [0, 0, 0, 0]) for strand in zip(*[line.split('\t')[1].rstrip('\n')
- for line in os.popen("./ffasta.sh %s" % sys.argv[1])])]))
- print(''.join([{0: 'A', 1: 'C', 2: 'G', 3: 'T'}[column.index(max(column))] for column in zip(*profile)]))
- for i, row in enumerate(profile):
- 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