<jupyter_start><jupyter_text>Working on new APIThe `clustergrammer_gl` class is now being loaded into the `Network` class. The class and widget instance are saved in th `Network` instance, `net`. This allows us to load data, cluster, and finally produce a new widget instance using the `widget` method. The instance of the widget is saved in `net` and can be used to grab the data from the clustergram as a Pandas DataFrame using the `widget_df` method. The exported DataFrame will reflect any filtering or imported categories that were added on the front end.In these examples, we will filter the matrix using the brush crop tool, export the filtered matrix as a DataFrame, and finally visualize this as a new clustergram widget.<jupyter_code>import numpy as np
import pandas as pd
from clustergrammer_gl import *
net = Network(clustergrammer_gl)<jupyter_output><empty_output><jupyter_text>Make widget using new API<jupyter_code>net.load_file('rc_two_cats.txt')
net.cluster()
net.widget()<jupyter_output><empty_output><jupyter_text>Above, we have filtered the matrix to a region of interest using the brush cropping tool. Below we will get export this region of interest, defined on the front end, to a DataFrame, `df_genes`. This demonstrates the two-way communication capabilities of widgets.<jupyter_code>df_genes = net.widget_df()
df_genes.shape
net.load_df(df_genes)
net.cluster()
net.widget()<jupyter_output><empty_output><jupyter_text>Above, we made a new widget visualizing this region of interest.   Generate random DataFrameHere we will genrate a DataFrame with random data and visualize it using the widget.<jupyter_code># generate random matrix
num_rows = 500
num_cols = 10
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)
net.load_df(df)
net.cluster()
net.widget()<jupyter_output><empty_output><jupyter_text>Above, we selected a region of interest using the front-end brush crop tool and export to DataFrame, df_random. Below we will visualize it using a new widget.<jupyter_code>df_random = net.widget_df()
df_random.shape
net.load_df(df_random)
net.cluster()
net.widget()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07692307692307693, 'fraction_numerical': 0.003418803418803419, 'mean_word_length': 5.967261904761905, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '304923', 'license': 'MIT', 'n_tokens_mistral': 724, 'n_tokens_neox': 699, 'n_words': 280, 'path': 'Working_on_new_API.ipynb', 'repo_name': 'cornhundred/clustergrammer_gl', 'size': '2340'}