def discarding_5_percent(i_file, o_file): """ """ i_file = open(i_file, 'rb') o_file = open(o_file, 'wb') reader = i_file.readlines() A = [] for line in reader: # print line a = [] l_s = line.split('\t') for l in l_s: a.append(l.strip('\r\n')) A.append(a) T = gvm_tools.matrix_transposition(A) # print T no_instances = 25 for row in T: print row for i in xrange(no_instances): row.remove(max(row)) for i in xrange(no_instances): row.remove(min(row)) A = gvm_tools.matrix_transposition(T) # print A for row in A: line = '\t'.join(str(r) for r in row) # print line o_file.write(line) o_file.write('\n') o_file.close() i_file.close()