Question: How to make a species co-occurrence network in Cytoscape?
0
gravatar for dpc
6 weeks ago by
dpc140
India
dpc140 wrote:

I have list of microbes enriched in test and control samples along with their relative abundance. Now, I want to make a species co-occurrence network where positively (R>0.6; P<0.05) and negatively (R<-0.6; P<0.05) co-related microbes are connected with edges of different colours. Also, the control and test microbes will be clustered separately. I want a figure like the following one. This figure has been generated in Cytoscape. But I don't know which plugin/application to use. Can anyone please help me?

enter image description here

Many thanks, dpc

microbiome • 261 views
ADD COMMENTlink modified 6 weeks ago • written 6 weeks ago by dpc140
1
gravatar for Jean-Karim Heriche
6 weeks ago by
EMBL Heidelberg, Germany
Jean-Karim Heriche23k wrote:

I would play with attribute columns for nodes and edges as explained in this post. Do the clustering however you want and assign a node attribute corresponding to cluster membership. Do the same for edges with an attribute corresponding to the type of connection.

ADD COMMENTlink written 6 weeks ago by Jean-Karim Heriche23k

Hi Jean-Karim Heriche!!! Should I make a network first and then visualise with cytoscape? Or, I can just use the relative abundanve table as input and cytoscape will calculate the spearman's correlation coefficient and make the network itself?

Thanks

ADD REPLYlink written 6 weeks ago by dpc140

I prepare the network first because I use Cytoscape only for visualization so I am not familiar with any possibility of building the network from within Cytoscape.

ADD REPLYlink written 6 weeks ago by Jean-Karim Heriche23k

How can I make such network in R? Is there any package exists? Do you know any tutorial?

ADD REPLYlink written 6 weeks ago by dpc140

I use the igraph R package. You can also use it for visualization as detailed in this tutorial.

ADD REPLYlink written 6 weeks ago by Jean-Karim Heriche23k
0
gravatar for dpc
6 weeks ago by
dpc140
India
dpc140 wrote:

No. I mean to say, how can I calculate the spearman's correlation among the taxa with P-value from my relative abundance table and generate an output table that is readable to Cytoscape. Here is the format of my data table:

type                test    control control control control test
clade_name      ERR1_profile    ERR2_profile    ERR3_profile    ERR4_profile    ERR5_profile    ERR6_profile
Actinobaculum_sp        0   0       0       0       0       0
Actinomyces_graevenitzii    0   0       0       0       0       0
Actinomyces_naeslundii      0   0       0       0       0.00269     0
Actinomyces_odontolyticus   0   0       0.00341     0       0.03155     0
Actinomyces_oris        0   0       0       0.00155     0.00186     0
Actinomyces_sp_HMSC035G02   0   0       0       0       0.0066      0
Actinomyces_sp_HPA0247      0   0       0       0       0       0
Actinomyces_sp_ICM47        0   0       0.0042      0       0       0
Actinomyces_sp_S6_Spd3      0   0       0       0       0       0
Actinomyces_sp_oral_taxon_181   0   0       0       0       0       0
Actinomyces_sp_oral_taxon_414   0   0       0       0       0       0
Actinomyces_turicensis      0   0       0       0       0       0
Varibaculum_cambriense      0   0       0       0       0       0
Aeriscardovia_aeriphila 0.00454 0       0       0.00593     0.00257 0
Alloscardovia_omnicolens    0   0       0       0       0       0

It's been little distorted table (tried a lot to fix). However, the first row shows the type (control or test) of samples, second rows show the sample names, all other rows show each species with their relative abundance.

Thanks, dpc .

ADD COMMENTlink written 6 weeks ago by dpc140
1

you can use SpiecEasi or SparCC.

ADD REPLYlink written 6 weeks ago by andres.firrincieli860

I have generated a correlation matrix from R using Hmisc function. Which has four columns bacteria(row), bacteria(column), correlation coefficient (cor) and P-value (p) like this:

            row                       column                       cor              p
Actinobaculum_sp_oral_taxon_183 Actinomyces_graevenitzii    -0.083166733306677  0.557766591033679
Actinobaculum_sp_oral_taxon_183 Actinomyces_naeslundii  -0.057666197516258  0.684693748325992
Actinomyces_graevenitzii    Actinomyces_naeslundii  -0.057666197516258  0.684693748325992
Actinobaculum_sp_oral_taxon_183 Actinomyces_odontolyticus   0.082972778302491   0.558688695520664
Actinomyces_graevenitzii    Actinomyces_odontolyticus   0.086259815138003   0.543159275510664
Actinomyces_naeslundii  Actinomyces_odontolyticus   0.260101357406385   0.062572519939439
Actinobaculum_sp_oral_taxon_183 Actinomyces_oris    0.001812984437111   0.989822610583224
Actinomyces_graevenitzii    Actinomyces_oris    0.078226921082765   0.581472276924872
Actinomyces_naeslundii  Actinomyces_oris    0.164725112347852   0.243223831404869
Actinomyces_odontolyticus   Actinomyces_oris    0.321304480536897   0.02020092245847
Actinobaculum_sp_oral_taxon_183 Actinomyces_sp_HMSC035G02   -0.009475829184974  0.946843170060088
Actinomyces_graevenitzii    Actinomyces_sp_HMSC035G02   0.223167925805104   0.111768183795273
Actinomyces_naeslundii  Actinomyces_sp_HMSC035G02   0.127195351524484   0.368876768685618
Actinomyces_odontolyticus   Actinomyces_sp_HMSC035G02   0.728031815255434   9.61068558069655E-10
Actinomyces_oris    Actinomyces_sp_HMSC035G02   0.489804314937454   0.000228307144797
Actinobaculum_sp_oral_taxon_183 Actinomyces_sp_HPA0247  -0.122407920609607  0.387315423215962
Actinomyces_graevenitzii    Actinomyces_sp_HPA0247  0.067751018558563   0.633196834736485
Actinomyces_naeslundii  Actinomyces_sp_HPA0247  0.201272736533905   0.152485894497411
Actinomyces_odontolyticus   Actinomyces_sp_HPA0247  0.356837988184345   0.009411107538178
Actinomyces_oris    Actinomyces_sp_HPA0247  0.045264285267062   0.750003932963803
Actinomyces_sp_HMSC035G02   Actinomyces_sp_HPA0247  0.242103552588312   0.083769232798563

But, it contains all P-values and correlation coefficient (R). I dont know how to import it into cytoscape and visualize only R<-0.06, R>0.06 and P<0.05. Any suggestion?

Thanks, dpc

ADD REPLYlink modified 6 weeks ago • written 6 weeks ago by dpc140
2

First, use R to filter out rows having a p > 0.05. Then, open cytoscape and go to file > import > network > file, to import the filtered table. Set the first (row) and second (column) columns as source and target, while cor as edge attribute. The order does not matter as your network is undirected.

ADD REPLYlink written 6 weeks ago by andres.firrincieli860

Thanks everyone. I have successfully generated a network from cytoscape. But, I am unable to change size of the nodes according to their relative abundances. How can I do that?

Thanks, dpc

ADD REPLYlink written 6 weeks ago by dpc140
1

First step: load the network Then: go to file > Import > Table > File, to import the abunance table

Now, you can either change the size of the nodes according to the their relative abundance just in one sample or (better solution) change each single node into a pie chart showing the relative abundance of each taxa (node) across your samples.

To change the node size go to: control panel (left panel) > style > Node > Size > assign Column to the column containing the relative abundance values of each node, and set Mapping Type as Continuous Mapping

For the pie charts: control panel (left panel) > style > Node > click Properties > Show All. Then follow this tutorial

ADD REPLYlink written 6 weeks ago by andres.firrincieli860

Thanks andres. I have generated a network where edge colour represents correlation which I have done with continuous mapping. I also trying to create legend with "legend creator" app. But, here the edge stroke colour attribute is not showing in legend table. How can I incorporate that legend in my network?

thanks, dpc

ADD REPLYlink written 6 weeks ago by dpc140

This question has its own post here.

ADD REPLYlink written 6 weeks ago by Jean-Karim Heriche23k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1649 users visited in the last hour