Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error about projcells #7

Closed
TuoCai2000 opened this issue Feb 14, 2024 · 4 comments
Closed

Error about projcells #7

TuoCai2000 opened this issue Feb 14, 2024 · 4 comments

Comments

@TuoCai2000
Copy link

Hi, thank you for developing StemID! I tried to run StemID on my seurat object following the closed issues. However, it errors when I run the code:

 ltr <- projcells(
  object = ltr,
  cthr=5
)
Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length

I will appreciate a lot if you help me! Thank you very much!

@dgrun
Copy link
Owner

dgrun commented Feb 14, 2024

Did you make sure your input object for the RaceID analysis had unique row names (genes) and column names (cells)?
If this is the case, I'd need sample code reproducing the error.

@TuoCai2000
Copy link
Author

Hi! Thank you so much! I have sent my code and data to the email: StemID@noreply.github.com,I will appreciate a lot if you help me !

@dgrun
Copy link
Owner

dgrun commented Feb 15, 2024

Not sure that works. Please send to me directly and I can see what I can do: dominic.gruen@uni-wuerzburg.de
Ideally, send small sample data.

@dgrun
Copy link
Owner

dgrun commented Feb 16, 2024

I ran your code.

Please install the RaceID package from CRAN, instead of sourcing the R file from this repo.

Also, there is no need to convert ndata to a data.frame: ndata <-hspc@assays$RNA@counts)

I also recommend computing the distance matrix in PCA space instead of in UMAP space. UMAP distances can be meaningless or at least very distorted.

require(RaceID)
library(Seurat)
hspc=readRDS("hspc.rds")
ndata <-hspc@assays$RNA@counts
sc <- SCseq(ndata)
sc <- filterdata(
object = sc,
mintotal = 500
)
part <- as.numeric(hspc@meta.data$RNA_snn_res.0.255)
d <- as.matrix(dist(hspc@reductions$umap@cell.embeddings))
umap <- as.data.frame(hspc@reductions$umap@cell.embeddings)
names(part) <- colnames(d)
n <- colnames(sc@ndata)
part <- part[n]
sc@cpart <- sc@cluster$kpart <- part
sc@distances <- d[n,n]
sc@tsne <- umap[n,]
sc@medoids <- compmedoids(sc, sc@cpart)
ltr <- Ltree(sc)
ltr <- compentropy(ltr)
ltr <- projcells(
object = ltr,
cthr=5, # use clusters with at least this many cells
nmode=TRUE # use knn
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants