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)
dat_to_df()

convert from clusergrammers dat format to pandas dataframe

df_to_dat(df)

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_df()

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_data_file_to_net(filename)

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

load_df(df)

Upload pandas datafraeme

load_file(filename)

load file to network, currently supporting only tsv

static load_gmt(filename)
static load_json_to_dict(filename)
load_stdin()

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_vect_post_to_net(vect_post)

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

produce_view(requested_view=None)

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

reset()

function for user to reset network

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

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)