Comments (1)
Hey,
please excuse my late response. I just had a closer look into this issue and the way the edgeFilter
works is indeed not nice.
Some background on what happens within netConstruct() if the network is based on correlations:
First, correlations are estimated. These are transformed into dissimilarities (according to how dissFunc
is set) and the dissimilarities, in turn, are transformed into similarities, which are finally used as adjacency matrix in a weighted network. This transformation approach is necessary because correlations range from -1 to 1 but we need values in [0,1] for the edge weights. Further details on the available transformation methods can be found in our manuscript as well as in the package docu.
At the moment, there are three possible options for when to do the edge filter step:
1) During network construction
The threshold is applied to the estimated associations and transformation comes afterwards. In this case, all further steps (network analysis and plotting) is applied to the filtered network.
2) Using edgeFilter
and edgeFilterPar
when plotting the network
Threshold is applied to the adjacency matrix, which contains the edge weights. The difference to the former method is that network analysis is applied to the unfiltered network and edges are only filtered in the plot. Here, edges are filtered before the layout is computed.
3) Using edgeInvisFilter
and edgeInvisPar
when plotting the network
Same as before but edges are filter after the layout is computed. This filter is useful to just hide some edges without changing the layout and can be applied in addition to the other filters.
Now, the problem is that in the latter two methods, the threshold is applied to the transformed edge weights so that - in the current NetCoMi version - the threshold has to be transformed as well. I see that it's not solved nicely and will fix this in a future update. For now, I can only provide an example on how to use the filter options properly:
Example:
In this example, edges corresponding to an absolute correlation |r| < 0.3 are filtered out.
For a better understanding what happens within netConstruct, here is the code of the two functions for transforming associations into dissimilarities, which are used if disFunc = "signed"
and disFunc = "unsigned"
is chosen:
signed <- function(x){
sqrt(0.5 * (1-x))
}
unsigned <- function(x){
sqrt(1 - x^2)
}
Note: In the current version, the edgeFilter
cannot be used properly if disFunc = "signed"
because we would have to filter out edges with weights between 1 - signed(-0.3)
and 1 - signed(0.3)
, but edgeFilterPar
accepts only one value. With the "signed" transformation, we would filter out all negative correlations, which happened in your case.
Thus, we have to use the "unsigned" transformation:
library(NetCoMi)
data("amgut2.filt.phy")
amgut_net1 <- netConstruct(amgut2.filt.phy,
measure = "pearson",
zeroMethod = "multRepl",
normMethod = "clr",
sparsMethod = "none",
dissFunc = "unsigned")
amgut_props1 <- netAnalyze(amgut_net1, clustMethod = "cluster_fast_greedy",
weightDeg = TRUE, normDeg = FALSE)
thresh <- 1 - unsigned(0.3)
plot(amgut_props1,
edgeFilter = "threshold",
edgeFilterPar = thresh)
And here is also an example for the first method, which leads to the same plot, except for node colors. These represent the cluster assignment, which is computed for the filtered network with the first method and for the unfiltered network with method two and three.
amgut_net1 <- netConstruct(amgut2.filt.phy,
measure = "pearson",
zeroMethod = "multRepl",
normMethod = "clr",
dissFunc = "unsigned",
sparsMethod = "thresh",
thresh = 0.3)
amgut_props1 <- netAnalyze(amgut_net1, clustMethod = "cluster_fast_greedy")
plot(amgut_props1)
I hope that clarifies how the threshold filter works at the moment. And I'll have to implement a better solution asap.
Best,
Stefanie
from netcomi.
Related Issues (20)
- How to look at sub-clusters? HOT 1
- output format for Gephi visualization HOT 2
- Colored by phylum HOT 2
- stability values using spieceasi HOT 1
- Problems while installing the NetCoMi HOT 1
- How to find a "good" algorithm and parameter set HOT 1
- RNA-seq data(Plant) HOT 1
- Error in length of dimnames after permutation testing HOT 1
- Labelling only certain taxa of interest HOT 1
- Will this package works for all lineage levels?
- Cross domain interactions HOT 3
- calculate the betweenness centrality as hubs HOT 2
- Looking for guidance on MANs Inference with samples from different metagenomics/metatranscriptomics studies HOT 4
- Error in NetConstruct for network comparison : "subscript out of bounds" HOT 4
- edges dont color correctly with negative correlations HOT 2
- Could I manually modify the color of each node? HOT 2
- Problem with the targets IDs in export to gephi HOT 4
- including correlations with environmental or experimental variables? HOT 3
- Understanding netConstruct() output HOT 1
- Issue with node size and netCompare HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netcomi.