MarioniLab / miloR

R package implementation of Milo for testing for differential abundance in KNN graphs
https://bioconductor.org/packages/release/bioc/html/miloR.html
GNU General Public License v3.0
316 stars 20 forks source link

Predefined Graph Import Still Not Available to Use #318

Open DarioS opened 2 months ago

DarioS commented 2 months ago

In progress: we are perfecting the functionality to add a precomputed KNN graph (for example constructed with Seurat or scanpy) to the graph slot using the adjacency matrix.

It has been in the vignette for the past three years.

MikeDMorgan commented 2 months ago

Noted, thanks.

MikeDMorgan commented 2 months ago

FYI - it is possible to use a precomputed graph from Seurat, etc, it's just the text that is outdated.

shaln commented 2 months ago

@MikeDMorgan how can I do that? I got the following error when trying to do so using the buildFromAdjacency function. Not quite sure where to begin troubleshooting this, so any help would be greatly appreciated! Thanks.

> all.samples <- readRDS('RDS Files/all.samples.RDS')
> allsamples.sce <- as.SingleCellExperiment(all.samples)
> allsamples.milo <- Milo(allsamples.sce)
> miloR::graph(allsamples.milo) <- miloR::graph(buildFromAdjacency(all.samples@graphs$SCT_snn, k = 20))
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'graph': missing value where TRUE/FALSE needed
In addition: Warning message:
In nrow(x) * ncol(x) : NAs produced by integer overflow

> allsamples.milo
class: Milo 
dim: 24615 48315 
metadata(0):
assays(2): counts logcounts
rownames(24615): AL627309.1 AL669831.5 ... TMEM200C PDYN-AS1
rowData names(0):
colnames(48315): Control_D5_AAACCCAGTAGCGCTC-1 Control_D5_AAACCCAGTCCTACGG-1 ...
  ER_D9_TTTGTTGGTGCTCTCT-1 ER_D9_TTTGTTGTCTATGTGG-1
colData names(26): orig.ident nCount_RNA ... clusters.orig.ident ident
reducedDimNames(2): PCA UMAP
mainExpName: SCT
altExpNames(0):
nhoods dimensions(2): 1 1
nhoodCounts dimensions(2): 1 1
nhoodDistances dimension(1): 0
graph names(0):
nhoodIndex names(1): 0
nhoodExpression dimension(2): 1 1
nhoodReducedDim names(0):
nhoodGraph names(0):
nhoodAdjacency dimension(2): 1 1
MikeDMorgan commented 2 months ago

The error suggests that there may be an issue with the SNN graph from Seurat - can you double check the output from buildFromAdjacency(all.samples@graphs$SCT_snn, k = 20) is a valid Milo object.