Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComBat doesn't work when data matrix contains only 1 variable #46

Open
lashmore opened this issue Mar 10, 2021 · 0 comments
Open

ComBat doesn't work when data matrix contains only 1 variable #46

lashmore opened this issue Mar 10, 2021 · 0 comments

Comments

@lashmore
Copy link

Any normalization method should work when there are multiple variables (p>1), as well as when there is only 1 variable (p=1) over N observations (samples).

Code that breaks because current implementation assumes a matrix with more than 1 variable:

library(bladderbatch)
data(bladderdata)
dat = bladderEset[1,]   **#### <- Here, isntead of first 50 variables, I just subset the data to the first variable ####**

pheno = pData(dat)
edata = exprs(dat)
batch = pheno$batch
mod = model.matrix(~as.factor(cancer), data=pheno)

# parametric adjustment
combat_edata1 = ComBat(dat=edata, batch=batch, mod=NULL, par.prior=TRUE, prior.plots=FALSE)

Error:

Error in apply(dat[, batch == batch_level], 1, function(x) { : 
  dim(X) must have a positive length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant