当前位置: 首页>>代码示例>>Python>>正文


Python Network.filter_N_top方法代码示例

本文整理汇总了Python中clustergrammer.Network.filter_N_top方法的典型用法代码示例。如果您正苦于以下问题:Python Network.filter_N_top方法的具体用法?Python Network.filter_N_top怎么用?Python Network.filter_N_top使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clustergrammer.Network的用法示例。


在下文中一共展示了Network.filter_N_top方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process_GCT_and_export_tsv

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import filter_N_top [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')
开发者ID:MaayanLab,项目名称:LINCS_GCT,代码行数:22,代码来源:old_load_gct.py

示例2: make_json_from_tsv

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import filter_N_top [as 别名]
def make_json_from_tsv(name):
  '''
  make a clustergrammer json from a tsv file
  '''
  from clustergrammer import Network

  print('\n' + name)

  net = Network()

  filename = 'txt/'+ name + '.txt'

  net.load_file(filename)

  df = net.dat_to_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', 1000)

  num_rows = net.dat['mat'].shape[0]
  num_cols = net.dat['mat'].shape[1]

  print('num_rows ' + str(num_rows))
  print('num_cols ' + str(num_cols))

  if num_cols < 50 or num_rows < 1000:

    views = ['N_row_sum']
    net.make_clust(dist_type='cos', views=views)
    export_filename = 'json/' + name + '.json'
    net.write_json_to_file('viz', export_filename)

  else:
    print('did not cluster, too many columns ')
开发者ID:MaayanLab,项目名称:LINCS_GCT,代码行数:41,代码来源:process_gct_and_make_jsons.py

示例3: make_viz_from_df

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import filter_N_top [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)
开发者ID:MaayanLab,项目名称:LINCS_GCT,代码行数:26,代码来源:old_load_gct.py


注:本文中的clustergrammer.Network.filter_N_top方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。