Comments (1)
Hi,
I think these are two questions: How to plot only nodes that are directly connected to a certain node? How to plot nodes belonging to a certain cluster?
Since I'm not sure what you're interested in, I'll give you an example for both :)
library(NetCoMi)
library(phyloseq)
# Load data sets from American Gut Project (from SpiecEasi package)
data("amgut2.filt.phy")
# Agglomerate to genus level
amgut_genus <- tax_glom(amgut2.filt.phy, taxrank = "Rank6")
# Rename taxonomic table and make Rank6 (genus) unique
amgut_genus_renamed <- renameTaxa(amgut_genus,
pat = "<name>",
substPat = "<name>_<subst_name>(<subst_R>)",
numDupli = "Rank6")
# Network construction
amgut_net <- netConstruct(amgut_genus_renamed,
taxRank = "Rank6",
measure = "pearson",
#filtTax = "highestVar",
#filtTaxPar = list(highestVar = 50),
zeroMethod = "pseudoZO",
normMethod = "clr",
sparsMethod = "threshold",
thresh = 0.3)
# Network analysis
amgut_props <- netAnalyze(amgut_net)
### Network plots ###
# Plot the whole network
plot(amgut_props, nodeColor = "cluster")
# Plot only nodes belonging to cluster 1
clust1 <- amgut_props$clustering$clust1
cl1 <- names(clust1[clust1 == 1])
plot(amgut_props, nodeFilter = "names", nodeFilterPar = cl1)
# Plot only nodes that are connected to a certain taxon (here Salmonella)
sel <- amgut_net$edgelist1[amgut_net$edgelist1$v1 == "Salmonella", "v2"]
sel <- c("Salmonella", sel)
# Alternatively, you can extract them from the adjacency matrix
adja_salmon <- amgut_net$adjaMat1["Salmonella", ]
sel <- names(adja_salmon[adja_salmon != 0])
plot(amgut_props, nodeFilter = "names", nodeFilterPar = sel)
from netcomi.
Related Issues (20)
- 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
- How to easily understand the GCM heatmap
- Adding a CITATION.cff file with the article information to help software citation
- Comparing more than two groups of samples in NetCoMi
- Highlighting specific hubs in the graph
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.