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

aldex.glm expects different input in propr vs aldex2 packages, leading to errors when both are loaded #35

Open
rrohwer opened this issue Mar 11, 2022 · 0 comments

Comments

@rrohwer
Copy link

rrohwer commented Mar 11, 2022

I am trying to use both the propr and alex2 packages, but am getting errors with the aldex.glm function because depending on which package took precedence in loading it is either expecting or not expecting a model matrix to be provided as an argument.

Example workflow that's inconsistently giving me errors:

library(zCompositions)
library(propr)
library(ALDEx2)

otus <- readRDS(...)
otus <- cmultRepl(X = otus, z.warning = .9) 
covariates <- data.frame("A" = ..., "B" = ...)
mm <- model.matrix(~ A + B, covariates)
otus.aldex <- aldex.clr(reads = otus, conds = mm, ...)
otus.propr <- aldex2propr(alrex.clr = otus.aldex, how = "rho")
otus.clr <- otus.propr@logratio

otus.glm <- aldex.glm(clr = otus.aldex) # or sometimes it wants aldex.glm(clr = otus.aldex, mm)

otus.effect <- aldex.glm.effect(clr = otus.aldex)

And I solve the problem by doing this:

library(zCompositions)
detach("package:propr", unload=TRUE)
library(ALDEx2)

otus <- readRDS(...)
otus <- cmultRepl(X = otus, z.warning = .9) 
covariates <- data.frame("A" = ..., "B" = ...)
mm <- model.matrix(~ A + B, covariates)
otus.aldex <- aldex.clr(reads = otus, conds = mm, ...)
otus.glm <- aldex.glm(clr = otus.aldex) 
otus.effect <- aldex.glm.effect(clr = otus.aldex)

library(propr) # load propr AFTER using aldex2 package
otus.propr <- aldex2propr(alrex.clr = otus.aldex, how = "rho")
otus.clr <- otus.propr@logratio

Since these packages are designed to be used together, I thought you might consider this incompatibility a bug.

Thanks,
Robin

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