Open Winghin2517 opened 7 years ago
First, check whether the visualization object, net.viz
, is being populated after clustering
net.viz
is initialized as
{'cat_colors': {'col': {}, 'row': {}}, 'row_nodes': [], 'col_nodes': [], 'links': [], 'mat': []}
and clustering should populate this object. If net.viz
is not populated after running net.cluster()
then something has gone wrong with your clustering.
The problem might also be that you need to restart Jupyter notebook after enabling the extension.
Finally, we just released version 1.13.1. You can try upgrading to this version using
pip install --upgrade clustergrammer_widget
Let us know if this helped.
Best, Nick
Hello,
I am facing the same issue. I have taken all the necessary steps previously mentioned. Successfull enabled the extension, upgrading of widget and restarting the notebook after upgrading and here is my net.viz :
{'cat_colors': {'col': {}, 'row': {}}, 'col_nodes': [{'clust': 2, 'group': [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 30, 'name': 'CL53', 'rank': 26, 'rankvar': 26}, {'clust': 12, 'group': [13.0, 10.0, 6.0, 3.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 29, 'name': 'CL253', 'rank': 1, 'rankvar': 1}, {'clust': 8, 'group': [7.0, 6.0, 5.0, 3.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 28, 'name': 'CL219', 'rank': 4, 'rankvar': 4}, {'clust': 26, 'group': [23.0, 13.0, 7.0, 3.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 27, 'name': 'CL214', 'rank': 29, 'rankvar': 27}, {'clust': 10, 'group': [9.0, 7.0, 5.0, 3.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 26, 'name': 'CL172', 'rank': 18, 'rankvar': 16}, {'clust': 4, 'group': [6.0, 5.0, 4.0, 2.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 25, 'name': 'CL213', 'rank': 13, 'rankvar': 13}, {'clust': 24, 'group': [26.0, 13.0, 7.0, 3.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 24, 'name': 'CL156', 'rank': 21, 'rankvar': 23}, {'clust': 9, 'group': [8.0, 6.0, 5.0, 3.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 'ini': 23, 'name': 'CL167', 'rank': 2, 'rankvar': 2}, .......
List is very very long... But still I am not getting any output from net.widget. Any suggestions please. Thanks.
Hi @vivekruhela, what kind of output are you getting when you run net.widget
? Is the Jupyter notebook displaying an error?
Sorry for late reply. Problem is solved. Now I am getting the output from net.widget()
. The only problem I am facing is the clustergrammer is not fit into the browser. I have to reset the zoom level to 50 or 60% to make it visible completely. Is there any way to get output perfectly fit in browser window. Thanks.
@vivekruhela I'm glad that is working now. Currently we do not support resizing the heatmap, but this is a feature we are working on for this and the new Clustergrammer2 WebGL widget. We can keep you posted
Hi, I get the same problems as described above on python 3.7 with pandas-0.24.2; notebook-kernel 5.1.1; ipywidgets 7.4.2.
It only works with the downloaded two-cats example notebook. In a fresh notebook running the same cells the widget does not appear; 'net.viz' sometimes gives below (expected?) results sometimes not.
Using the "General Purpose Pandas DataFrame Viewer" approach (loading a dataframe in the example with df2=pd.read_csv('../Clustergrammer/data/rc_two_cats.txt', sep='\t')
gives a fault (and net.viz remains empty) which did not occur with my own file (refreshing the kernel does not help):
TypeError Traceback (most recent call last)
in 1 # cluster using default parameters ----> 2 net.cluster(enrichrgram=True) 3 4 # make interactive widget 5 net.widget() /usr/lib64/python3.7/site-packages/clustergrammer_widget/clustergrammer/__init__.py in cluster(self, dist_type, run_clustering, dendro, views, linkage_type, sim_mat, filter_sim, calc_cat_pval, run_enrichr, enrichrgram) 97 calc_cat_pval=calc_cat_pval, 98 run_enrichr=run_enrichr, ---> 99 enrichrgram=enrichrgram) 100 101 def make_clust(self, dist_type='cosine', run_clustering=True, /usr/lib64/python3.7/site-packages/clustergrammer_widget/clustergrammer/make_clust_fun.py in make_clust(net, dist_type, run_clustering, dendro, requested_views, linkage_type, sim_mat, filter_sim, calc_cat_pval, sim_mat_views, run_enrichr, enrichrgram) 17 18 threshold = 0.0001 ---> 19 df = run_filter.df_filter_row_sum(df, threshold) 20 df = run_filter.df_filter_col_sum(df, threshold) 21 /usr/lib64/python3.7/site-packages/clustergrammer_widget/clustergrammer/run_filter.py in df_filter_row_sum(df, threshold, take_abs) 8 9 if take_abs is True: ---> 10 df_copy = deepcopy(df['mat'].abs()) 11 else: 12 df_copy = deepcopy(df['mat']) /usr/lib64/python3.7/site-packages/pandas/core/generic.py in abs(self) 9480 3 7 40 -50 9481 """ -> 9482 return np.abs(self) 9483 9484 def describe(self, percentiles=None, include=None, exclude=None): TypeError: bad operand type for abs(): 'str'
The output of `net.viz' in the notebook-example is the same as in the test-notebook:
{'row_nodes': [{'name': 'Gene: CDK4', 'ini': 38, 'clust': 14, 'rank': 30, 'rankvar': 20, 'cat-0': 'Gene Type: Interesting', 'cat_0_index': 0, 'group': [10.0, 9.0, 8.0, 5.0, 5.0, 3.0, 1.0, 1.0, 1.0, 1.0, 1.0]}, {'name': 'Gene: LMTK3', 'ini': 37, 'clust': 20, 'rank': 28, 'rankvar': 24, 'cat-0': 'Gene Type: Not Interesting', 'cat_0_index': 17, 'group': [21.0, 20.0, 19.0, 13.0, 11.0, 5.0, 1.0, 1.0, 1.0, 1.0, 1.0]},
I'm trying to display the clustergrammer widget in my jupyter notebook but it just doesn't seem to work.
I took the example code off this page and ran it on my jupyter notebook on my mac but it gives me empty results :https://github.com/MaayanLab/clustergrammer-widget/blob/master/Running_clustergrammer_widget.ipynb
As you can see, the integer slider works properly, so therefore it cannot be the widgetsnbextension that is a problem.
These are my dependencies from running a conda list:
widgetsnbextension 3.0.2 py35_0 conda-forge ipywidgets 7.0.0 py35_0 conda-forge clustergrammer-widget 1.13.0
I ran this:
jupyter nbextension enable --py --sys-prefix clustergrammer_widget
and this was the result:
However, when I viewed the code off the jupyter nbviewer website, it works perfectly:
http://nbviewer.jupyter.org/github/MaayanLab/clustergrammer-widget/blob/11b36f36b613c2ec2081415c3f81b2d3fcf9507f/Python%203.5%20test.ipynb
Can you please tell me what I'm doing wrong here?