monocle-release icon indicating copy to clipboard operation
monocle-release copied to clipboard

Is it possible to give dimension reduced data from Seurat to Monocle?

Open bishwaG opened this issue 6 years ago • 17 comments

I have two time point data analysed using Seurat. I have done cell cycle correction and batch correction in Seurat. I would like to use the cell-cycel and batch corrected data to do pseudo time analysis using Monocle. I already have dimension reduced data. Following dataframe shows how my data looks like. Rownames are cell barcodes and columns are dimensions. Is it possible to give such input to Monocle to do pseudo-time analysis?

                    ACC1       ACC2        ACC3       ACC4       ACC5
AAACCTGAGAGCCTAG  0.2912968  1.9218620 -0.07594450 0.07920177  0.0214002
AAACCTGAGTGGCACA  1.3125555 -1.0346728  0.56284450 0.01348247 -0.1927503
AAACCTGCAATAACGA -0.3517998 -0.7054918  0.21015822 0.75798072  0.2751296
AAACCTGGTAGCTAAA  0.9580736 -0.5992308  0.01396823 0.57237873 -0.1930334

bishwaG avatar Jun 07 '18 08:06 bishwaG

I am also interested in this type of function. I would like to do trajectory and pseudo time analysis on Monocle using data that has been corrected and clustered in Seurat.

flay avatar Jun 12 '18 17:06 flay

I'm working on the same thing and here's what I've found: After importing Seurat object to Monocle, if you check: head(pData(imported_Seurat_object)), there should be a column of the clusters from Seurat. Then you use Seurat's clusters when plotting trajectory by specifying the column of Seurat's clusters: plot_cell_trajectory(imported_Seurat_object, color_by='the column of Seurat's clusters').

Also, I would like to know is it ok to use top 1,000 differentially expressed genes from Seurat's clusters as feature genes in Monocle trajectory analysis using setOrderingFilter() ?

qoiopipq avatar Jun 26 '18 05:06 qoiopipq

This seems like a common question and I have seen it several times. Not that it related to this issue #162 . Please let me know if you have any further question after you read the other issue.

We should be able to make a FAQ and demonstrate how can we do this with a short tutorial.

Regarding to @qoiopipq 's question about the ordering genes. I feel the procedure is reasonable although I never test it. The other option is to use the over-dispersion genes Seurat used for clustering.

Xiaojieqiu avatar Jun 26 '18 05:06 Xiaojieqiu

Thanks @qoiopipq
I am unable to use pData function on Seurat object.

> pData(seuratObj)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘pData’ for signature ‘"seurat"’

bishwaG avatar Jul 05 '18 12:07 bishwaG

@bishwaG pData() is in Monocle. Once you imported your Seurat object into Monocle, head(pData(Seurat object)) your Seurat clusters are in one of the columns.

qoiopipq avatar Jul 06 '18 00:07 qoiopipq

same issue here. I used ImportCDS to convert my corrected, dimensional reduced, clustered Seurat object into a CellDataSet, which was successful and I got the clustering column from Seurat in my CellDataSet. Then I tried what @qoiopipq suggested, but got this error:

> plot_cell_trajectory(importedseuratobject, color_by = "CellType") Error in if (cds@dim_reduce_type == "ICA") { : argument is of length zero

I'd be thankful for any suggestions.

esfandyari avatar Jul 18 '18 15:07 esfandyari

@esfandyari Did you just import your Seurat object and run plot_cell_trajectory straight away? You need to go through steps like estimating size factors & dispersion, setting feature genes, reduceDimension(using Monocle's DDRTree) and orderCells. Then you can run plot_cell_trajectory and specify the column of your Seurat's clusters.

qoiopipq avatar Jul 19 '18 01:07 qoiopipq

@esfandyari, if you use importCDS function, then I think the data is taken from the raw.data slot and not from the data or the scale.data slots. So, your batch and other corrections may not get picked up. If you wish to preserve those, then I think you will have to do what @Xiaojieqiu said in https://github.com/cole-trapnell-lab/monocle-release/issues/162. I am in the same situation, with the need to do pseudotime on cell-cycle corrected normalized data from Seurat, and I'm going to try what was suggested in https://github.com/cole-trapnell-lab/monocle-release/issues/162

CodeInTheSkies avatar Sep 06 '18 16:09 CodeInTheSkies

@esfandyari, if you use importCDS function, then I think the data is taken from the raw.data slot and not from the data or the scale.data slots. So, your batch and other corrections may not get picked up. If you wish to preserve those, then I think you will have to do what @Xiaojieqiu said in #162. I am in the same situation, with the need to do pseudotime on cell-cycle corrected normalized data from Seurat, and I'm going to try what was suggested in #162

Were you able to get this to work? I am working on a similar problem as well...

jebard avatar Oct 02 '18 19:10 jebard

@esfandyari @CodeInTheSkies Were you able to get this to work? I am working on a similar problem as well...

alextamburino avatar Nov 13 '18 17:11 alextamburino

Hi all,

Did anyone get this to work? I tried what is suggested in #162 but I get an error when I try to create the newCellDataSet using gaussianff.

s849 avatar Feb 04 '19 08:02 s849

I'm working on the same thing and here's what I've found: After importing Seurat object to Monocle, if you check: head(pData(imported_Seurat_object)), there should be a column of the clusters from Seurat. Then you use Seurat's clusters when plotting trajectory by specifying the column of Seurat's clusters: plot_cell_trajectory(imported_Seurat_object, color_by='the column of Seurat's clusters').

Also, I would like to know is it ok to use top 1,000 differentially expressed genes from Seurat's clusters as feature genes in Monocle trajectory analysis using setOrderingFilter() ?

Hi

I'm working on the same thing and here's what I've found: After importing Seurat object to Monocle, if you check: head(pData(imported_Seurat_object)), there should be a column of the clusters from Seurat. Then you use Seurat's clusters when plotting trajectory by specifying the column of Seurat's clusters: plot_cell_trajectory(imported_Seurat_object, color_by='the column of Seurat's clusters').

Also, I would like to know is it ok to use top 1,000 differentially expressed genes from Seurat's clusters as feature genes in Monocle trajectory analysis using setOrderingFilter() ?

Hi qoiopipq,

How to used Seurat pre-calculated reduced dimensions (umap) to do pseudotime in monocle?

Your suggestion is just color the cells in monocle trajectory according to Seurat clustering. However, the umap is different between monocle and Seurat due to the difference in normalization methods and genes selections.

How to make umap between two package consistent with each other? Thanks!

Best, Lei

Lei-Tian avatar Feb 08 '19 18:02 Lei-Tian

I have two time point data analysed using Seurat. I have done cell cycle correction and batch correction in Seurat. I would like to use the cell-cycel and batch corrected data to do pseudo time analysis using Monocle. I already have dimension reduced data. Following dataframe shows how my data looks like. Rownames are cell barcodes and columns are dimensions. Is it possible to give such input to Monocle to do pseudo-time analysis?

                    ACC1       ACC2        ACC3       ACC4       ACC5
AAACCTGAGAGCCTAG  0.2912968  1.9218620 -0.07594450 0.07920177  0.0214002
AAACCTGAGTGGCACA  1.3125555 -1.0346728  0.56284450 0.01348247 -0.1927503
AAACCTGCAATAACGA -0.3517998 -0.7054918  0.21015822 0.75798072  0.2751296
AAACCTGGTAGCTAAA  0.9580736 -0.5992308  0.01396823 0.57237873 -0.1930334

Hi, the following code helped me out:

all_monocle@reducedDimW=t(all@[email protected]) all_monocle@reducedDimS=t(all@[email protected]) all_monocle@reducedDimK=t(all@[email protected])

"all" is the Seurat object and "all_monocle" is the monocle object import from "all" using "importCDS" function.

Best, Lei

Lei-Tian avatar Feb 18 '19 19:02 Lei-Tian

I'm working on the same thing and here's what I've found: After importing Seurat object to Monocle, if you check: head(pData(imported_Seurat_object)), there should be a column of the clusters from Seurat. Then you use Seurat's clusters when plotting trajectory by specifying the column of Seurat's clusters: plot_cell_trajectory(imported_Seurat_object, color_by='the column of Seurat's clusters'). Also, I would like to know is it ok to use top 1,000 differentially expressed genes from Seurat's clusters as feature genes in Monocle trajectory analysis using setOrderingFilter() ?

Hi

I'm working on the same thing and here's what I've found: After importing Seurat object to Monocle, if you check: head(pData(imported_Seurat_object)), there should be a column of the clusters from Seurat. Then you use Seurat's clusters when plotting trajectory by specifying the column of Seurat's clusters: plot_cell_trajectory(imported_Seurat_object, color_by='the column of Seurat's clusters'). Also, I would like to know is it ok to use top 1,000 differentially expressed genes from Seurat's clusters as feature genes in Monocle trajectory analysis using setOrderingFilter() ?

Hi qoiopipq,

How to used Seurat pre-calculated reduced dimensions (umap) to do pseudotime in monocle?

Your suggestion is just color the cells in monocle trajectory according to Seurat clustering. However, the umap is different between monocle and Seurat due to the difference in normalization methods and genes selections.

How to make umap between two package consistent with each other? Thanks!

Best, Lei

I used Monocle2 for this. If I remember correctly, Monocle2 doesn't have UMAP for dimension reduction. Maybe you should try asking in Monocle3 User Group. The reason I suggested to use the same color scheme as Seurat, is easier to tell where Seurat's clusters sit along Monocle's trajectories. If everything works fine, same type of cells should next to each other along your trajectories. If you label same type of cells with different colors, it would be very difficult for your interpretation.

Cheers

qoiopipq avatar Feb 18 '19 23:02 qoiopipq

Hi, @Lei-Tian's code did give me a direct hint, here is some simple change based on Lei's code:

cds@reducedDimW=t(seurat.integrated@[email protected]) cds@reducedDimS=t(seurat.integrated@[email protected]) cds@reducedDimK=t(seurat.integrated@[email protected])

here I usecca.aligned as cell embeddings, which will retain the structure of umap embeddings by seurat RunUMAP.

Hope this helps.

MichaelPeibo avatar Mar 04 '19 11:03 MichaelPeibo

An update: If I use seurat umap's cell embeddings, which will cause a incomplete branch as below: image

however, if I use monocle's umap to learn graph, it will traverse the whole data as possible, as below: image

MichaelPeibo avatar Mar 04 '19 13:03 MichaelPeibo

@s849 Were you able to get it to work? I had the same exact problem with gaussianff(). Or did you by chance have a way around this? Thanks in advance!

liboxun avatar Apr 01 '20 23:04 liboxun