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

alr transformation method? #24

Open
aimirza opened this issue Jun 24, 2020 · 12 comments
Open

alr transformation method? #24

aimirza opened this issue Jun 24, 2020 · 12 comments

Comments

@aimirza
Copy link

aimirza commented Jun 24, 2020

I would like to use additive log ratio (alr) transformation. Does ALDEx2 support this? I tried setting denom to an index of the feature I wanted to use as the denominator but the error says Error in aldex.clr.function(reads, conds, mc.samples, denom, verbose, : please supply a vector of indices for the denominator. I had previously installed aldex2 from a different source and I was able to specific a single index for the parameter denom. After uninstalling and then installing using devtools::install_github("ggloor/ALDEx_bioc"), I can no longer specify a single feature index.

I am currently using aldex version 1.19.5

@aimirza
Copy link
Author

aimirza commented Jun 24, 2020

I get the same error message even when I specify denom="lvha". I had no problems with my previous installation of aldex2. I also upgraded R to version 4.0.2

@aimirza
Copy link
Author

aimirza commented Jun 24, 2020

Supplying a vector of indices also didn't work and the same error message appears: Error in aldex.clr.function(reads, conds, mc.samples, denom, verbose, : please supply a vector of indices for the denominator. Same error whether I use aldex() or aldex.clr() function.

@ggloor
Copy link
Owner

ggloor commented Jun 24, 2020

Hi. I have tried to reproduce this with the selex dataset and the current version of ALDEx2 from bioconductur (1.20.0), which should be the same as 1.19.5. The following code runs fine:

library(ALDEx2)
data(selex)
conds <- c(rep("A",7), rep("B",7))
x <- aldex.clr(selex, conds, denom=4)

can you provide me with a reproducible example?

sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] C/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] ALDEx2_1.20.0 zCompositions_1.3.4 truncnorm_1.0-8
[4] NADA_1.6-1.1 survival_3.1-12 MASS_7.3-51.5

loaded via a namespace (and not attached):
[1] matrixStats_0.56.0 lattice_0.20-41
[3] IRanges_2.22.2 bitops_1.0-6
[5] GenomeInfoDb_1.24.0 grid_4.0.0
[7] stats4_4.0.0 zlibbioc_1.34.0
[9] XVector_0.28.0 S4Vectors_0.26.1
[11] Matrix_1.2-18 splines_4.0.0
[13] BiocParallel_1.22.0 tools_4.0.0
[15] Biobase_2.48.0 RCurl_1.98-1.2
[17] DelayedArray_0.14.0 parallel_4.0.0
[19] compiler_4.0.0 BiocGenerics_0.34.0
[21] multtest_2.44.0 GenomicRanges_1.40.0
[23] SummarizedExperiment_1.18.1 GenomeInfoDbData_1.2.3

@aimirza
Copy link
Author

aimirza commented Jun 24, 2020

The problem seems to occur when a model matrix is provided to conds and does not occur when a vector is provided to conds, like in your example. Making the index as.integer seems to make it work.

data(selex)
metadata <- c(rep("A",7), rep("B",7))
conds <- model.matrix(~ metadata )

aldex.clr(selex, conds=conds, mc.samples=16, denom=10) # ERROR: ...please supply a vector of indices for the denominator
aldex.clr(selex, conds=conds, mc.samples=16, denom=as.integer(10)) # WORKS

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] ALDEx2_1.20.0 zCompositions_1.3.4 truncnorm_1.0-8 NADA_1.6-1.1 survival_3.1-12 MASS_7.3-51.6

loaded via a namespace (and not attached):
[1] XVector_0.28.0 GenomeInfoDb_1.24.2 pillar_1.4.4 compiler_4.0.2
[5] zlibbioc_1.34.0 bitops_1.0-6 tools_4.0.2 lifecycle_0.2.0
[9] tibble_3.0.1 gtable_0.3.0 lattice_0.20-41 pkgconfig_2.0.3
[13] rlang_0.4.6 Matrix_1.2-18 DelayedArray_0.14.0 cli_2.0.2
[17] rstudioapi_0.11 parallel_4.0.2 GenomeInfoDbData_1.2.3 dplyr_1.0.0
[21] generics_0.0.2 vctrs_0.3.1 S4Vectors_0.26.1 IRanges_2.22.2
[25] stats4_4.0.2 grid_4.0.2 tidyselect_1.1.0 Biobase_2.48.0
[29] glue_1.4.1 R6_2.4.1 fansi_0.4.1 BiocParallel_1.22.0
[33] ggplot2_3.3.2 purrr_0.3.4 magrittr_1.5 matrixStats_0.56.0
[37] GenomicRanges_1.40.0 scales_1.1.1 ellipsis_0.3.1 splines_4.0.2
[41] BiocGenerics_0.34.0 SummarizedExperiment_1.18.1 assertthat_0.2.1 colorspace_1.4-1
[45] RCurl_1.98-1.2 munsell_0.5.0 crayon_1.3.4

@ggloor
Copy link
Owner

ggloor commented Jul 9, 2020

the aldex.effect function is now fully compliant with an ALR denominator.
you can try it by installing from source. I will push it to the development version of bioconductor

@ggloor ggloor closed this as completed Jul 9, 2020
@deniando
Copy link

Hi, I am still having the issue mentioned by @aimirza. When using a model matrix, the only denominator that works for aldex.clr() is "all". I would like to use "iqlr" and "lvha", but this results in the error about supplying a vector of indices. This error can be replicated by running the code in section 4.6 (Complex study designs and the aldex.glm module) of the Bioconductor vignette for the selex dataset. Any suggestions appreciated!

@roshonda-jones
Copy link

Hi, I am still having the issue mentioned by @aimirza. When using a model matrix, the only denominator that works for aldex.clr() is "all". I would like to use "iqlr" and "lvha", but this results in the error about supplying a vector of indices. This error can be replicated by running the code in section 4.6 (Complex study designs and the aldex.glm module) of the Bioconductor vignette for the selex dataset. Any suggestions appreciated!

@deniando Did you manage to figure this out? I am running into the same issues with aldex.clr() and aldex.glm()

@deniando
Copy link

Hi @roshonda-jones, no unfortunately I could not get this working.

@ggloor
Copy link
Owner

ggloor commented Feb 27, 2023

I'm sorry for this, I have a short-term fix and can push a real fix to the next release.

The issue is that the value passed must be an integer. So you can do the following:
denom <- c(1,2)
x <- aldex.clr(selex, mm, mc.samples=1, denom=as.integer(denom))

@ggloor ggloor reopened this Feb 27, 2023
@ggloor
Copy link
Owner

ggloor commented Feb 27, 2023

if you want to use the LVHA or IQLR, then you will need to choose the indices of the denominator manually via pairwise comparisons.

The indices of the denominator will be in the aldex.clr object (x) as x@denom

This is something I will fix as well (again) in the next release

@deniando
Copy link

Thanks for the advice @ggloor and the intended update.

@roshonda-jones
Copy link

Thanks this worked for me.

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

4 participants