本文整理汇总了Python中clustergrammer.Network.df_to_dat方法的典型用法代码示例。如果您正苦于以下问题:Python Network.df_to_dat方法的具体用法?Python Network.df_to_dat怎么用?Python Network.df_to_dat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clustergrammer.Network
的用法示例。
在下文中一共展示了Network.df_to_dat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_viz_json
# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import df_to_dat [as 别名]
def make_viz_json(inst_df, name):
from clustergrammer import Network
net = Network()
filename = 'json/'+name
load_df = {}
load_df['mat'] = inst_df
net.df_to_dat(load_df)
net.swap_nan_for_zero()
net.make_clust(views=[])
net.write_json_to_file('viz', filename, 'no-indent')
示例2: process_GCT_and_export_tsv
# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import df_to_dat [as 别名]
def process_GCT_and_export_tsv():
from clustergrammer import Network
filename = 'gcts/LDS-1003.gct'
print('exporting processed GCT as tsv file')
df = load_file(filename)
net = Network()
net.df_to_dat(df)
net.swap_nan_for_zero()
# zscore first to get the columns distributions to be similar
net.normalize(axis='col', norm_type='zscore', keep_orig=True)
# filter the rows to keep the perts with the largest normalizes values
net.filter_N_top('row', 200)
net.write_matrix_to_tsv('txt/example_gct_export.txt')
示例3: make_viz_from_df
# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import df_to_dat [as 别名]
def make_viz_from_df(df, filename):
from clustergrammer import Network
net = Network()
net.df_to_dat(df)
net.swap_nan_for_zero()
# zscore first to get the columns distributions to be similar
net.normalize(axis='col', norm_type='zscore', keep_orig=True)
# filter the rows to keep the perts with the largest normalizes values
net.filter_N_top('row', 2000)
num_coluns = net.dat['mat'].shape[1]
if num_coluns < 50:
# views = ['N_row_sum', 'N_row_var']
views = ['N_row_sum']
net.make_clust(dist_type='cos', views=views)
filename = 'json/' + filename.split('/')[1].replace('.gct','') + '.json'
net.write_json_to_file('viz', filename)