Open jenellewallace opened 3 years ago
Can you provide the output of str(my_data) and also the exact line you are trying to run?
Thanks, I am just trying to run the line: DE = run_de(my_data) after renaming the corresponding columns cell_type, label, and replicate. I am also wondering whether it is a problem if the replicates are all uniquely named (i.e. not paired as they seem to be in the hagai_toy dataset).
The output of str(my_data) is:
Formal class 'Seurat' [package "SeuratObject"] with 13 slots ..@ assays :List of 2 .. ..$ RNA :Formal class 'Assay' [package "SeuratObject"] with 8 slots .. .. .. ..@ counts :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. .. .. ..@ i : int [1:70653489] 1 7 9 22 27 30 33 39 43 44 ... .. .. .. .. .. ..@ p : int [1:48267] 0 4639 8963 13340 17614 21937 26496 30457 34516 38592 ... .. .. .. .. .. ..@ Dim : int [1:2] 25187 48266 .. .. .. .. .. ..@ Dimnames:List of 2 .. .. .. .. .. .. ..$ : chr [1:25187] "0610007P14Rik" "0610009B22Rik" "0610009E02Rik" "0610009L18Rik" ... .. .. .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. .. .. ..@ x : num [1:70653489] 0.212 0.212 0.212 0.212 0.424 ... .. .. .. .. .. ..@ factors : list() .. .. .. ..@ data :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. .. .. ..@ i : int [1:70653489] 1 7 9 22 27 30 33 39 43 44 ... .. .. .. .. .. ..@ p : int [1:48267] 0 4639 8963 13340 17614 21937 26496 30457 34516 38592 ... .. .. .. .. .. ..@ Dim : int [1:2] 25187 48266 .. .. .. .. .. ..@ Dimnames:List of 2 .. .. .. .. .. .. ..$ : chr [1:25187] "0610007P14Rik" "0610009B22Rik" "0610009E02Rik" "0610009L18Rik" ... .. .. .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0bc0017" ... .. .. .. .. .. ..@ x : num [1:70653489] 0.528 0.528 0.528 0.528 0.872 ... .. .. .. .. .. ..@ factors : list() .. .. .. ..@ scale.data : num[0 , 0 ] .. .. .. ..@ key : Named chr "rna" .. .. .. .. ..- attr(, "names")= chr "" .. .. .. ..@ assay.orig : NULL .. .. .. ..@ var.features : logi(0) .. .. .. ..@ meta.features:'data.frame': 25187 obs. of 0 variables .. .. .. ..@ misc : list() .. ..$ integrated:Formal class 'Assay' [package "SeuratObject"] with 8 slots .. .. .. ..@ counts :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. .. .. ..@ i : int(0) .. .. .. .. .. ..@ p : int 0 .. .. .. .. .. ..@ Dim : int [1:2] 0 0 .. .. .. .. .. ..@ Dimnames:List of 2 .. .. .. .. .. .. ..$ : NULL .. .. .. .. .. .. ..$ : NULL .. .. .. .. .. ..@ x : num(0) .. .. .. .. .. ..@ factors : list() .. .. .. ..@ data :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. .. .. ..@ i : int [1:37721163] 35 54 104 107 109 119 133 157 165 182 ... .. .. .. .. .. ..@ p : int [1:48267] 0 143 274 396 529 664 795 948 1069 1221 ... .. .. .. .. .. ..@ Dim : int [1:2] 2000 48266 .. .. .. .. .. ..@ Dimnames:List of 2 .. .. .. .. .. .. ..$ : chr [1:2000] "Hba-a2" "Hbb-bs" "Hbb-bt" "Vip" ... .. .. .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. .. .. ..@ x : num [1:37721163] 0.528 0.872 0.528 1.127 0.528 ... .. .. .. .. .. ..@ factors : list() .. .. .. ..@ scale.data : num [1:2000, 1:48266] -0.2083 -0.185 -0.1237 -0.0629 -0.1027 ... .. .. .. .. ..- attr(, "dimnames")=List of 2 .. .. .. .. .. ..$ : chr [1:2000] "Hba-a2" "Hbb-bs" "Hbb-bt" "Vip" ... .. .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0bc0017" ... .. .. .. ..@ key : chr "integrated" .. .. .. ..@ assay.orig : NULL .. .. .. ..@ var.features : chr [1:2000] "Hba-a2" "Hbb-bs" "Hbb-bt" "Vip" ... .. .. .. ..@ meta.features:'data.frame': 2000 obs. of 0 variables .. .. .. ..@ misc : NULL ..@ meta.data :'data.frame': 48266 obs. of 12 variables: .. ..$ orig.ident : chr [1:48266] "x2" "x2" "x2" "x2" ... .. ..$ nCount_RNA : num [1:48266] 3045 3045 3045 3045 3045 ... .. ..$ nFeature_RNA : int [1:48266] 4639 4324 4377 4274 4323 4559 3961 4059 4076 4326 ... .. ..$ cell : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. ..$ label : chr [1:48266] "0h" "0h" "0h" "0h" ... .. ..$ replicate : chr [1:48266] "B1_1_0h" "B1_1_0h" "B1_1_0h" "B1_1_0h" ... .. ..$ maintype : chr [1:48266] "Excitatory" "Excitatory" "Excitatory" "Excitatory" ... .. ..$ cell_type : chr [1:48266] "ExcL4" "ExcL5_3" "ExcL5_2" "ExcL6" ... .. ..$ subtype : chr [1:48266] "ExcL4_3" NA NA NA ... .. ..$ RNA_snn_res.0.6 : chr [1:48266] "6" "9" "9" "4" ... .. ..$ seurat_clusters : Factor w/ 27 levels "0","1","2","3",..: 3 9 26 6 9 3 9 24 20 9 ... .. ..$ integrated_snn_res.0.6: Factor w/ 27 levels "0","1","2","3",..: 3 9 26 6 9 3 9 24 20 9 ... ..@ active.assay: chr "integrated" ..@ active.ident: Factor w/ 27 levels "0","1","2","3",..: 3 9 26 6 9 3 9 24 20 9 ... .. ..- attr(, "names")= chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... ..@ graphs :List of 2 .. ..$ integrated_nn :Formal class 'Graph' [package "SeuratObject"] with 7 slots .. .. .. ..@ assay.used: chr "integrated" .. .. .. ..@ i : int [1:965320] 0 2252 2329 25362 34383 1 77 318 2223 2246 ... .. .. .. ..@ p : int [1:48267] 0 5 34 49 50 55 63 64 90 96 ... .. .. .. ..@ Dim : int [1:2] 48266 48266 .. .. .. ..@ Dimnames :List of 2 .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. ..@ x : num [1:965320] 1 1 1 1 1 1 1 1 1 1 ... .. .. .. ..@ factors : list() .. ..$ integrated_snn:Formal class 'Graph' [package "SeuratObject"] with 7 slots .. .. .. ..@ assay.used: chr "integrated" .. .. .. ..@ i : int [1:4384436] 0 19 39 125 144 165 206 297 339 834 ... .. .. .. ..@ p : int [1:48267] 0 125 287 340 377 431 474 570 665 708 ... .. .. .. ..@ Dim : int [1:2] 48266 48266 .. .. .. ..@ Dimnames :List of 2 .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. ..@ x : num [1:4384436] 1 0.111 0.143 0.111 0.111 ... .. .. .. ..@ factors : list() ..@ neighbors : list() ..@ reductions :List of 2 .. ..$ pca :Formal class 'DimReduc' [package "SeuratObject"] with 9 slots .. .. .. ..@ cell.embeddings : num [1:48266, 1:30] 1.324 1.669 1.519 0.764 1.709 ... .. .. .. .. ..- attr(, "dimnames")=List of 2 .. .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. .. .. ..$ : chr [1:30] "PC_1" "PC_2" "PC_3" "PC_4" ... .. .. .. ..@ feature.loadings : num [1:2000, 1:30] -0.017208 -0.014765 -0.012538 0.000858 0.002068 ... .. .. .. .. ..- attr(, "dimnames")=List of 2 .. .. .. .. .. ..$ : chr [1:2000] "Hba-a2" "Hbb-bs" "Hbb-bt" "Vip" ... .. .. .. .. .. ..$ : chr [1:30] "PC_1" "PC_2" "PC_3" "PC4" ... .. .. .. ..@ feature.loadings.projected: num[0 , 0 ] .. .. .. ..@ assay.used : chr "integrated" .. .. .. ..@ global : logi FALSE .. .. .. ..@ stdev : num [1:30] 9.43 9.14 7.88 5.94 5.69 ... .. .. .. ..@ key : chr "PC" .. .. .. ..@ jackstraw :Formal class 'JackStrawData' [package "SeuratObject"] with 4 slots .. .. .. .. .. ..@ empirical.p.values : num[0 , 0 ] .. .. .. .. .. ..@ fake.reduction.scores : num[0 , 0 ] .. .. .. .. .. ..@ empirical.p.values.full: num[0 , 0 ] .. .. .. .. .. ..@ overall.p.values : num[0 , 0 ] .. .. .. ..@ misc :List of 1 .. .. .. .. ..$ total.variance: num 1341 .. ..$ umap:Formal class 'DimReduc' [package "SeuratObject"] with 9 slots .. .. .. ..@ cell.embeddings : num [1:48266, 1:2] -2.031 -1.214 -2.45 0.307 -1.932 ... .. .. .. .. ..- attr(, "scaled:center")= num [1:2] 0.0207 0.0879 .. .. .. .. ..- attr(, "dimnames")=List of 2 .. .. .. .. .. ..$ : chr [1:48266] "x2_35_0_bc0013" "x2_35_0_bc0014" "x2_35_0_bc0016" "x2_35_0_bc0017" ... .. .. .. .. .. ..$ : chr [1:2] "UMAP_1" "UMAP2" .. .. .. ..@ feature.loadings : num[0 , 0 ] .. .. .. ..@ feature.loadings.projected: num[0 , 0 ] .. .. .. ..@ assay.used : chr "integrated" .. .. .. ..@ global : logi TRUE .. .. .. ..@ stdev : num(0) .. .. .. ..@ key : chr "UMAP" .. .. .. ..@ jackstraw :Formal class 'JackStrawData' [package "SeuratObject"] with 4 slots .. .. .. .. .. ..@ empirical.p.values : num[0 , 0 ] .. .. .. .. .. ..@ fake.reduction.scores : num[0 , 0 ] .. .. .. .. .. ..@ empirical.p.values.full: num[0 , 0 ] .. .. .. .. .. ..@ overall.p.values : num[0 , 0 ] .. .. .. ..@ misc : list() ..@ images : list() ..@ project.name: chr "SeuratProject" ..@ misc : list() ..@ version :Classes 'package_version', 'numeric_version' hidden list of 1 .. ..$ : int [1:3] 4 0 2 ..@ commands :List of 7 .. ..$ FindIntegrationAnchors :Formal class 'SeuratCommand' [package "SeuratObject"] with 5 slots .. .. .. ..@ name : chr "FindIntegrationAnchors" .. .. .. ..@ time.stamp : POSIXct[1:1], format: "2021-10-28 11:55:50" .. .. .. ..@ assay.used : Named chr [1:3] "RNA" "RNA" "RNA" .. .. .. .. ..- attr(, "names")= chr [1:3] "0h" "1h" "4h" .. .. .. ..@ call.string: chr "FindIntegrationAnchors(object.list = hrvatin.list, anchor.features = features)" .. .. .. ..@ params :List of 15 .. .. .. .. ..$ assay : Named chr [1:3] "RNA" "RNA" "RNA" .. .. .. .. .. ..- attr(*, "names")= chr [1:3] "0h" "1h" "4h" .. .. .. .. ..$ anchor.features : chr [1:2000] "Hba-a2" "Hbb-bs" "Hbb-bt" "Vip" ... .. .. .. .. ..$ scale : logi TRUE .. .. .. .. ..$ normalization.method: chr "LogNormalize" .. .. .. .. ..$ reduction : chr "cca" .. .. .. .. ..$ l2.norm : logi TRUE .. .. .. .. ..$ dims : int [1:30] 1 2 3 4 5 6 7 8 9 10 ... .. .. .. .. ..$ k.anchor : num 5 .. .. .. .. ..$ k.filter : num 200 .. .. .. .. ..$ k.score : num 30 .. .. .. .. ..$ max.features : num 200 .. .. .. .. ..$ nn.method : chr "annoy" .. .. .. .. ..$ n.trees : num 50 .. .. .. .. ..$ eps : num 0 .. .. .. .. ..$ verbose : logi TRUE .. ..$ withCallingHandlers :Formal class 'SeuratCommand' [package "SeuratObject"] with 5 slots .. .. .. ..@ name : chr "withCallingHandlers" .. .. .. ..@ time.stamp : POSIXct[1:1], format: "2021-10-28 12:06:05" .. .. .. ..@ assay.used : NULL .. .. .. ..@ call.string: chr [1:2] "withCallingHandlers(expr, warning = function(w) if (inherits(w, " " classes)) tryInvokeRestart(\"muffleWarning\"))" .. .. .. ..@ params :List of 9 .. .. .. .. ..$ new.assay.name : chr "integrated" .. .. .. .. ..$ normalization.method: chr "LogNormalize" .. .. .. .. ..$ features : chr [1:2000] "Hba-a2" "Hbb-bs" "Hbb-bt" "Vip" ... .. .. .. .. ..$ dims : int [1:30] 1 2 3 4 5 6 7 8 9 10 ... .. .. .. .. ..$ k.weight : num 100 .. .. .. .. ..$ sd.weight : num 1 .. .. .. .. ..$ preserve.order : logi FALSE .. .. .. .. ..$ eps : num 0 .. .. .. .. ..$ verbose : logi TRUE .. ..$ ScaleData.integrated :Formal class 'SeuratCommand' [package "SeuratObject"] with 5 slots .. .. .. ..@ name : chr "ScaleData.integrated" .. .. .. ..@ time.stamp : POSIXct[1:1], format: "2021-10-28 13:47:58" .. .. .. ..@ assay.used : chr "integrated" .. .. .. ..@ call.string: chr "ScaleData(hrvatin.combined, verbose = FALSE)" .. .. .. ..@ params :List of 10 .. .. .. .. ..$ features : chr [1:2000] "Hba-a2" "Hbb-bs" "Hbb-bt" "Vip" ... .. .. .. .. ..$ assay : chr "integrated" .. .. .. .. ..$ model.use : chr "linear" .. .. .. .. ..$ use.umi : logi FALSE .. .. .. .. ..$ do.scale : logi TRUE .. .. .. .. ..$ do.center : logi TRUE .. .. .. .. ..$ scale.max : num 10 .. .. .. .. ..$ block.size : num 1000 .. .. .. .. ..$ min.cells.to.block: num 3000 .. .. .. .. ..$ verbose : logi FALSE .. ..$ RunPCA.integrated :Formal class 'SeuratCommand' [package "SeuratObject"] with 5 slots .. .. .. ..@ name : chr "RunPCA.integrated" .. .. .. ..@ time.stamp : POSIXct[1:1], format: "2021-10-28 13:48:21" .. .. .. ..@ assay.used : chr "integrated" .. .. .. ..@ call.string: chr "RunPCA(hrvatin.combined, npcs = 30, verbose = FALSE)" .. .. .. ..@ params :List of 10 .. .. .. .. ..$ assay : chr "integrated" .. .. .. .. ..$ npcs : num 30 .. .. .. .. ..$ rev.pca : logi FALSE .. .. .. .. ..$ weight.by.var : logi TRUE .. .. .. .. ..$ verbose : logi FALSE .. .. .. .. ..$ ndims.print : int [1:5] 1 2 3 4 5 .. .. .. .. ..$ nfeatures.print: num 30 .. .. .. .. ..$ reduction.name : chr "pca" .. .. .. .. ..$ reduction.key : chr "PC" .. .. .. .. ..$ seed.use : num 42 .. ..$ RunUMAP.integrated.pca :Formal class 'SeuratCommand' [package "SeuratObject"] with 5 slots .. .. .. ..@ name : chr "RunUMAP.integrated.pca" .. .. .. ..@ time.stamp : POSIXct[1:1], format: "2021-10-28 13:49:20" .. .. .. ..@ assay.used : chr "integrated" .. .. .. ..@ call.string: chr "RunUMAP(hrvatin.combined, reduction = \"pca\", dims = 1:30)" .. .. .. ..@ params :List of 26 .. .. .. .. ..$ dims : int [1:30] 1 2 3 4 5 6 7 8 9 10 ... .. .. .. .. ..$ reduction : chr "pca" .. .. .. .. ..$ assay : chr "integrated" .. .. .. .. ..$ slot : chr "data" .. .. .. .. ..$ umap.method : chr "uwot" .. .. .. .. ..$ return.model : logi FALSE .. .. .. .. ..$ n.neighbors : int 30 .. .. .. .. ..$ n.components : int 2 .. .. .. .. ..$ metric : chr "cosine" .. .. .. .. ..$ learning.rate : num 1 .. .. .. .. ..$ min.dist : num 0.3 .. .. .. .. ..$ spread : num 1 .. .. .. .. ..$ set.op.mix.ratio : num 1 .. .. .. .. ..$ local.connectivity : int 1 .. .. .. .. ..$ repulsion.strength : num 1 .. .. .. .. ..$ negative.sample.rate: int 5 .. .. .. .. ..$ uwot.sgd : logi FALSE .. .. .. .. ..$ seed.use : int 42 .. .. .. .. ..$ angular.rp.forest : logi FALSE .. .. .. .. ..$ densmap : logi FALSE .. .. .. .. ..$ dens.lambda : num 2 .. .. .. .. ..$ dens.frac : num 0.3 .. .. .. .. ..$ dens.var.shift : num 0.1 .. .. .. .. ..$ verbose : logi TRUE .. .. .. .. ..$ reduction.name : chr "umap" .. .. .. .. ..$ reduction.key : chr "UMAP" .. ..$ FindNeighbors.integrated.pca:Formal class 'SeuratCommand' [package "SeuratObject"] with 5 slots .. .. .. ..@ name : chr "FindNeighbors.integrated.pca" .. .. .. ..@ time.stamp : POSIXct[1:1], format: "2021-10-28 13:49:31" .. .. .. ..@ assay.used : chr "integrated" .. .. .. ..@ call.string: chr "FindNeighbors(hrvatin.combined, reduction = \"pca\", dims = 1:30)" .. .. .. ..@ params :List of 17 .. .. .. .. ..$ reduction : chr "pca" .. .. .. .. ..$ dims : int [1:30] 1 2 3 4 5 6 7 8 9 10 ... .. .. .. .. ..$ assay : chr "integrated" .. .. .. .. ..$ k.param : num 20 .. .. .. .. ..$ return.neighbor: logi FALSE .. .. .. .. ..$ compute.SNN : logi TRUE .. .. .. .. ..$ prune.SNN : num 0.0667 .. .. .. .. ..$ nn.method : chr "annoy" .. .. .. .. ..$ n.trees : num 50 .. .. .. .. ..$ annoy.metric : chr "euclidean" .. .. .. .. ..$ nn.eps : num 0 .. .. .. .. ..$ verbose : logi TRUE .. .. .. .. ..$ force.recalc : logi FALSE .. .. .. .. ..$ do.plot : logi FALSE .. .. .. .. ..$ graph.name : chr [1:2] "integrated_nn" "integrated_snn" .. .. .. .. ..$ l2.norm : logi FALSE .. .. .. .. ..$ cache.index : logi FALSE .. ..$ FindClusters :Formal class 'SeuratCommand' [package "SeuratObject"] with 5 slots .. .. .. ..@ name : chr "FindClusters" .. .. .. ..@ time.stamp : POSIXct[1:1], format: "2021-10-28 13:49:42" .. .. .. ..@ assay.used : chr "integrated" .. .. .. ..@ call.string: chr "FindClusters(hrvatin.combined, resolution = 0.6)" .. .. .. ..@ params :List of 10 .. .. .. .. ..$ graph.name : chr "integrated_snn" .. .. .. .. ..$ modularity.fxn : num 1 .. .. .. .. ..$ resolution : num 0.6 .. .. .. .. ..$ method : chr "matrix" .. .. .. .. ..$ algorithm : num 1 .. .. .. .. ..$ n.start : num 10 .. .. .. .. ..$ n.iter : num 10 .. .. .. .. ..$ random.seed : num 0 .. .. .. .. ..$ group.singletons: logi TRUE .. .. .. .. ..$ verbose : logi TRUE ..@ tools :List of 1 .. ..$ Integration:Formal class 'IntegrationData' [package "Seurat"] with 7 slots .. .. .. ..@ neighbors : NULL .. .. .. ..@ weights : NULL .. .. .. ..@ integration.matrix: NULL .. .. .. ..@ anchors :'data.frame': 94272 obs. of 5 variables: .. .. .. .. ..$ cell1 : num [1:94272] 1 1 3 3 5 5 5 6 6 7 ... .. .. .. .. ..$ cell2 : num [1:94272] 8 9090 9066 2436 9117 ... .. .. .. .. ..$ score : num [1:94272] 0.735 0.5 0.265 0.618 0.235 ... .. .. .. .. ..$ dataset1: int [1:94272] 1 1 1 1 1 1 1 1 1 1 ... .. .. .. .. ..$ dataset2: int [1:94272] 2 2 2 2 2 2 2 2 2 2 ... .. .. .. ..@ offsets : NULL .. .. .. ..@ objects.ncell : NULL .. .. .. ..@ sample.tree : num [1:2, 1:2] -1 1 -2 -3
If you are using a Seurat object you might need to double check your default assay.
If DefaultAssay(my_data) returns 'integrated' that might be your problem. Try setting to 'RNA' DefaultAssay(my_data) = "RNA"
And then re-run.
Hello, Thanks very much for your work on this package! I am very new to single cell analysis, so would really appreciate your help. I am trying to apply your methods to a Seurat object and am getting this error:
Error in check_inputs(input = input, meta = meta, replicate_col = replicate_col, : expression matrix has at least one dimension of size zero
I think that the problem is that my dataset does not satisfy the condition !all(dim(my_data@assays$RNA@data)) >0
Do you have any suggestions for how to reformat the data to be compatible with your package? Thank you!