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

Assertion on contrast failed #18

Open
RussBainer opened this issue Mar 15, 2023 · 1 comment
Open

Assertion on contrast failed #18

RussBainer opened this issue Mar 15, 2023 · 1 comment

Comments

@RussBainer
Copy link

RussBainer commented Mar 15, 2023

Dear maintainer, thank you for making this delightful package. I am trying to use it to perform an enrichment analysis using fits derived from a pseudobulk analysis, and am catching an error:

sparrow::seas(gsd = gsdb, x = metadata(fits.risk[[x]])$v, 
                         design = metadata(fits.risk[[x]])$fit$design, contrast = metadata(fits.risk[[x]])$fit$contrasts[,"Risk_genotypeTRUE"], 
                         methods = c('camera', 'fgsea'), feature.max.padj = 0.001)
Warning in .local(x, ...) :
  Deactivating 140 gene sets because conformation of GeneSetDb to the target creates gene sets smaller than 2 or greater than Inf

Error in calculateIndividualLogFC(x, design, contrast, treat.lfc = treat.lfc,  : 
  Assertion on 'contrast' failed: Must have length <= 4, but has length 5.
> 
> x <- 'ATL'
> metadata(fits.risk[[x]])$fit$design
   (Intercept) CohortMCD SexMale eGFR_Bx Risk_genotypeTRUE
1            1         0       1 101.727                 1
2            1         1       1  23.285                 1
3            1         0       0 107.653                 0
4            1         1       0  78.557                 0
5            1         0       1  68.520                 1
6            1         0       0  64.046                 0
7            1         0       1  84.839                 0
8            1         1       1  61.602                 0
9            1         0       1  33.666                 0
10           1         0       1  19.367                 1
11           1         0       1  21.972                 1
12           1         1       0  80.348                 0
13           1         0       1 112.467                 0
14           1         0       1  57.139                 1
15           1         1       1 149.864                 0
16           1         0       1 114.610                 1
17           1         1       0  90.385                 0
18           1         0       1  79.794                 1
19           1         0       1  96.773                 0
attr(,"assign")
[1] 0 1 2 3 4
attr(,"contrasts")
attr(,"contrasts")$Cohort
[1] "contr.treatment"

attr(,"contrasts")$Sex
[1] "contr.treatment"

attr(,"contrasts")$Risk_genotype
[1] "contr.treatment"

> metadata(fits.risk[[x]])$fit$contrasts[,"Risk_genotypeTRUE"]
        Intercept         CohortMCD           SexMale           eGFR_Bx Risk_genotypeTRUE 
                0                 0                 0                 0                 1

Can you please help me understand this error message? Kindest Regards.

@RussBainer
Copy link
Author

As an update, I was able to make this work if I just specified a column in design, which is thankfully an available option here.

Still curious about the error and how to deal with situations where a user needs to do "column arithmetic".

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