Solutions

All Cytoscape-related solutions assume that you work with Cytoscape 3.X.

Conversion of p-values into significances
The question is why we need to convery p-values before visualizing the (filtered) p-value matrix as a network. The answer is that in an adjacency matrix, a zero means no edge between two nodes, whereas a positive value means an edge between two nodes. Thus, a zero p-value, which would mean a strong edge, needs to be converted in a large positive value. Converting p-values into significances is a natural way to achieve this.

Black mutual information edges
The question is why the color for mutual information edges does not differentiate between positive and negative correlation. The answer is that mutual information is a general measure of dependency. For this reason, it can detect non-linear relationships that are difficult to detect with Spearman or Pearson (e.g. quadratic relationships), but for the same reason, it does not differentiate between a negative or a positive linear relationship.

Undirected network with CoNet
The question is why CoNet returns an undirected network for the selected configuration. The answer is: all 5 selected similarities, dissimilarities and correlation measures are symmetric, that is the similarity of A to B is the same as that of B to A.

Edge numbers in SPIEC-EASI
The task is to compute the number of positive and negative edges in the SPIEC-EASI network from the matrix of regression coefficients betaMat. This can be achieved as follows:
positive=length(betaMat[betaMat>0])/2
negative=length(betaMat[betaMat<0])/2
total=length(betaMat[betaMat!=0])/2
We divide by two since an edge is represented by two entries in the matrix.

SPIEC-EASI with positive and negative edge colors
The task is to visualize a SPIEC-EASI network with igraph such that positive and negative edges have different colors. The first step is to extract the signs of the regression coefficients from the matrix of regression coefficients. One way to do that is suggested below.

otu.ids=colnames(spiec.out$data)
edges=E(spiec.graph)
edge.colors=c()
for(e.index in 1:length(edges)){
	adj.nodes=ends(spiec.graph,edges[e.index])
	xindex=which(otu.ids==adj.nodes[1])
	yindex=which(otu.ids==adj.nodes[2])
	beta=betaMat[xindex,yindex]
	if(beta>0){
		edge.colors=append(edge.colors,"forestgreen")
	}else if(beta<0){
		edge.colors=append(edge.colors,"red")
	}
}
E(spiec.graph)$color=edge.colors

Unfortunately, phyloseq's plot_network function ignores edge colors, so we plot the graph using igraph's plotting function tkplot. Tkplot is interactive, thus allowing us to adjust the network layout. Before calling tkplot, we will beautify the SPIEC-EASI network by replacing OTU ids with class names and setting a few other parameters differently:
spiec.graph.b=spiec.graph
nodenames=V(spiec.graph.b)$name
V(spiec.graph.b)$name=getTaxonomy(nodenames, taxa.f, useRownames=TRUE)
E(spiec.graph.b)$arrow.size=5
V(spiec.graph.b)$color="white"
V(spiec.graph.b)$frame.color="black"
tkplot(spiec.graph.b)


SPIEC-EASI clustering with positive edges only
The task is to filter out the negative edges before clustering the SPIEC-EASI network. For this, we will look up the sign of regression coefficients, as for the edge coloring task. Here is the code:

otu.ids=colnames(spiec.out$data)
edges=E(spiec.graph)
filtered.edges=c()
for(e.index in 1:length(edges)){
	adj.nodes=ends(spiec.graph,edges[e.index])
	xindex=which(otu.ids==adj.nodes[1])
	yindex=which(otu.ids==adj.nodes[2])
	beta=betaMat[xindex,yindex]
	if(beta<0){
		filtered.edges=c(filtered.edges,edges[e.index])
	}
}
spiec.graph.pos=delete_edges(spiec.graph, filtered.edges)

The clustering commands from the tutorial can now be applied to spiec.graph.pos, resulting in Acidobacteriia as dominant class in the first cluster and Alphaproteobacteria as dominant class in the second cluster.

Importing SPIEC-EASI results into Cytoscape
The task is to import a SPIEC-EASI graph into Cytoscape, preserving OTU identifiers. This can be achieved with the following igraph function:
write.graph(spiec.graph,file=file.path(output.path,"spieceasi.ncol.txt"),format="ncol")
The resulting edge list needs to be edited to add a header line (one header for each column) and to replace white spaces by commas. This modified edge list file can then be directly imported into Cytoscape via File -> Import -> Network -> File. The first column codes for the source node, the second for the target node and the third with edge weights. If these are not recognized automatically, they can be assigned by clicking the column headers in the Cytoscape Network File Import window.

Hub node detection with CoNet and Cytoscape
The task is to detect the node with the largest number of positive/negative edges from a CoNet network. For this, you can go to the "Node table" and click on the two empty squares, to remove all node properties. You can then select the node properties of interest from the table-with-highlighted-column symbol. Select "name", "lineage", "degree", "negdegree" and "posdegree". You can then sort the table by clicking on "degree". If node degrees are sorted in ascending order, you can click again to sort in descending order. The top entry then corresponds to the node with the largest number of connections. You can repeat the same procedure to detect the node with the largest number of positive and negative connections.

Restore the CoNet network from random score files
The task is to restore the CoNet network without having to re-run permutations and bootstraps. For this, you can first load the restore setting file via the Settings loading/saving menu and then select the correct paths to the input files (arctic_soils.txt and arctic_soils_features.txt in the Data menu, conetPermutations.txt and conetBootstraps.txt in the Randomization menu). Since CoNet is restoring from already pre-computed random score files, the network will be generated quickly.

Clustering on positive edges
The question is why we cluster only on the positive edges of the network. The answer is that we are interested in taxa that occur together and that might therefore share certain properties. Most cluster algorithms (among them OH-PIN) do not distinguish between positive and negative edges and will therefore cluster taxa together that are connected by negative edges.

Positive edge selection in Cytoscape
The task is to select all positive edges from the CoNet network. Go to Select -> Use filter, choose "edge.interactionType" as column and click "Add". Select "copresence" and click "Apply Filter". Go to Select -> Nodes and click "Nodes connected by selected edges". Go to File -> New -> Network and click "From selected nodes, selected edges". Finally, layout the network (e.g. Layout->yFiles Layouts-> Organic).