edroaldo / cellrouter

Reconstruction of complex single-cell trajectories using CellRouter
45 stars 21 forks source link

cellrouter addInfo #15

Open kunUCSD opened 5 years ago

kunUCSD commented 5 years ago

Dear Edroaldo, Thanks for designing the cellrouter program. Recently, I'm try to do trajectory using it. My current data is from Seurat, but I met this error when I want to create a CellRouter object. My code is here:

samples <- get(load('Paul_Cell_samples.R')) cellrouter <- CellRouter(path='Paul_Cell_data.R', min.cells=3, min.genes=0) [1] "Initializing CellRouter object" data <- as.data.frame(as.matrix(seurat@raw.data)) cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0, min.genes=0) [1] "Initializing CellRouter object" cellrouter <- addInfo(cellrouter, metadata = seurat@meta.data, colname = 'merged_20_Aug', metadata.column='res.0.8') Error in rep(colors, times = replicate_row) : invalid 'times' argument

Any help will be appreciated! Thanks! Best, Kun

edroaldo commented 5 years ago

Hi Kun,

Thank you for your interest in CellRouter.

You need to make sure that the dimensions of the raw data after creating the cellrouter object and the dimensions of the metadata table from seurat are the same. Please, try something like: data <- as.data.frame(as.matrix(seurat@raw.data)) cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0, min.genes=0)

You are already doing the above... so could you pelase send me: dim(seurat@raw.data) dim(seurat@meta.data)

Thanks!

Em ter, 21 de ago de 2018 às 21:25, KunUCSD notifications@github.com escreveu:

Dear Edroaldo, Thanks for designing the cellrouter program. Recently, I'm try to do trajectory using it. My current data is from Seurat, but I met this error when I want to create a CellRouter object. My code is here:

samples <- get(load('Paul_Cell_samples.R')) cellrouter <- CellRouter(path='Paul_Cell_data.R', min.cells=3, min.genes=0) [1] "Initializing CellRouter object" data <- as.data.frame(as.matrix(seurat@raw.data)) cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0, min.genes=0) [1] "Initializing CellRouter object" cellrouter <- addInfo(cellrouter, metadata = seurat@meta.data, colname = 'merged_20_Aug', metadata.column='res.0.8') Error in rep(colors, times = replicate_row) : invalid 'times' argument

Any help will be appreciated! Thanks! Best, Kun

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqUR8DNW-RjRBjz-kG_K-juLXrXGDB0ks5uTLLzgaJpZM4WG15P .

-- Edroaldo

kunUCSD commented 5 years ago

Dear Edroaldo,

Thanks. Here is the dimension, they are different, does this cause the error? How should I fix it? Thanks.

dim(neo_C1@raw.data) [1] 29408 4859 dim(neo__C1@meta.data) [1] 4391 34

edroaldo commented 5 years ago

Thanks for the information. You can do something like this:

data <- as.data.frame(as.matrix(seurat@raw.data[, rownames(seurat@meta.data))) #so, only raw data for which there is associated metadata is included. cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0, min.genes=0) cellrouter <- addInfo(cellrouter, metadata = seurat@meta.data, colname = 'merged_20_Aug', metadata.column='res.0.8')

Let me know if that works. T

Thanks!

Em qua, 22 de ago de 2018 às 12:51, KunUCSD notifications@github.com escreveu:

Dear Edroaldo,

Thanks. Here is the dimension, they are different, does this cause the error? How should I fix it? Thanks.

dim(neo_C1@raw.data) [1] 29408 4859 dim(neo__C1@meta.data) [1] 4391 34

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15#issuecomment-415101201, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqUR-EposuspnxbJ4-r66qqbfV79HaXks5uTYwHgaJpZM4WG15P .

-- Edroaldo

kunUCSD commented 5 years ago

Dear Edroaldo, Thanks. I tried and it still showed the same error... Here is the code:

data <- as.data.frame(as.matrix(neo_C1@raw.data[,rownames(neo_C1@meta.data)])) cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0, min.genes=0) [1] "Initializing CellRouter object" dim(data) [1] 29408 4391 dim(neo_C1@meta.data) [1] 4391 34 cellrouter <- addInfo(cellrouter, metadata = neo_C1@meta.data, colname = 'merged_20_Aug', metadata.column='res.0.8') Error in rep(colors, times = replicate_row) : invalid 'times' argument Best, Kun

edroaldo commented 5 years ago

A previous user had the same issue and this worked for him:

data <- as.data.frame(as.matrix(seurat@raw.data)) cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0,

  • min.genes=0) [1] "Initializing CellRouter object" > metadata <- seurat@meta.data cellrouter <- addInfo(cellrouter, metadata=metadata, colname = 'res.0.7', metadata.column = 'res.0.7')

Can you try to create a metadata variable as above and call addInfo as above? I know that this should be equivalent to what you are doing but I noticed that sometimes, I cannot save seurat@data. I need assign to seurat@data to a variable and then save the variable...

It does not make too much sense but I am surprised you are getting this error. Other users, including myself, haev used results from seurat wihth cellrouter too...

Pleas,e let me know if the code above works...

Thanks!

Em qua, 22 de ago de 2018 às 16:46, KunUCSD notifications@github.com escreveu:

Dear Edroaldo, Thanks. I tried and it still showed the same error... Here is the code:

data <- as.data.frame(as.matrix(neo_C1@raw.data[,rownames(neo_C1@meta.data )])) cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0,

-

                    min.genes=0)

[1] "Initializing CellRouter object"

dim(data) [1] 29408 4391 dim(neo_C1@meta.data) [1] 4391 34 cellrouter <- addInfo(cellrouter, metadata = neo_C1@meta.data, colname = 'merged_20_Aug', metadata.column='res.0.8') Error in rep(colors, times = replicate_row) : invalid 'times' argument Best, Kun

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15#issuecomment-415173964, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqUR8JM8hLbZaLsbD4fu6KVZrO8h6EWks5uTcMkgaJpZM4WG15P .

-- Edroaldo

kunUCSD commented 5 years ago

Dear Edroaldo, I tried to make the variable and called the addInfo, but met with the same error... My Seurat object has many different annotation, need I delete some? Best, Kun

edroaldo commented 5 years ago

In principle, you would not need to delete any information. Can you please send me the follow info:

seurat@raw.data[1:5,1:5] seurat@data[1:5,1:5] seurat@metadata[1:5,]

Just want do double-check a few things..

Thanks!

Em qua, 22 de ago de 2018 às 17:06, KunUCSD notifications@github.com escreveu:

Dear Edroaldo, I tried to make the variable and called the addInfo, but met with the same error... My Seurat object has many different annotation, need I delete some? Best, Kun

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15#issuecomment-415180021, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqURxBvTvmmIzDdOp8yNQN---ZKYemhks5uTcfLgaJpZM4WG15P .

-- Edroaldo

kunUCSD commented 5 years ago

Dear Edroaldo, Sorry for the delayed reply, just had a meeting. Here is the info: image

edroaldo commented 5 years ago

This is the issue: the column names in your neo_C1@raw.data do not match with the rownames in neo_C1@meta.data. In neo_C1@meta.data there seems to be an additional "D" in front of your cell ids. I do not know how your importing your data into seurat but you need to manage to make the column names of you @raw.data object match with the row names in @meta.data. This is not a cellrouter issue.

Hope it helps. Let me know if that works. Thanks!

Em qua, 22 de ago de 2018 às 19:20, KunUCSD notifications@github.com escreveu:

Dear Edroaldo, Sorry for the delayed reply, just had a meeting. Here is the info:

neo_C1@raw.data[1:5,1:5] 5 x 5 sparse Matrix of class "dgCMatrix" 2T_AAAGTAGAGAACAATC 2T_AACACGTGTTAAAGAC 2T_ACATCAGGTCTGGTCG 2T_ACGAGCCCAATCGGTT 2T_ACGGAGACAGCGTCCA RP11-34P13.7 . . . . . AL627309.1 . 1 . . . AP006222.2 . . 2 . . RP4-669L17.10 . . . . . RP11-206L10.3 . . . . 1 neo_C1@data[1:5,1:5] 5 x 5 sparse Matrix of class "dgCMatrix" 2T_AAAGTAGAGAACAATC 2T_ACGAGCCCAATCGGTT 2T_AGGGAGTAGTGACATA 2T_CACACAACACTCGACG 2T_CAGTAACTCGCGCCAA RP11-34P13.7 . . . . . AL627309.1 . . . . . AP006222.2 . . . . 1.010743 RP4-669L17.10 . . . 1.273872 . RP11-206L10.3 . . . . . neo_C1@meta.data[1:5,] nGene nUMI orig.ident percent.mito batch res.0.6 res.0.4 res.0.8 res.1.2 infomap walktrap multilevel velocyto tree.ident newId D2T_AAAGTAGAGAACAATC 1650 2944 D2_T 0.2568213 D2T 0 3 1 6 11 8 6 2 NA preSPG D2T_ACGAGCCCAATCGGTT 1384 2517 D2_T 0.3313421 D2T 3 3 4 6 11 8 6 2 3 preSPG D2T_AGGGAGTAGTGACATA 1988 3387 D2_T 0.2320789 D2T 1 3 0 6 11 8 6 2 3 preSPG D2T_CACACAACACTCGACG 1900 3894 D2_T 0.3066426 D2T 3 3 4 6 11 8 6 2 3 preSPG D2T_CAGTAACTCGCGCCAA 2634 5734 D2_T 0.2133869 D2T 0 3 2 6 11 8 6 2 3 preSPG ID ident newID_monocle S.Score old.ident tempID newPGCLIDD source new_diffSPG GCnew monocle_ident 2T_AAAGTAGAGAACAATC PreSPG Intermediate Intermediate -0.11751679 Neonatal Intermediate PreSPG Neonatal 2T_ACGAGCCCAATCGGTT PreSPG Intermediate Intermediate -0.16908749 Neonatal Intermediate PreSPG Neonatal 2T_AGGGAGTAGTGACATA Intermediate Intermediate 0.07688675 Neonatal Intermediate PreSPG Neonatal 2T_CACACAACACTCGACG PreSPG Intermediate Intermediate 0.05150827 Neonatal Intermediate PreSPG Neonatal 2T_CAGTAACTCGCGCCAA PreSPG Intermediate Intermediate -0.14460912 Neonatal Intermediate PreSPG Neonatal Monocle_ident newcombinedID G2M.Score Phase platform var.ratio.pca merged_ID_12Aug gPGC_merged_20_Aug 2T_AAAGTAGAGAACAATC Intermediate preSPG -0.04297471 G1 10X 0.9234762 PreSPG PreSPG 2T_ACGAGCCCAATCGGTT Intermediate preSPG 0.09448125 G2M 10X 0.9433806 PreSPG PreSPG 2T_AGGGAGTAGTGACATA Intermediate preSPG -0.12927445 S 10X 0.7457309 PreSPG PreSPG 2T_CACACAACACTCGACG Intermediate preSPG 0.26457024 G2M 10X 0.9392665 PreSPG PreSPG 2T_CAGTAACTCGCGCCAA Intermediate preSPG -0.16218555 G1 10X 0.8728712 PreSPG PreSPG

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15#issuecomment-415218706, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqUR7VI8PE2ZuO6UkvSpqb4nXxMdGwqks5uTecmgaJpZM4WG15P .

-- Edroaldo

kunUCSD commented 5 years ago

Dear Edroaldo, Sorry, it's my fault. All these column names contain "D", I deleted it to keep them in one line. But left some... All other info are correct. So, I guess it's not because of this. Sorry about this. Can you check if there are any other issue? Thanks. Best,Kun

edroaldo commented 5 years ago

hum... that's strange,

could you please send to me: cellrouter@rawdata[1:5,1:5] cellrouter@ndata[1:5,1:5] class(neo_C1@meta.data)

Not sure what it is wrong on your end... so need more info...

thanks!

Em qua, 22 de ago de 2018 às 22:35, KunUCSD notifications@github.com escreveu:

Dear Edroaldo, Sorry, it's my fault. All these column names contain "D", I deleted it to keep them in one line. But left some... All other info are correct. So, I guess it's not because of this. Sorry about this. Can you check if there are any other issue? Thanks. Best,Kun

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15#issuecomment-415262809, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqUR_Rrzs0qjqmmhL9mM7FlhtY3tmefks5uThTkgaJpZM4WG15P .

-- Edroaldo

kunUCSD commented 5 years ago

Dear Edroaldo,

I don't have the data on my laptop, will send it to you tomorrow. Best, Kun

From: edroaldo [notifications@github.com] Sent: Wednesday, August 22, 2018 7:47 PM To: edroaldo/cellrouter Cc: Tan, Kun; Author Subject: Re: [edroaldo/cellrouter] cellrouter addInfo (#15)

hum... that's strange,

could you please send to me: cellrouter@rawdata[1:5,1:5] cellrouter@ndata[1:5,1:5] class(neo_C1@meta.data)

Not sure what it is wrong on your end... so need more info...

thanks!

Em qua, 22 de ago de 2018 às 22:35, KunUCSD notifications@github.com escreveu:

Dear Edroaldo, Sorry, it's my fault. All these column names contain "D", I deleted it to keep them in one line. But left some... All other info are correct. So, I guess it's not because of this. Sorry about this. Can you check if there are any other issue? Thanks. Best,Kun

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15#issuecomment-415262809, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqUR_Rrzs0qjqmmhL9mM7FlhtY3tmefks5uThTkgaJpZM4WG15P .

-- Edroaldo

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/edroaldo/cellrouter/issues/15#issuecomment-415265035, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgAWC-3z2rJ7_ISQoy0Js_iXw4xbfnHtks5uThfXgaJpZM4WG15P.

kunUCSD commented 5 years ago

Dear Edroaldo, Sorry about the delayed reply, have so many things to handle today. Here is the info:

cellrouter@rawdata[1:5,1:5] D2T_AAAGTAGAGAACAATC D2T_ACGAGCCCAATCGGTT D2T_AGGGAGTAGTGACATA D2T_CACACAACACTCGACG D2T_CAGTAACTCGCGCCAA RP11-34P13.7 0 0 0 0 0 AL627309.1 0 0 0 0 0 AP006222.2 0 0 0 0 1 RP4-669L17.10 0 0 0 1 0 RP11-206L10.3 0 0 0 0 0 cellrouter@ndata[1:5,1:5] D2T_AAAGTAGAGAACAATC D2T_ACGAGCCCAATCGGTT D2T_AGGGAGTAGTGACATA D2T_CACACAACACTCGACG D2T_CAGTAACTCGCGCCAA RP11-34P13.7 0 0 0 0 0 AL627309.1 0 0 0 0 0 AP006222.2 0 0 0 0 1 RP4-669L17.10 0 0 0 1 0 RP11-206L10.3 0 0 0 0 0 class(neo_C1@meta.data) [1] "data.frame"

Best, Kun

edroaldo commented 5 years ago

Hi,

I am sorry but I cannot reproduce your error. I get the same error as you if dimensions are different. I have a seurat analysis froma previous project that I just loaded into my R section and used the seurat clusters that I previously identified and everything worked. Are sure you are not missing anything? This code worked just find for me:

data <- as.data.frame(as.matrix(seurat@raw.data)) data <- data[,rownames(seurat@meta.data)] cellrouter <- CellRouter(rawdata=as.data.frame(data), min.cells=0, min.genes=0) cellrouter <- addInfo(cellrouter, metadata = seurat@meta.data, colname = 'seurat', metadata.column = 'res.0.6')

Thanks!

Em sex, 24 de ago de 2018 às 00:09, KunUCSD notifications@github.com escreveu:

Dear Edroaldo, Sorry about the delayed reply, have so many things to handle today. Here is the info:

cellrouter@rawdata[1:5,1:5] D2T_AAAGTAGAGAACAATC D2T_ACGAGCCCAATCGGTT D2T_AGGGAGTAGTGACATA D2T_CACACAACACTCGACG D2T_CAGTAACTCGCGCCAA RP11-34P13.7 0 0 0 0 0 AL627309.1 0 0 0 0 0 AP006222.2 0 0 0 0 1 RP4-669L17.10 0 0 0 1 0 RP11-206L10.3 0 0 0 0 0 cellrouter@ndata[1:5,1:5] D2T_AAAGTAGAGAACAATC D2T_ACGAGCCCAATCGGTT D2T_AGGGAGTAGTGACATA D2T_CACACAACACTCGACG D2T_CAGTAACTCGCGCCAA RP11-34P13.7 0 0 0 0 0 AL627309.1 0 0 0 0 0 AP006222.2 0 0 0 0 1 RP4-669L17.10 0 0 0 1 0 RP11-206L10.3 0 0 0 0 0 class(neo_C1@meta.data) [1] "data.frame"

Best, Kun

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edroaldo/cellrouter/issues/15#issuecomment-415645392, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqURxpHiJ_r-_R4C3IAbtynvVvsl5Ihks5uT3ySgaJpZM4WG15P .

-- Edroaldo

kunUCSD commented 5 years ago

Thank you Edroaldo for all efforts, I'll re-make the object, and see if it works. Thanks, Kun