SONGDONGYUAN1994 / scDesign3

scDesign3 generates realistic in silico data for multimodal single-cell and spatial omics
https://songdongyuan1994.github.io/scDesign3/docs/index.html
MIT License
79 stars 23 forks source link

the results of fit_marginal are all null #61

Open Santanevrgivup opened 3 weeks ago

Santanevrgivup commented 3 weeks ago

my code: data <- construct_data( sce = sce, assay_use = "counts", celltype = "cell_type", pseudotime = NULL, spatial = c("spatial1", "spatial2"), other_covariates = NULL, corr_by = "1" ) marginal <- fit_marginal( data = data, predictor = "gene", mu_formula = "s(spatial1, spatial2, bs = 'gp', k= 50)", sigma_formula = "1", family_use = "nb", n_cores = 10, usebam = FALSE ) origin data is from tech DBiT-seq, and with dim(1988*1662) after preprocessed.

here is the output of fit_marginal function

微信图片_20240927213345

so in the next step(fit_copula) also report errors like this : Error in colnames<-(*tmp*, value = rownames(sce)) : attempt to set 'colnames' on an object with less than two dimensions Calls: fit_copula -> convert_n -> colnames<- In addition: Warning message: In mclapply(seq_len(n), do_one, mc.preschedule = mc.preschedule, : all scheduled cores encountered errors in user code Execution halted I would greatly appreciate your help!

SONGDONGYUAN1994 commented 3 weeks ago

Hi, The result means that the fit_marginal fails for all the genes. This is usually caused by some errors in the input data (output of construct_data). Could you set all n_cores = 1 and check the error message?

Best, Dongyuan

Santanevrgivup commented 3 weeks ago

Dear Dongyuan, Following your suggestion, I set all n.cores values to 1 and checked the output of the construct_data function. I couldn't find any anomalies. So the output of fit_marginal still results in all empty values, and this process didn't produce any error messages. Could you please provide me with some further guidance? I greatly appreciate your help.

image image
SONGDONGYUAN1994 commented 3 weeks ago

This is weird. Could you share your sce data with me? You can mask the gene names if you are worried about data leaking. I can check it.

Best, Dongyuan

Santanevrgivup commented 3 weeks ago

Of course, it would be my pleasure!This data is public, so there are no concerns about data leakage. Please feel free to proceed without any worries.This compressed file contains three files: 'input_sce' is the sce_obj that has been preprocessed and is ready to be input into construct_data, 'code.R' contains part of the relevant code, and 'GSM418~' is the raw data. Thank you again! Santa Check.zip

SONGDONGYUAN1994 commented 3 weeks ago

@Santanevrgivup Hi Santa,

I found the problem. Please convert your spatial locations (spatial1, spatial2) from chr to numeric. Now they are characheters so that the model cannot fit.

Best, Dongyuan

Santanevrgivup commented 3 weeks ago

Hi Dongyuan,

The problem has been solved by following your suggestion! Thank you once again for your patient guidance. Sincerely wish you good health and lasting academic vigor!

Santa