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

appear to be constant with groups #32

Closed
celinechen1885 opened this issue Sep 11, 2023 · 8 comments
Closed

appear to be constant with groups #32

celinechen1885 opened this issue Sep 11, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@celinechen1885
Copy link

Hi!

I'm working with a shotgun metagenomics data, and we aim to analyze the functional profile.
we have 224 samples in total, with 356 different pathways.
below are the codes that I used
metagenomic_lefse <- read.csv
se <- SummarizedExperiment(assays = list(counts = as.matrix(metagenomic_lefse)))
colData(se) <- DataFrame(metadata)
se$group <- as.factor(se$group)
se$DI <- as.factor(se$DI)
se_relab <- relativeAb(se)

res <- lefser(se_relab, groupCol = "group")

I got an error message:
Error in lda.default(x, grouping, ...) :
variables 85 145 appear to be constant within groups

Could anyone help me with it?
Thanks!

@celinechen1885 celinechen1885 changed the title appear ti ve constant with groups appear to be constant with groups Sep 12, 2023
@lwaldron
Copy link
Member

lwaldron commented Jan 8, 2024

This seems to happen with normalization to column sums adding to 1 instead of 1 million as in the original implementation. The following code after normalization accomplishes this, and we will make this the default of the relativeAb function.

assay(rse) = assay(rse)*1e6 # will become the default of relativeAb

@lwaldron lwaldron added the bug Something isn't working label Jan 8, 2024
@lwaldron lwaldron self-assigned this Jan 8, 2024
@lwaldron
Copy link
Member

lwaldron commented Feb 2, 2024

@Peacesandy append * 1e6 to the line

res <- assay_data / div
.

The following code currently reproduces the problem, so use it to create a testthat unit test of the fix:

library(lefser)
data(zeller14)
zeller14sub <- zeller14[, zeller14$study_condition != "adenoma"]
zeller14ra <- relativeAb(zeller14sub)
lefser(zeller14ra, groupCol = "study_condition")

@Peacesandy
Copy link
Collaborator

Okay, I'll make a pull request as soon as I'm done

@Peacesandy
Copy link
Collaborator

I just made a pull request
@lwaldron

#34

@lwaldron
Copy link
Member

Fixed by 8864568 (v1.13.2) and this error no longer appears. Thank you for the report, @celinechen1885 . @asyakhl will you push to bioc-devel ASAP? @celinechen1885, the easiest way to access this fix for now is to install from GitHub (BiocManager::install("waldronlab/lefser")), or just multiply your relative abundance values by 1e6.

@lwaldron
Copy link
Member

lwaldron commented Mar 6, 2024

@asyakhl please push to bioc-devel and cherry-pick to bioc-release. This is an important bugfix.

@LiNk-NY
Copy link
Contributor

LiNk-NY commented Mar 6, 2024

@lwaldron I've updated both. Thanks!

@lwaldron
Copy link
Member

lwaldron commented Mar 6, 2024

Thanks Marcel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants