Introduction Clustergrammer_Widget2 0.5.1

In [1]:
import numpy as np
import pandas as pd
import clustergrammer_widget2
from clustergrammer import *
net = Network()
In [2]:
net.load_file('rc_two_cats.txt')
net.cluster()
df = net.export_df()
In [3]:
# df.sum(axis=1)
In [4]:
net.load_df(df)
net.cluster()
net_json = net.export_viz_to_widget()

Visualize Example Gene Expression Toy Dataset

In [5]:
w = clustergrammer_widget2.ExampleWidget(network=net_json)
w
In [6]:
w = clustergrammer_widget2.ExampleWidget(network=net_json)
w

Visualize Random Matrix

In [ ]:
# generate random matrix
num_rows = 1000
num_cols = 1000
np.random.seed(seed=100)
mat = np.random.rand(num_rows, num_cols)

# make row and col labels
rows = range(num_rows)
cols = range(num_cols)
rows = [str(i) for i in rows]
cols = [str(i) for i in cols]

# make dataframe 
df = pd.DataFrame(data=mat, columns=cols, index=rows)
print(df.shape)
In [ ]:
df.head()
In [ ]:
net.load_df(df)
net.cluster()
net_json = net.export_viz_to_widget()
w = clustergrammer_widget2.ExampleWidget(network=net_json)
w
In [ ]:
import ipywidgets 
In [ ]:
ipywidgets.__version__
In [ ]:
 
In [ ]: