Open BinhongLiu opened 3 years ago
The old version don't support the function abundance table, but the newest version (github) has supported it. Note, if you don't want to use the relative abundance, and you want to use the table you has processed previously. You should set standard_method
argument to count
, which mean that original input dataset (you has processed previously,eg: this is efficient to use the count data after rarefing) will be used. Of course, you also can use the method of decostand
in vegan
to standardize.
Yes, you were right! I used the relative abundance pathway data (_ps_xx <- microbiome::transform(psxx, "compositional")) to perform the _diffanalysis. Also, I've installed the newest version (github). However, the error was still there. It seems to be that something related with the row.names is wrong but I don't know how to fix it. Could you provide a demo function abundance table and tax_table that could perform the analysis successfully? Thank you for your help! Hongbin
You can try to add type="others"
in diff_analysis
. I could not get more detail information,or would you please send the phyloseq class to me by email.
Thanks for your help! I've save the ps object and sent it to your email xshuangbin@163.com !
Ok,I viewed table of the pathway annotation, it only have one rank, don't contain hierarchical relationship. In the condition, the input is phyloseq
class, it was not be supported. There are two methods to solve the problem.
phyloseq
class to data.frame. since diff_analysis
also support data.frame
as input.library(MicrobiotaProcess)
tax <- data.frame(ps_xx1@tax_table, check.names=FALSE)
sampleda <- data.frame(ps_xx1@sam_data, check.names=FALSE)
otuda <- data.frame(ps_xx1@otu_table, check.names=FALSE)
featuretab <- merge(otuda, tax, by=0)
rownames(featuretab) <- as.vector(featuretab$Rank1)
featuretab$Row.names <- NULL
featuretab$Rank1 <- NULL
featuretab <- data.frame(t(featuretab)*100, check.names=FALSE)
diffres <- diff_analysis(obj=featuretab,
sampleda=sampleda,
classgroup="Group",
#alltax=FALSE,
mlfun="lda",
filtermod="pvalue",
standard_method=NULL,
firstcomfun = "kruskal.test",
firstalpha=0.05,
strictmod=TRUE,
secondcomfun = "wilcox.test",
subclmin=3,
type="others",
subclwilc=TRUE,
secondalpha=0.01,
lda=3)
diffres
the taxda
was not be provided, so the result is not be visualized by ggdiffcalde
. But you can use ggdiffbox
to visualize it.
p <- ggdiffbox(
diffres,
l_xlabtext="relative abundance (%)",
box_notch=FALSE,
colorlist=c("#00AED7", "#009E73")
)
p
you also can use ggdifftaxbar
to visualize each discriminative feature by barplot.
ggdifftaxbar(
obj=diffres,
xtextsize=1.5,
output="function_biomarkder_barplot",
coloslist=c("#00AED7", "#009E73")
)
Thanks so much for your help! This method solves my issue perfectly! Cheers!
Hi, I just trying to apply _diffanalysis function to the phyloseq object built with picrust2-predicted pathway abundance table.
The otu-table is like this:
The tax_table is like this:
There was an error happened when running the _diffanalysis analysis: Error in
.rowNamesDF<-
(x, value = value) : invalid 'row.names' lengthThe code is here:
sampleD28-10F sampleD28-10F stool High 28 10 1st 1.520 sampleD28-11F sampleD28-11F stool High 28 11 1st 4.240 sampleD28-12F sampleD28-12F stool High 28 12 1st 9.600 sampleD28-13F sampleD28-13F stool Low 28 13 1st 0.977 sampleD28-14F sampleD28-14F stool Low 28 14 1st 5.140 sampleD28-15F sampleD28-15F stool Low 28 15 1st 8.860
Error in
.rowNamesDF<-
(x, value = value) : invalid 'row.names' lengthIs there any method to fix this error? Many thanks!