Skip to content

Commit

Permalink
docs: Save networks as images
Browse files Browse the repository at this point in the history
  • Loading branch information
kozo2 committed Apr 13, 2018
1 parent fbd7520 commit 79fde77
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions usecase/topdown-workflow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ biocLite("limma")

```{python}
import os
os.system('python -m pip install py2cytoscape')
os.system('python -m pip install py2cytoscape requests pandas')
```

#### Windows
Expand Down Expand Up @@ -126,7 +126,6 @@ for i in all_suid:
genes = keggids.str.extractall('(b[0-9]{4})')
table4cy = pd.merge(genes, limma, left_on=0, right_index=True)
if(table4cy.shape[0] != 0):
#pathwayinfo = net.get_network_table()['KEGG_PATHWAY_ID']
meantable4cy = table4cy.groupby('SUID').mean()
net.update_node_table(df=meantable4cy, network_key_col='SUID')
else:
Expand All @@ -140,4 +139,18 @@ my_kegg_style.create_continuous_mapping(column='adj.P.Val', vp='NODE_FILL_COLOR'
```

## Step 4 (Data integration and knowledge discovery)
## Step 4 (Data interpretation and knowledge discovery)

```{python}
# Saving all networks as images
from py2cytoscape.data.cyrest_client import CyRestClient
cy = CyRestClient()
all_suid = cy.network.get_all()
for i in all_suid:
net = cy.network.create(i)
path = net.get_network_table()['KEGG_PATHWAY_ID']
pathid = path.values[0][5:]
file = open(pathid + ".svg", 'wb')
file.write(net.get_svg())
file.close()
```

0 comments on commit 79fde77

Please sign in to comment.