py2cytoscape-自动保存视图

时间:2019-01-28 23:15:09

标签: python-3.x cytoscape

我想使用py2cytoscape软件包自动将视图保存到cytoscape中。

from py2cytoscape import cyrest

cytoscape = cyrest.cyclient()
cytoscape.network.load_file("FILENAME.cyjs")
cytoscape.vizmap.apply(styles="default")
cytoscape.network.set_current(network="FILENAME")
cytoscape.layout.apply_preferred()
cytoscape.view.set_current(network="FILENAME")
cytoscape.view.fit_content()
cytoscape.network.deselect(nodeList='all', edgeList='all')

cytoscape.view.export(options="PDF", OutputFile="FILENAME")

以下输出:

ValueError: {'status': 500, 'type': 'urn:cytoscape:ci:cyrest-core:v1:handle-json-command:errors:2', 'message': 'java.lang.NullPointerException', 'link': 'file:/Users/mgruzynski/CytoscapeConfiguration/3/framework-cytoscape.log'}

我尝试遵循(导出高分辨率图像文件): https://github.com/cytoscape/cytoscape-automation/blob/master/for-scripters/Python/advanced-cancer-networks-and-data.ipynb,但出现上面显示的错误。

1 个答案:

答案 0 :(得分:0)

Cytoscape 3.7.1的改动很小

请从开发分支安装py2cytoscape

pip uninstall py2cytoscape
pip install git+https://github.com/cytoscape/py2cytoscape.git --user

然后使用

cytoscape.view.export(options="PDF", outputFile="FILENAME")