gao-lab / Cell_BLAST

A BLAST-like toolkit for large-scale scRNA-seq data querying and annotation.

Home Page:http://cblast.gao-lab.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

h5 file generation problem

evenDDDDD opened this issue · 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.

  1. 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 use ax.get_figure().savefig("file.pdf") to save it to a file, assuming ax is the returned Axes object. For the Sankey comparison plot, the cb.blast.sankey function returns a plotly dict. The picture should appear automatically if you use Jupyter Notebook, otherwise you may use plotly.io.write_image(d, "file.pdf"), assuming d is the returned plotly dict.
  2. 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))
  1. My guess is that the expression matrix contains cells with all-zero expression, or contains negative values (the expression matrix should consist of non-negative raw UMI counts).

  2. The API has changed a little bit since v0.3. Please refer to the new tutorial here.