h5 file generation problem
evenDDDDD opened this issue · 11 comments
1.Why appears such an error when generating h5 file:
"MY_ERROR: Error in CreateSeuratObject (raw.data = object @ exprs, meta.data = object @ obs): The parameter is not useful (raw.data = object @ exprs) \ n".
I used the same data and R script in the collect part of your GitHub to run it. Seurat is also installed;
2、Is cell_ontology necessary?
thank you!
Thanks for your interest! I guess it's a problem with incompatible Seurat versions (v3 changed the API significantly and is incompatible with v2). Our data collection scripts used Seurat v2.3.3. Could you confirm what Seurat version are you using?
Okay, great! Switching to Seurat v2 should solve the problem.
The cell ontology annotation is unnecessary. Just skip the "cell_ontology" argument when constructing the dataset, it should work fine.
Can you provide a code snippet to illustrate how you are using the model?
To get the latent coordinates and write them to file, you can use data.latent = model.inference(data)
, and then call data.write_dataset("somefile.h5")
.
Some docs and examples can be found here:
Let me know if any further issues.
- If you are running IPython with access to a graphical interface, or using Jupyter Notebook, the picture should appear automatically when tSNE computation is done (I personally have only used Jupyter Notebook though). Computing tSNE can take a long period of time if the number of cells is large. If that is the case, just wait a few moments and let it finish. If no graphical interface is available (e.g. running IPython over ssh), the picture would not appear. For
matplotlib.axes._subplots.AxesSubplot
objects, you may useax.get_figure().savefig("file.pdf")
to save it to a file, assumingax
is the returned Axes object. For the Sankey comparison plot, thecb.blast.sankey
function returns a plotly dict. The picture should appear automatically if you use Jupyter Notebook, otherwise you may useplotly.io.write_image(d, "file.pdf")
, assumingd
is the returned plotly dict. - Yes, you can use any type of annotation that you have, not limited to cell ontology.
Hi!
Your work on defining cell types is excellent. I want to repeat your work, but I ran into a problem.
These are my codes below:
`expr_mat <- read.table("./p2_counts.txt",header = TRUE, row.names = 1)
expr_mat1 <- as.matrix(expr_mat)
meta_df <- read.table("./p2_metadata.txt", header = TRUE, row.names = 1, sep='\t')
colnames(meta_df) <- c("cell_type1")
cell_ontology <- read.csv("./p2_cell_ontology.csv", sep='\t')
cell_ontology <- cell_ontology[, c("cell_type1", "cell_ontology_class", "cell_ontology_id")]
construct_dataset("./p22_10x/", as.matrix(expr_mat), meta_df, datasets_meta = NULL, cell_ontology)`
The error is:
Error in validObject(.Object) : invalid class “ExprDataSet” object: FALSE
I can't understand what is happening, my installed seurat is v2.3.4 and R is 3.6.3.
Look forward to your reply!
It is likely because meta_df differs from expr_mat in terms of row number and row names. Could you validate that:
nrow(expr_mat) == nrow(meta_df)
all(rownames(expr_mat) == rownames(meta_df))