import math
import numpy # 导入 numpy库
from numpy import * # 导入 numpy库
import matplotlib.pyplot as plt # 导入 matplotlib 库
fh1 = open ("C:\Users\hyl\Desktop\ko_counts.txt")
fh2 = open ("C:\Users\hyl\Desktop\ko_counts_out.txt",'w')
for line in fh1.readlines():
l = line.split(" ")
fh2.write( l[1] + ' ' + l[2] )
fh2.close()
dataSet = numpy.loadtxt('ko_counts_out.txt')
print dataSet
dataMat = log(mat(dataSet) +1)
#print dataMat
print numpy.mean(dataMat,axis = 0) / numpy.var(dataMat,axis = 0)
fh3 = open ("C:\Users\hyl\Desktop\ko_counts_out1.txt",'w')
for i in range(len(dataMat)):
fh3.write(str(((dataMat - numpy.mean(dataMat,axis = 0) ) / numpy.var(dataMat,axis = 0))[i]))
fh3.write('
')
fh3.close()