本文整理汇总了Python中clustergrammer.Network.viz方法的典型用法代码示例。如果您正苦于以下问题:Python Network.viz方法的具体用法?Python Network.viz怎么用?Python Network.viz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clustergrammer.Network
的用法示例。
在下文中一共展示了Network.viz方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: l1000cds2_upload
# 需要导入模块: from clustergrammer import Network [as 别名]
# 或者: from clustergrammer.Network import viz [as 别名]
def l1000cds2_upload():
import requests
import json
from clustergrammer import Network
from pymongo import MongoClient
from bson.objectid import ObjectId
# get the json
l1000cds2 = json.loads( request.form.get('signatures') )
# initialize network
net = Network()
# load l1000cds2 to .dat
net.load_l1000cds2(l1000cds2)
# cluster
cutoff_comp = 0
min_num_comp = 2
net.cluster_row_and_col(dist_type='cosine', dendro=True)
# redefine initial ordering - rank by gene signature values and pert scores
net.dat['node_info']['row']['ini'] = net.sort_rank_node_values('row')
net.dat['node_info']['col']['ini'] = net.sort_rank_node_values('col')
net.viz = {}
net.viz['row_nodes'] = []
net.viz['col_nodes'] = []
net.viz['links'] = []
# remake visualization
net.viz_json()
# generate export dictionary
###############################
export_dict = {}
export_dict['name'] = 'l1000cds2'
export_dict['dat'] = net.export_net_json('dat')
export_dict['viz'] = net.viz
export_dict['_id'] = ObjectId(l1000cds2['_id'])
# set up connection
client = MongoClient(mongo_address)
db = client.clustergrammer
# save to database
##################################
tmp = db.networks.find_one({'_id': ObjectId(l1000cds2['_id']) })
if tmp is None:
tmp_id = db.networks.insert( export_dict )
# close client
client.close()
return redirect('/clustergrammer/l1000cds2/'+l1000cds2['_id'])