我有以下代码
#!/usr/bin/python
import sys
import re
import string
indexfile="ABC.txt"
for line in open(indexfile,'rU').xreadlines():
t = string.split(line,'\t')
id = t[0];
gene=t[1];
pwmfile=id+'.txt'
matrix_file = open(pwmfile, "rU")
matrix = matrix_file.readlines()
vals = [line[1:] for line in matrix[1:]]
newpwmfile=id+'_formated.txt'
ea=open(newpwmfile,'w')
ea.seek(0)
ea.write(">"+"ASTTCCTCTT "+gene)
ea.writelines([line.lstrip('\t') for line in vals])
ea.close()
下面是我得到的矩阵:
^{pr2}$我想从每一行中找出最大值,然后除以0.25,然后对每一行求和划船。还有我想得到一个字符串,它为字符串中的每个位置指定字母,例如,如果最大值在第三列中,那么在第二行的第一列中是G,然后G等等,然后把它们串联起来,这样我就可以在找到每行的最大分数的同时得到一个类似GAUUCCCG的字符串。在
相关问题 更多 >
编程相关推荐