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


Python Network.load_json_to_dict方法代码示例

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


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

示例1: add_mutations

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import load_json_to_dict [as 别名]
def add_mutations(cl_info):
  print('add mutations\n')

  from clustergrammer import Network
  net = Network()
  old_cl_info = net.load_json_to_dict('cell_line_muts.json')

  cl_muts = old_cl_info['muts']

  for inst_cl in cl_info:

    # remove plex name if necessary
    if '_plex_' in inst_cl:
      simple_cl = inst_cl.split('_')[0]
    else:
      simple_cl = inst_cl

    for inst_mut in cl_muts:
      mutated_cls = cl_muts[inst_mut]

      if simple_cl in mutated_cls:
        has_mut = 'true'
      else:
        has_mut = 'false'

      mutation_title = 'mut-'+inst_mut

      # use the original long cell line name (with possible plex)
      cl_info[inst_cl][mutation_title] = has_mut

  return cl_info
开发者ID:MaayanLab,项目名称:cst_drug_treatment,代码行数:33,代码来源:make_cell_line_info_dict.py

示例2: make_enr_vect_clust

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import load_json_to_dict [as 别名]
def make_enr_vect_clust():
  import enrichr_functions as enr_fun 
  from clustergrammer import Network

  net = Network()

  g2e_post = net.load_json_to_dict('json/g2e_enr_vect.json')

  net = enr_fun.make_enr_vect_clust(g2e_post, 0.001, 1)

  net.write_json_to_file('viz','json/enr_vect_example.json')
开发者ID:ErwanDavid,项目名称:clustergrammer.js,代码行数:13,代码来源:make_enr_vect_clust.py

示例3: cluster

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import load_json_to_dict [as 别名]
def cluster():
  from clustergrammer import Network

  net = Network()

  vect_post = net.load_json_to_dict('fake_vect_post.json')  

  net.load_vect_post_to_net(vect_post)

  net.swap_nan_for_zero()
  
  # net.N_top_views()
  net.make_clust(dist_type='cos',views=['N_row_sum','N_row_var'], dendro=True)

  net.write_json_to_file('viz','json/large_vect_post_example.json','indent')  
开发者ID:ErwanDavid,项目名称:clustergrammer.js,代码行数:17,代码来源:fake_vect_post.py

示例4: make_plex_matrix

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import load_json_to_dict [as 别名]
def make_plex_matrix():
  '''
  Make a cell line matrix with plex rows and cell line columns.
  This will be used as a negative control that should show worsening correlation
  as data is normalized/filtered.
  '''
  import numpy as np
  import pandas as pd
  from clustergrammer import Network

  # load cl_info
  net = Network()
  cl_info = net.load_json_to_dict('../cell_line_info/cell_line_info_dict.json')

  # load cell line expression
  net.load_file('../CCLE_gene_expression/CCLE_NSCLC_all_genes.txt')
  tmp_df = net.dat_to_df()
  df = tmp_df['mat']

  cols = df.columns.tolist()

  rows = range(9)
  rows = [i+1 for i in rows]
  print(rows)

  mat = np.zeros((len(rows), len(cols)))

  for inst_col in cols:

    for inst_cl in cl_info:

      if inst_col in inst_cl:
        inst_plex = int(cl_info[inst_cl]['Plex'])

        if inst_plex != -1:
          # print(inst_col + ' in ' + inst_cl + ': ' + str(inst_plex))

          row_index = rows.index(inst_plex)
          col_index = cols.index(inst_col)

          mat[row_index, col_index] = 1


  df_plex = pd.DataFrame(data=mat, columns=cols, index=rows)

  filename = '../lung_cellline_3_1_16/lung_cl_all_ptm/precalc_processed/' + \
            'exp-plex.txt'
  df_plex.to_csv(filename, sep='\t')
开发者ID:MaayanLab,项目名称:cst_drug_treatment,代码行数:50,代码来源:precalc_PTM_norm.py

示例5: post_to_clustergrammer

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import load_json_to_dict [as 别名]
def post_to_clustergrammer():

  from clustergrammer import Network
  import requests 
  import json

  upload_url = 'http://localhost:9000/clustergrammer/vector_upload/'
  # upload_url = 'http://amp.pharm.mssm.edu/clustergrammer/vector_upload/'

  net = Network()
  vect_post = net.load_json_to_dict('test_vector_upload.json')
  # vect_post = net.load_json_to_dict('fake_vect_post.json')

  r = requests.post(upload_url, data=json.dumps(vect_post) )

  link = r.text

  print(link)
开发者ID:jjdblast,项目名称:clustergrammer.js,代码行数:20,代码来源:test_vect_post.py

示例6: proc_locally

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import load_json_to_dict [as 别名]
def proc_locally():
  from clustergrammer import Network
  # import run_g2e_background

  net = Network()

  vect_post = net.load_json_to_dict('large_vect_post.json')

  print(vect_post.keys())

  # mongo_address = '10.125.161.139'


  net.load_vect_post_to_net(vect_post)

  net.swap_nan_for_zero()

  net.N_top_views()  

  print(net.viz.keys())
开发者ID:jjdblast,项目名称:clustergrammer.js,代码行数:22,代码来源:test_vect_post.py

示例7: main

# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import load_json_to_dict [as 别名]
def main():
  '''
  This will add cell line category information (including plexes and
  gene-expression groups to the gene expression data from CCLE)
  '''
  from clustergrammer import Network
  net = Network()

  # load original CCLE gene expression data for CST lung cancer cell lines
  filename = 'CCLE_gene_expression/CCLE_NSCLC_all_genes.txt'
  f = open(filename, 'r')
  lines = f.readlines()
  f.close()

  # load cell line info
  cl_info = net.load_json_to_dict('cell_line_info/cell_line_muts.json')

  # write to new file
  new_file = 'CCLE_gene_expression/CCLE_NSCLC_cats_all_genes.txt'
  fw = open(new_file, 'w')

  fw.close()
开发者ID:MaayanLab,项目名称:cst_drug_treatment,代码行数:24,代码来源:add_cl_categories_to_CCLE_gene_expression.py


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