navinlabcode / CellTrek

108 stars 19 forks source link

Error in intI(j, n = x@Dim[2], dn[[2]], give.dn = FALSE) : invalid character indexing #18

Closed kguion1 closed 2 years ago

kguion1 commented 2 years ago

Thanks for a great package!

I previously was able to make the algorithm run with the LogNormalize method. I am now using a different single cell dataset that has been SCTransform-ed and am getting the following error. I did check the colnames and rownames of the liver_sc@assays$SCT and they are all unique. Any help is appreciated!

traint <- CellTrek::traint(st_data=spatial_6a, sc_data=liver_sc, sc_assay='SCT', st_assay='SCT', norm = 'SCT', cell_names='seurat_clusters', recompute.residuals = FALSE)

liver_celltrek <- CellTrek::celltrek( st_sc_int=traint, int_assay='traint', sc_data=liver_sc, sc_assay = 'SCT', reduction='pca', intp=T, intp_pnt=5000, intp_lin=F, nPCs=30, ntree=1000, dist_thresh=0.55, top_spot=5, spot_n=5, repel_r=20, repel_iter=20, keep_model=T)$seurat_clusters

Joining, by = c("Var1", "Var2", "value", "val_rsc", "Var1_type", "Var2_type")Spatial Charting SC data... Repelling points... Creating Seurat Object... sc data...Error in intI(j, n = x@Dim[2], dn[[2]], give.dn = FALSE) : invalid character indexing

kguion1 commented 2 years ago

I added the following from your tutorial and it now runs. I do get a lot of warnings, but the output seems normal

spatial_6a <- RenameCells(spatial_6a, new.names=make.names(Cells(spatial_6a))) liver_sc <- RenameCells(liver_sc, new.names=make.names(Cells(liver_sc)))

WandeRum commented 2 years ago

Thanks for pointing this out. Sometimes, cell name problems (duplication, unformatted) might affect the analysis of the Seurat object.