Open gastronaut82 opened 1 year ago
xt<-microbiome::transform(ex1, 'clr')
First of all, don't do this ⬆️ . spiec.easi
applies a clr transformation with a pseudocount addition so the data you are supplying is incorrect.
plot_network
is a phyloseq function, so I'm not entire sure what's going on. If I had to guess, the Phylum column contains all missing values or something. Without the looking at your data, I can't be sure.
I see thank you - I thought you had to CLR transform first. Okay, I will try to work with igraph directly to color accordingly
Relatedly - do you recommend rarefaction prior to applying Spiec-Easi?
Hi there, I constructed a network at the family level for my microbial data set, but I want to color the dots by Phylum. I'm having a lot of trouble doing this.
Here's my code:
**xt<-microbiome::transform(ex1, 'clr') mb<-spiec.easi(xt, method='mb', lambda.min.ratio=1e-2, nlambda=20, pulsar.params=list(rep.num=50))
ig2.mb <-adj2igraph(getRefit(mb), vertex.attr = list(name=as.vector(tax_table(xt)[,"Family'])))
plot_network(ig2.mb, xt, type='taxa')**
My code successfully creates the network at the family level, but I can't color by phylum. I have tried:
plot_network(ig2.mb, xt, type='taxa', color="Phylum") which gives me
Error: Must request at least one colour from a hue palette.
Then I've tried,
plot_network(ig2.mb, xt, type='taxa', color=tax_table(xt)[,"Phylum"])
which gives me
Error in
parse_expr()
: !x
must contain exactly 1 expression, not 26.Help!
Thanks