def smear_gg(): ggn = nu.net_genegene() img = array(ggn) s = shape(img) for i in range(s[1]): img[:,i] = np.sort(img[:,i])[::-1]/ np.max(img[:,i]) sums = np.sum(img ** 2,0) img = img[:, np.argsort(sums)[::-1]] draw_smear(img[::xskip,::yskip])
def net_cluster_gg(k = k, reset = 0): hardcopy = True try: if reset: raise Exception('compute') out,sxs = nw.rn2(name, hardcopy = hardcopy) if not sxs: raise Exception() except Exception as e: if e.args[0] != 'compute': raise Exception() nw.claim_reset() gg = nu.net_genegene(reset = mod(reset,2)) kmeans = mlpy.Kmeans(k) clustered = kmeans.compute(gg[0:maxgenes,:]) means = kmeans.means out = (clustered,means) nw.wn2(name, (clustered, means) ,hardcopy = hardcopy) return out