Git Product home page Git Product logo

sparrow's People

Contributors

gladkia avatar jwokaty avatar lianos avatar nturaga avatar tomsing1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gladkia

sparrow's Issues

Assertion on contrast failed

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.

make `sparrow::corplot` returning `E` instead of `invisible(NULL)`

Hi Steve,

Many thanks for creating such a great package :)!

Would it be possible to make sparrow::corplot returning data (i.e. E) instead of invisible(NULL). I found the need for it while using the sparrow::corplot with cluster = TRUE and not being able to get the order of the genes.

Best,
Arek

Reorder parameters in seas() to put `x` first.

This function is really polymorphic over x, so this should come first.

The current function signature is:

seas <- function(gdb, x, design, contrast, ...)

but should really by

seas <- function(x, gdb, design = NULL, contrast = NULL, ...)

Let's bite this bullet before we release this into the wild.

Assertion on 'contrast' failed

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$E, 
                         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.

Use babelgene package to re-implement convertIdentifiers()

We previously included species and identifier maps in this package for this function to work, but since {babelgene} (which powers {msigdbr}) is now a dependency, let's use that.

Note the original function was called remap_identifiers, but since we're using camel case here, we're going with convertIdentifiers (and "converting" is more what we are doing, not remaping (I guess? ... who knows ...))

Create a renameCollection function

It's not too hard to rename collections by manipulating the internal data.tables, let's do that.

This code snippet renames a "C7" collection to "ImmuneSigDb" in a GeneSetDb gdb object:

gdb@db[collection == "C7", collection := "ImmuneSigDb"]
setkeyv(gdb@db, c("collection", "name", "feature_id"))

gdb@table[collection == "C7", collection := "ImmuneSigDb"]
setkeyv(gdb@table, c("collection", "name"))

gdb@collectionMetadata[collection == "C7", collection := "ImmuneSigDb"]
setkeyv(gdb@collectionMetadata, c("collection", "name"))

Ideas

The function signature might look like:

renameCollection <- function(gdb, rename, ...) {
}

with rename being a named character vector with names() being the current name of the collection, and its values are the new collection names you want to rename them to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.