How to use the clustergrammer2.clustergrammer_fun.categories function in clustergrammer2

To help you get started, we’ve selected a few clustergrammer2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ismms-himc / clustergrammer2 / clustergrammer2 / clustergrammer_fun / load_data.py View on Github external
def load_tsv_to_net(net, file_buffer, filename=None):
  lines = file_buffer.getvalue().split('\n')
  num_labels = categories.check_categories(lines)

  row_arr = list(range(num_labels['row']))
  col_arr = list(range(num_labels['col']))

  # use header if there are col categories
  if len(col_arr) > 1:
    df = pd.read_table(file_buffer, index_col=row_arr,
                                  header=col_arr)
  else:
    df = pd.read_table(file_buffer, index_col=row_arr)

  df = proc_df_labels.main(df)

  net.df_to_dat(df, True)
  net.dat['filename'] = filename
github ismms-himc / clustergrammer2 / clustergrammer2 / clustergrammer_fun / data_formats.py View on Github external
# cat_values = net.meta_col.loc[inst_nodes, cat_title].apply(lambda x: cat_title + ': ' + x).values.tolist()
            if net.is_downsampled:
              if hasattr(net, 'meta_ds_col'):
                # print(inst_nodes)

                cat_values = net.meta_ds_col.loc[inst_nodes, cat_title].apply(lambda x: cat_title + ': ' + x).values.tolist()
              else:
                cat_values = net.meta_col.loc[inst_nodes, cat_title].apply(lambda x: cat_title + ': ' + x).values.tolist()

            # detault with no downsampling
            else:
              cat_values = net.meta_col.loc[inst_nodes, cat_title].apply(lambda x: cat_title + ': ' + x).values.tolist()

          net.dat['node_info'][axis][cat_name] = cat_values

  categories.dict_cat(net, define_cat_colors=define_cat_colors)
github ismms-himc / clustergrammer2 / clustergrammer2 / clustergrammer_fun / __init__.py View on Github external
}
          },
          {
            "title": "Second Category",
            "cats": {
              "something": [
                "PDK4"
              ]
            }
          }
        ]


    '''
    for inst_data in cat_data:
      categories.add_cats(self, axis, inst_data)
github ismms-himc / clustergrammer2 / clustergrammer2 / clustergrammer_fun / calc_clust.py View on Github external
linkage_type=linkage_type)
    else:
      dendro = False
      node_info['clust'] = node_info['ini']

    # sorting
    if run_rank is True:
      node_info['rank'] = sort_rank_nodes(net, axis, 'sum')
      node_info['rankvar'] = sort_rank_nodes(net, axis, 'var')
    else:
      node_info['rank'] = node_info['ini']
      node_info['rankvar'] = node_info['ini']

    ##################################
    if ignore_cat is False:
      categories.calc_cat_clust_order(net, axis)

  if calc_cat_pval is True:
    cat_pval.main(net)

  # make the visualization json
  make_viz.viz_json(net, dendro, links)

  return dm