Cytoscape input file preparation for hub/keystone genera identification

Skip to first unread message

Yogesh Gupta

Jun 2, 2021, 5:37:25 AMJun 2
to cytoscape-helpdesk


 am trying to learn co-occurrence analysis for microbial data. I got relative abundance at the genera level for 50 genera in 19 samples.

I understand that for network analysis first I need to do Spearman's correlation analysis and P-value calculation and after that, I need to do filtering based on these two criteria value and then I need to visualize the network in Cytoscape.

But I am not sure how I can do filtering based on spearman's correlation and P-value altogether and in which format should I save the file for Cytoscape input?

Here is the code and data file by dput command;

















A <-  readxl::read_excel("soil.test.wet.count.xlsx")



# Convert the first column to be row names

B <- A[, -1]

C <- data.frame(B, row.names=A$Sample)

M = as.matrix(C)






cor_5 <- rcorr(as.matrix(M),type=c("spearman"))

r_mat <- cor_5$r

p_mat <- cor_5$P



write.table(r_mat, "r.correlation.txt")

write.table(p_mat, "pvalues.txt")

Many thanks,


Scooter Morris

Jun 3, 2021, 10:01:52 AMJun 3
to cytoscape-helpdesk
Hi Yogesh,
   At the end of the day, you want an output file that looks like this:

Species 1\tSpecies 2\tCorr\tP-Value

The column labels can be pretty much whatever you want.  When you read it into Cytoscape (File->Import Network->From file...) you'll indicate "Species 1" as the source and "Species 2" as the target and the correlation and p-value columns as edge attributes.  Once you've done that, there are a number of tools in Cytoscape that allow you to filter the edges.

-- scooter

Yogesh Gupta

Jun 8, 2021, 4:24:43 AMJun 8
Thank you so much. Now I am able to import the network into cytoscape.
Just some more queries;
1) How should I import edge attributes (correlation & P-value) as local or shared?
2) How can I do filtering based on cor and p-value (edge attributes)
3) How can I identify the hub microbes in a network (based network topology calculation?

Many thanks,

You received this message because you are subscribed to a topic in the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit

Scooter Morris

Jun 10, 2021, 9:39:30 AMJun 10
to cytoscape-helpdesk
Hi Yogesh,
   Glad you got the network in! 
1. I would always import your edge attributes as shared unless you know that they won't apply if you make sub-networks from your network.  In your case, I'm pretty sure they will apply. 
2. As far as filtering, go to the filters tab in the control (left) panel, add a Column Filter and choose the correlation and/or p-value columns.  You can add multiple filters and create boolean expressions -- for example, you could look for only edges that have p-value < 0.05 AND correlations > 0.6, or whatever makes sense for your data. 
3. You can calculate the topology by going to "Tools->Analyze Network".

-- scooter
Message has been deleted

Yogesh Gupta

Jun 10, 2021, 7:13:23 PMJun 10
to cytoscape-helpdesk
Dear Scooter,

Thanks.  I am still not able to understand how to choose values in column filters for all correlations that have p-value < 0.05 AND correlations > 0.6 (positive and negative). like using add condition I have added p-value and or edge but not sure what value to put (between and inclusive section)? 
For cor edge should I put -0.6 and 0.6 and for the P-value edge should I put 0.05  in the last column ?
One more query;

How can I color modules and hub microbes in the network?

Many thanks

Scooter Morris

Jun 17, 2021, 11:58:07 AMJun 17
to cytoscape-helpdesk
Hi Yogesh,
If you go into the filters tab, you just click the "+" button twice and set up a filter for p-value and one for cor.  Then make sure to set the AND rather than OR at the top.  As far as your correlations, you have to decide if you want to select both positive and negative correlations.  I'm not really familiar enough with your data.

Once you've done the simple network calculations, there will be columns in the node table that have node degree.  You can use this to color your nodes.  See an example here:

-- scooter
Reply all
Reply to author
0 new messages