Comments (4)
Hi @stan-iakhno,
The error message means the group
variable you specified in the ancombc
function contains less than 2 categories or levels.
Suppose your metadata is called meta_data
and the group variable is called group
, you can check the number of levels it has by executing :
length(unique(meta_data[, group]))
.
If it turns out to be less than 2, you can consider either using a different group
variable or specifying group = NULL
in the ancombc
function.
Best,
Huang
from ancombc.
Thanks for your reply @FrederickHuangLin ! I was trying to replicate the issue myself and got a different error.
Error in tapply(present_table[i, ], group_data, function(x) mean(x, na.rm = TRUE)) :
arguments must have same length
In addition: Warning message:
In data_prep(phyloseq, group, zero_cut, lib_cut, global = global) :
The multi-group comparison will be deactivated as the group variable has < 3 categories.
What could go wrong here?
Here is the code I run:
library(dplyr)
library(nloptr)
library(ANCOMBC)
out = ancombc(phyloseq = ps, formula = "diet",
p_adj_method = "holm", zero_cut = 0.90, lib_cut = 1000,
group = "diet", struc_zero = TRUE, neg_lb = FALSE,
tol = 1e-5, max_iter = 100, conserve = TRUE,
alpha = 0.05, global = TRUE)
KR. Stan
from ancombc.
Hi @stan-iakhno,
You caught a BUG! It turns out the ANCOMBC algirithm assumes that rownames are taxa names by default. The following codes should work:
otu_mat = as(otu_table(ps), "matrix")
meta = as(sample_data(ps), "data.frame")
tax_mat = as(tax_table(ps), "matrix")
OTU = otu_table(t(otu_mat), taxa_are_rows = TRUE)
META = sample_data(meta)
TAX = tax_table(tax_mat)
ps2 = phyloseq(OTU, META, TAX)
out = ancombc(phyloseq = ps2, formula = "diet",
p_adj_method = "holm", zero_cut = 0.90, lib_cut = 1000,
group = "diet", struc_zero = TRUE, neg_lb = FALSE,
tol = 1e-5, max_iter = 100, conserve = TRUE,
alpha = 0.05, global = TRUE)
Again, thanks for catching this and I will update the package accordingly.
Best,
Huang
from ancombc.
It is a pleasure! Thanks for a very nice piece of scientific work!
Best. Stanislav
from ancombc.
Related Issues (20)
- ancombc2 output fmt length exceeds maximal format length 8192
- Models used for DA and binomial outcomes
- Additive log-ratio on counts vs proportions
- ANCOM_BC2's Global test approach?
- passed_ss_ not found HOT 2
- R session aborted while running ANCOMBC2 HOT 2
- Interpreting negative lfc values for "intercept" in primary result
- Installing ANCOMBC HOT 2
- Continuous variable as main variable of interest
- Different results with ancombc2 depending on the order of the taxa
- Visualization the output of ancombc2
- Pseudo-count sensitivity testing when no pseudo-counts are added
- Error in { : task 1 failed - "values must be length 1, but FUN(X[[2]]) result is length 0"
- Help with ancombc2 analysis with repeated measures
- Extract normalised counts for linear models outside of ANCOMBC?
- Failure to install ANCOMBC neither windows nor Ubuntu HOT 1
- global test and pairwise comparisons giving pvals of all NA or all 1
- Feature Request: Support for Using Taxa as Explanatory Variables in ANCOMBC2
- "Error: subscript contains invalid names" when running ancombc2 HOT 1
- Interpreting error when running ancombc2 function: Error in is.infinite(o1) : default method not implemented for type 'list'
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 ancombc.