Open lvclark opened 3 years ago
I was able to work around this by calling phyloseq::distance
followed by vegan::metaMDS
.
Hi @Ivclark,
I had similar issue, and I managed by running this way and visualizing with scatterplot3d package. Maybe, you could adapt it to your case:
library("scatterplot3d") # load
nmds <- ordinate(physeq3, "NMDS", "bray", "unifrac", weighted=TRUE)
s3d <- scatterplot3d(nmds$species, angle = 55,type="h",
main="3D NMDS",
xlab = "NMDS-1",
ylab = "NMDS-2",
zlab = "NMDS-3", pch = 16,size=6,
grid=TRUE, box=FALSE)
s3d
text(s3d$xyz.convert(pcoa$species), labels = rownames(nmds$points),
cex= 0.7)
greetings @lvclark, i'm a bit new to phyloseq, was wondering if you could describe the code/function you developed to get a 3-ordination and subsequent plot out for phyloseq.
Hi @TonyMane in this particular case I did
dist_unifrac <- phyloseq::distance(ps_prop, "unifrac")
nmds_unifrac <- vegan::metaMDS(dist_unifrac, k = 3)
See https://github.com/HPCBio/plotly_microbiome, a package I made for making 3D plots from the output. Install then do ?beta_diversity_3d
.
thanks, much appreciated. One question, it doesn't seem to handle the output of nmds_unifrac from above: beta_diversity_3d(nmds_unifrac) Error in data.frame(x$points[, 1:3], metadata[, color.column], Label = rownames(x$points)) : argument "metadata" is missing, with no default
Please see the help page. In that case you would be using the method for monoMDS
and so you need to provide values for the metadata
and color.column
arguments.
greetings, was just wondering if there was any way to plot these directly to a pdf file. I run all the commands and get the 'index.html' files to plot, then export as a .png file. But it would be ideal to have .pdf files.
@TonyMane See if this helps https://plotly.com/r/static-image-export/
Hi @TonyMane in this particular case I did
dist_unifrac <- phyloseq::distance(ps_prop, "unifrac") nmds_unifrac <- vegan::metaMDS(dist_unifrac, k = 3)
See https://github.com/HPCBio/plotly_microbiome, a package I made for making 3D plots from the output. Install then do
?beta_diversity_3d
.
Hi, I'm a new user of plotly_microbome and new(ish) to bioinformatics. Can I suggest the help page contains information on the data structure of your examples? Thanks
@RachBioHaz I made that package mostly for internal use at an old job, so I'm not maintaining it any more. But ps_prop
would be a phyloseq object with abundances converted to proportions.
I'm doing NMDS with
ordinate
and trying to get three axes rather than two. I see in the documentation that I can setk = 3
. This works with the Bray distance, but not with UniFrac or weighted UniFrac. It seems to be an issue with argument handling.