I'm currently having an issue regarding the integrative analysis. I have four different libraries, and I'm trying to merge all of them together. But I get this error.
all.cell.list <- list(IL1BWTeYFPpos, IL1BWTeYFPneg, IL1BKOeYFPpos, IL1BKOeYFPneg)
for (i in 1:length(x=all.cell.list)) {
all.cell.list[[i]] <- NormalizeData(object = all.cell.list[[i]], verbose=FALSE)
all.cell.list[[i]] <- FindVariableFeatures(object = all.cell.list[[i]], selection.method = "vst", verbose = FALSE)
}
pseudoinverse used at -1.7106neighborhood radius 0.49748reciprocal condition number 2.1436e-014There are other near singularities as well. 0.090619
all.cell.anchors <- FindIntegrationAnchors(object.list = all.cell.list, dims=1:30)
Computing 2000 integration features
Scaling features for provided objects
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 08s
Finding all pairwise anchors
| | 0 % ~calculating Running CCA
Merging objects
Finding neighborhoods
Finding mutual nearest neighborhoods
Found 792 anchors
Filtering Anchors
Error in nn2(data = cn.data2[nn.cells2, ], query = cn.data1[nn.cells1, :
Cannot find more nearest neighbours than there are points
If I try with just half of it, it has no issue:
only.eyfp.cell.list <- list(IL1BWTeYFPpos, IL1BKOeYFPpos)
for (i in 1:length(x=only.eyfp.cell.list)) {
only.eyfp.cell.list[[i]] <- NormalizeData(object = only.eyfp.cell.list[[i]], verbose=FALSE)
only.eyfp.cell.list[[i]] <- FindVariableFeatures(object = only.eyfp.cell.list[[i]], selection.method = "vst", verbose = FALSE)
}
only.eyfp.cell.list.anchors <- FindIntegrationAnchors(object.list = only.eyfp.cell.list, dims=1:30)
Computing 2000 integration features
Scaling features for provided objects
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 04s
Finding all pairwise anchors
| | 0 % ~calculating Running CCA
Merging objects
Finding neighborhoods
Finding mutual nearest neighborhoods
Found 1710 anchors
Filtering Anchors
Retained 1456 anchors
Extracting within-dataset neighbors!
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 05s
Any idea what it could be the issue?
Thanks!
Gabe
I had the same problem
Error in nn2(data = cn.data2[nn.cells2, ], query = cn.data1[nn.cells1, :
Cannot find more nearest neighbours than there are points
but it is good on another bigger data set.
I don't know why this happened.
Hi, I experienced the same problem when integrating very heterogeneous datasets, and it seems to be related to the size of k.filter parameter.
In my case, lowering the default value of 200 to 150 did the job. However, I am still trying to figure out whether the results are meaningful, and the underlying biological rationale of it, so any explanation would be welcome!
Thanks
Thanks - we are looking into this, as we have not seen this issue ourselves.
We describe the rationale behind filtering anchors in the Supplementary Information of the Seurat v3 preprint.
@GabeFalcao , I wonder if part of the issue may be specific to your data, i have never seen the pseudoinverse output after the call to FindVariableFeatures. Do you see this if you run FindVariableFeatures on only the last two datasets?
I had the same error. In my data, one sample contained only 147 cells. When I tried to integrate 5 samples, I got the error. I merged the small sample into a large one. Then, the error was fixed.
I had the same error. In my data, one sample contained only 2596 cells. When I tried to integrate 10 samples, I got the error
Error in nn2(data = cn.data2[nn.cells2, ], query = cn.data1[nn.cells1, :
Cannot find more nearest neighbours than there are points
Hi, the integration method does require a minimum number of cells per dataset, as it works by weighting information across cells. I'm going to close this issue for now as it appears to be dataset-specific and not a bug in the code, but please open another issue if this is not the case.
This appear to be related to the number of cells in the smallest dataset. For example this fails:
k.filter <- min(sapply(scseqs, ncol)) + 1
anchors <- Seurat::FindIntegrationAnchors(scseqs, k.filter = k.filter)
This works for the same datasets (and integration looked fine):
k.filter <- min(200, min(sapply(scseqs, ncol)))
anchors <- Seurat::FindIntegrationAnchors(scseqs, k.filter = k.filter)
Most helpful comment
This appear to be related to the number of cells in the smallest dataset. For example this fails:
This works for the same datasets (and integration looked fine):