Closed yc508 closed 7 months ago
Hi,
This error message is very vague. It seems the input matrices might not be in the right shape. Can you check the dimensions?
The easiest way is probably to use R and bypass reticulate. You can export the matrices to a folder and run the Python code from command-line. In this way there is no need to convert to Anndata.
From R
dir.path <- 'temporary_path'
dir.create(dir.path, recursive=T)
write.table(cg_output[["features"]], paste0(dir.path, "gene_names.csv"), row.names = F, col.names = F, sep = ",")
write.table(cg_output[["graph.dist"]], paste0(dir.path, "ot_cost.csv"), row.names = F, col.names = F, sep = ",")
Matrix::writeMM(Matrix(cg_output[["gene.expression"]], sparse = T), paste0(dir.path, "gene_expression.mtx"))
Run from command line (assuming gene trajectory is installed in the Python environment)
python -m gene_trajectory.compute_gene_distance_cmd --path 'temporary_path'
Load back results
gene.dist.mat <- LoadGeneDistMat(dir.path, file_name = "emd.csv")
Hi,
Thank you very much for your help! It works now.
I have trouble importing cal_ot_mat_from_numpy using reticulate so I have converted my Seurat object to anndata with Seurat Disk and use Gene Trajectory in python. And I have stuck at the step extract_gene_trajectory. The error message I receive is as following. Could you help me out with this issue? Or could you should me where can I find the gene_distance_cal.py so I can continute using Gene Trajectory in R. Thank you very much!
ValueError: Cannot apply_along_axis when any iteration dimensions are 0