Local Clustergrammer API

local new module

class clustergrammer_py.Network

Bases: object

version 1.2.1 Modifying API

Networks have two states:

  1. the data state, where they are stored as a matrix and nodes

2) the viz state where they are stored as viz.links, viz.row_nodes, and viz.col_nodes.

The goal is to start in a data-state and produce a viz-state of the network that will be used as input to clustergram.js.

Iframe_web_app(filename=None, width=1000, height=800)

convert from clusergrammers dat format to pandas dataframe


Convert from pandas dataframe to clustergrammers dat format (will be deprecated)

enrichr(req_type, gene_list=None, lib=None, list_id=None, max_terms=None)

under development, get enrichment results from Enrichr and add them to clustergram


export dataframe from network

export_net_json(net_type='viz', indent='no-indent')

export dat or viz json

filter_N_top(inst_rc, N_top, rank_type='sum')

Filter a network’s rows or cols based on sum/variance, and only keep the top N

filter_sum(inst_rc, threshold, take_abs=True)

Filter a network’s rows or columns based on the sum across rows or columns Works on the network object

filter_threshold(inst_rc, threshold, num_occur=1)

Filter a network’s rows or cols based on num_occur values being above a threshold (in absolute value)


load my .dat format (saved as json) for a network to a netowrk


Upload pandas datafraeme


load file to network, currently supporting only tsv

static load_gmt(filename)
static load_json_to_dict(filename)

load stdin tsv formatted string

load_tsv_to_net(file_buffer, filename=None)

This will load a tsv matrix file buffer, this is exposed so that it will be possible to load data without having to read from a file.


load vector format to network

make_clust(dist_type='cosine', run_clustering=True, dendro=True, views=['N_row_sum', 'N_row_var'], linkage_type='average', sim_mat=False, filter_sim=0.1, calc_cat_pval=False, run_enrichr=None)

The main function run by the user to make their clustergram. views is later referred to as requested_views.

normalize(df=None, norm_type='zscore', axis='row', keep_orig=False)

under development, normalize the network rows/cols using zscore


under development, will produce a single view on demand from .dat data


function for user to reset network

static save_dict_to_json(inst_dict, filename, indent='no-indent')

export viz json, for use with clustergrammer_widget

write_json_to_file(net_type, filename, indent='no-indent')
write_matrix_to_tsv(filename=None, df=None)