The following code works for loading network in Cytoscape from a dataframe created from a tab-separated file. But I cannot find functions to select nodes based on different criteria to generate different visualizations. Additionally, if it possible to fetch selected nodes from the Cytoscape Desktop GUI, that would be a plus!
from py2cytoscape.data.cynetwork import CyNetwork
from py2cytoscape.data.cyrest_client import CyRestClient
import py2cytoscape.util.util_dataframe as df_util
cy = CyRestClient()
df = pd.read_csv(
'test_network.txt',
sep='\t',
header='infer',
)
net = df_util.from_dataframe(df,
source_col = 'col1',
target_col = 'col2',
interaction_col = 'interacts',
name='From DataFrame')
auto_net = cy.network.create(data=net, name='cytoscape-automated network')
print('New network created with py2cytoscape. Its SUID is ' + str(auto_net.get_id()))
Since I couldnt select nodes using CyNetwork/CyRestClient, I tried loading the network using cyrest.client() which seems to have function for selecting nodes using the code below, but I am getting an error (error message shown in the section below).
I would appreciate any help or advice on how to go about doing this.
Any pointers or suggestions are welcome.
Thanks in advance!
Cytoscape: 3.7.1
CyRest: apiVersion v1
Java: 1.8.0_201
Code:
The following code works for loading network in Cytoscape from a dataframe created from a tab-separated file. But I cannot find functions to select nodes based on different criteria to generate different visualizations. Additionally, if it possible to fetch selected nodes from the Cytoscape Desktop GUI, that would be a plus!
Since I couldnt select nodes using CyNetwork/CyRestClient, I tried loading the network using cyrest.client() which seems to have function for selecting nodes using the code below, but I am getting an error (error message shown in the section below).
I would appreciate any help or advice on how to go about doing this. Any pointers or suggestions are welcome. Thanks in advance!
error: