Closed susheelbhanu closed 1 year ago
Hi, It should work kinda like this as far as I got it.
counts = otu_table(phytted) %>% as.data.frame()
colData = meta(physeq) %>% as.data.frame
phyExp = SummarizedExperiment(assays = list(counts = counts), colData = colData)
res.lefse = lefser(expr = phyExp, groupCol = "Group")
Hi.. thank you, but that minimal example did not work. I tried the following, and still get an error as such:
Error in svd(X, nu = 0L) : a dimension is zero
This is what I ran
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("lefser")
library(lefser)
library(tidyverse)
library(phyloseq)
BiocManager::install("microbiome")
library(microbiome)
# https://joey711.github.io/phyloseq/import-data.html
# Create a pretend OTU table that you read from a file, called otumat
otumat = matrix(sample(1:100, 100, replace = TRUE), nrow = 10, ncol = 10)
otumat
rownames(otumat) <- paste0("OTU", 1:nrow(otumat))
colnames(otumat) <- paste0("Sample", 1:ncol(otumat))
otumat
taxmat = matrix(sample(letters, 70, replace = TRUE), nrow = nrow(otumat), ncol = 7)
rownames(taxmat) <- rownames(otumat)
colnames(taxmat) <- c("Domain", "Phylum", "Class", "Order", "Family", "Genus", "Species")
taxmat
library("phyloseq")
OTU = otu_table(otumat, taxa_are_rows = TRUE)
TAX = tax_table(taxmat)
OTU
physeq = phyloseq(OTU, TAX)
physeq
sampledata = sample_data(data.frame(
Location = sample(LETTERS[1:2], size=nsamples(physeq), replace=TRUE),
Depth = sample(50:1000, size=nsamples(physeq), replace=TRUE),
row.names=sample_names(physeq),
stringsAsFactors=FALSE
))
sampledata
library("ape")
random_tree = rtree(ntaxa(physeq), rooted=TRUE, tip.label=taxa_names(physeq))
plot(random_tree)
physeq1 = merge_phyloseq(physeq, sampledata, random_tree)
physeq <- physeq1
# https://github.com/waldronlab/lefser/issues/14#issuecomment-786707178
counts = otu_table(physeq) %>%
as.data.frame()
colData = meta(physeq) %>%
as.data.frame
phyExp = SummarizedExperiment(assays = list(counts = counts),
colData = colData)
res.lefse = lefser(expr = phyExp,
groupCol = "Location")
Could you please let me know how to fix this? Thank you!
Thank you for your answer, I was able to run this step, but there is no taxonomy information, only the OTU ID used for the analysis of the results.
Could you please provide a reproducible example? Thank you!
Hi @susheelbhanu
This is more of a question for SummarizedExperiment
rather than lefser
. I recommend that you see the SummarizedExperiment vignette at https://bioconductor.org/packages/SummarizedExperiment
Best,
Marcel
Hi,
I'm looking to implement this analyses on a dataset that i have. However, it is unclear how you went from, say a table of count data and metadata to a
SummarisedExperiment
. Could you please provide an example for the same?Thank you!