Skip to content

Signature bug #76

Closed
Closed

Description

@allonw

The following session throws an error on v2.1.0 (code for producing this vis object is also available). Creating the same object with a small set of standard signatures runs successfully.

` library(VISION)
vis = readRDS("/data/yosef/users/allonwag/Tim3/processed_sources/First10x/outputs/Vision/vis_bug.rds")

vis = analyze(vis)
`

Beginning Analysis

Clustering cells...completed

Projecting data into 2 dimensions...
Running method 1/2: UMAP ...
Running method 2/2: tSNE30 ...

Evaluating signature scores on cells...

|================================================================| 100%, Elapsed 00:02
Evaluating signature-gene importance...

|================================================================| 100%, Elapsed 00:05
Creating 5 background signature groups with the following parameters:
sigSize sigBalance
1 6 0.9987715
2 11 0.9948271
3 28 0.9887866
4 53 0.6131914
5 96 0.9385173
signatures per group: 3000
Computing KNN Cell Graph in the Latent Space...

Evaluating local consistency of signatures in latent space...

|================================================================| 100%, Elapsed 00:00
|================================================================| 100%, Elapsed 00:02
|================================================================| 100%, Elapsed 00:13
|================================================================| 100%, Elapsed 00:00
Clustering signatures...

Error in [.data.frame(sigMatrix, , keep_significant, drop = FALSE) :
undefined columns selected

Activity

  1. mattjones315 commented on Apr 2, 2020

    @mattjones315
    Collaborator

    Hi Allon,

    does this vision object have any meta data associated with it? If so, NA's in the meta data will cause an error like this.

    I'm happy to take a look at your signature data as well if you'd like to send that over.

    -Matt

  2. allonw commented on Apr 2, 2020

    @allonw
    Author

    Yes, some of the metadata have NAs. I'll try again with replacing these with explicit values - but I imagine this isn't an uncommon scenario - so maybe check that before running and give a friendly error message in that case?

  3. mattjones315 commented on Apr 2, 2020

    @mattjones315
    Collaborator

    Sure, it'd be good idea to add this. Thanks for the suggestion.

    I'm going to close this issue now, but please let me know if you encounter any other issues.

  4. allonw commented on Apr 2, 2020

    @allonw
    Author

    Actually, it doesn't seem to be related to NAs in the metadata. I'm attaching a minimal example, taking only the first 1000 signatures, for example runs successfully.

    Input: vis_bug.rda.zip

    library(VISION)
    load("vis_bug.rda")
    vis = Vision(minimal_mat,
    signatures = minimal_sigs, #or: minimal_sigs[1:1000] to run successfully
    meta = minimal_meta,
    projection_genes = projection_genes,
    projection_methods = c(),
    pool = FALSE,
    latentSpace = minimal_latent,
    latentSpaceName = "scvi_latent_space")

    vis = analyze(vis)


    output:
    Beginning Analysis

    Clustering cells...completed

    Projecting data into 2 dimensions...

    Evaluating signature scores on cells...

    |================================================================| 100%, Elapsed 00:01
    Evaluating signature-gene importance...

    |================================================================| 100%, Elapsed 00:01
    Creating 5 background signature groups with the following parameters:
    sigSize sigBalance
    1 6 1
    2 10 1
    3 17 1
    4 37 1
    5 121 1
    signatures per group: 3000
    Computing KNN Cell Graph in the Latent Space...

    Evaluating local consistency of signatures in latent space...

    |================================================================| 100%, Elapsed 00:00
    |================================================================| 100%, Elapsed 00:11
    |================================================================| 100%, Elapsed 00:00
    Clustering signatures...

    Error in [.data.frame(sigMatrix, , keep_significant, drop = FALSE) :
    undefined columns selected

  5. reopened this on Apr 2, 2020
  6. mattjones315 commented on Apr 3, 2020

    @mattjones315
    Collaborator

    Hi Allon,

    Thanks for the reproducible example & re-opening the issue. I believe I've found the issue - it appears that signatures are duplicated in the signature list you're providing VISION (hence why running on the first 1000 signatures works, but not the entire set). In particular, I've found the following signatures duplicated:

    [1] "REACTOME_PEXOPHAGY"
    [2] "REACTOME_SIGNALING_BY_ERBB2_ECD_MUTANTS"
    [3] "REACTOME_SEALING_OF_THE_NUCLEAR_ENVELOPE_NE_BY_ESCRT_III"
    [4] "REACTOME_SIGNALING_BY_PDGFR_IN_DISEASE"
    [5] "REACTOME_SIGNALING_BY_PDGFRA_TRANSMEMBRANE_JUXTAMEMBRANE_AND_KINASE_DOMAIN_MUTANTS"
    [6] "REACTOME_SIGNALING_BY_MEMBRANE_TETHERED_FUSIONS_OF_PDGFRA_OR_PDGFRB"
    [7] "REACTOME_NERVOUS_SYSTEM_DEVELOPMENT"
    [8] "REACTOME_DISEASES_OF_DNA_REPAIR"

    I was able to successfully run VISION after filtering out the duplicated signatures, arbitrarily with this code:

    new_sigs = list()
    for (sig in names(minimal_sigs)) {
        if (! (sig %in% names(new_sigs)) ) {
            new_sigs[sig] = minimal_sigs[[sig]]
        }
    }

    Then, with re-parameterizing the Vision object with new_sigs, I was able to successfully analyze the data. I suggest you do something similar.

    I will add a statement from within the Vision object constructor to make sure cases like this are flagged.

    Thanks again, let me know if this fixes everything on your end!

    -Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions