我想使用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,但收到上面显示的错误。

最佳答案

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")

关于python-3.x - py2cytoscape-自动保存 View ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54411663/

10-12 22:50