mathewchamberlain / SignacX

Signac
GNU General Public License v3.0
23 stars 5 forks source link

Run Error #8

Closed JonathanNoonan closed 3 years ago

JonathanNoonan commented 3 years ago

Hi Mathew,

I’m running into some issues with SignacX and was hoping you might be able to help.

I’m trying to run SigncX on integrated Seurat Objects. When I do this I get the following error : Error in E@graphs[[which(grepl(paste0(default.assay, "_nn"), names(E@graphs)))]] : attempt to select less than one element in get1index

It seems to me that it doesn’t like the naming of the integrated graphs - though its unclear to me why this would be.

I’ve also attempted running it on exported counts as you can do with SingleR using: T.Cells.Data <- T.Cells@assays[["Integrated"]]@counts

However, when I try to run it this way it seems to request the spring directory, and im not using Spring.

Error in CID.LoadEdges(data.dir = spring.dir) :

The pipeline still runs perfectly with the example data. I’m wondering if the issue might relate to the version of CellRanger used?

If you have any ideas this would be most appreciated.

mathewchamberlain commented 3 years ago

Hi Jonathan,

No problem. It must be that there is a naming inconsistency between Seurat and SignacX with the graphs that are used. If you do names(T.Cells@graphs), what is returned? SignacX expects a graph with the naming convention "_nn" -- perhaps on integrated objects or in this Seurat version, the naming convention has changed. Can you let me know what happens when you try that, then I will patch it ASAP? Thanks. @JonathanNoonan

JonathanNoonan commented 3 years ago

Hi Matthew, thanks!

I believe the naming has changed:

names(T.Cells@graphs) [1] "integrated_nn" "integrated_snn"

Seurat now has several variations on this as they also have introduced the ability to use both cite and GEX data to generate weighted nearest neighbours graphs. I think these come up as integrated_wnn - though I'm not 100% as I've not really played with this functionality yet.

Cheers

mathewchamberlain commented 3 years ago

Thank you. As a quick fix, can you try the following: names(T.cells@graphs) <- c(paste0(DefaultAssay(T.Cells), "_nn"), paste0(DefaultAssay(T.Cells), "_snn")) Then run the SignacX annotation. Once it is done, you can set the names of the graphs back (to make sure there are no downstream problems in Seurat) just by: names(T.cells@graphs) <- c("integrated_nn", "integrated_snn") The problem appears to be that SignacX expects the naming convention to be the name of the default assay followed by "_nn", which is what it used to be in Seurat, but I am guessing that the name returned by DefaultAssay is not "integrated" -- and as you say, it is "_wnn" now for WNN analysis. I will make a note to fix this, but for now I would just try the quick fix if you can, and let me know if that works. @JonathanNoonan

mathewchamberlain commented 3 years ago

I believe this issue is now patched in SignacX version 2.2.1 (just uploaded to CRAN). You can now set the edges you want to use in the Signac and SignacFast functions; the default is "nn" can also be set to "wnn" or "snn."