Hello every,
I am trying to transform a seurat oject to a monocle 3 object. I use the following codes:
seur_obj <- NormalizeData(seur_obj)
seur_obj <- FindVariableFeatures(seur_obj)
seur_obj <- ScaleData(seur_obj)
seur_obj <- RunPCA(seur_obj)
seur_obj <- RunUMAP(seur_obj, dims = 1:20)
data <- GetAssayData(seur_obj, assay = 'RNA', slot = 'counts')
cell_metadata <- seur_obj@meta.data
gene_annotation <- data.frame(gene_short_name = rownames(data))
rownames(gene_annotation) <- rownames(data)
mono_obj <- new_cell_data_set(data, cell_metadata = cell_metadata,
gene_metadata = gene_annotation)
It seems that only the "counts" slot in the seur_obj can be introduced into the monocle object, and is stored in the "@assays@data$counts" slot. If I use "scale.data" in the
"GetAssayData" function like:
data <- GetAssayData(seur_obj, assay = 'RNA', slot = 'scale.data')
cell_metadata <- seur_obj@meta.data
gene_annotation <- data.frame(gene_short_name = rownames(data))
rownames(gene_annotation) <- rownames(data)
mono_obj <- new_cell_data_set(data, cell_metadata = cell_metadata,
gene_metadata = gene_annotation)
I will get error:
Error in log(cell_total) : (converted from warning) NaNs produced
So how to introduce normalized and scaled seurat data into mono_obj? Or is there functions to do normalization and scaling in monocle?
In Monocle 3, the function "preprocess_cds" normalize and scale the data by default, by I don't know where the nornalized and scaled data is stored. I can only find the counts data in mono_obj@assays@data$counts.
Beside, I want to do some analysis on some clusters based on the normalized scaled data in the mono_obj. Because I can only find the count data, I expect to convert the mono_obj to a Seurat object. In monocle 2, the function "exportCDS" can do this, but this function has disappeared. Is there any other function that does this in monocle 3?
Thank you in advance!
Have a look at
as.cell_data_set
fromSeuratWrappers