Skip to content

Error in calcTsne and calcDM: length of 'dimnames' [1] not equal to array extent #79

@Sophia409

Description

@Sophia409

Hello,
I have just started to use URD. I create an URD object by fetching data from Seurat3. But I got the following error when I run calcTsne and calcDM:

First error is 'Remove duplicates before running TSNE'.But After checking my data, I didn't find duplicated genes or cell names. Second error is : 'Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent', I searched this question many times but didn't find the reason.

count.data <- as.matrix(PVN.neuron@assays$RNA@counts)
meta <- PVN.neuron@meta.data
meta <- tibble::rownames_to_column(meta, "CELL")
rownames(meta) <- meta$CELL
URD.object <- createURD(count.data =count.data, meta = meta, min.cells=3, min.counts=3)

URD.object <- calcPCA(URD.object, mp.factor = 2)
[1] "2021-12-06 14:38:09: Centering and scaling data."
[1] "2021-12-06 14:38:25: Removing genes with no variation."
[1] "2021-12-06 14:38:29: Calculating PCA."
[1] "2021-12-06 14:53:24: Estimating significant PCs."
[1] "Marchenko-Pastur eigenvalue null upper bound: 11.3403811414051"
[1] "8 PCs have eigenvalues larger than 2 times null upper bound."
[1] "Storing 16 PCs."
pcSDPlot(URD.object)

Calculate tSNE

set.seed(19)
URD.object <- calcTsne(URD.object)
Error in Rtsne.default(as.matrix(object@pca.scores[, which.dims]), dims = 2, :
Remove duplicates before running TSNE.

Check duplicates

anyDuplicated(rownames(PVN.neuron))
[1] 0
anyDuplicated(colnames(PVN.neuron))
[1] 0

Calculate calcDM

URD.object <- calcDM(URD.object)
[1] "destiny determined an optimal global sigma of 77.567"
[1] "destiny will use 2950 nearest neighbors."
Error in dimnames(x) <- dn :
length of 'dimnames' [1] not equal to array extent
In addition: Warning messages:
1: In dataset_extract_doublematrix(data, vars) :
Duplicate rows removed from data. Consider explicitly using df[!duplicated(df), ]
2: In dataset_extract_doublematrix(data, vars) :
Duplicate rows removed from data. Consider explicitly using df[!duplicated(df), ]
3: In DiffusionMap(data.use, sigma = sigma.use, k = knn, n_eigs = dcs.store, :
You have 20577 genes. Consider passing e.g. n_pcs = 50 to speed up computation.
`

It would be great if anyone has ideas about how to fix this error.
Thanks.
@farrellja @zouter @maximilianh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions