Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about "plot_genes_in_pseudotime" #713

Open
vgettaa opened this issue Apr 16, 2024 · 1 comment
Open

question about "plot_genes_in_pseudotime" #713

vgettaa opened this issue Apr 16, 2024 · 1 comment

Comments

@vgettaa
Copy link

vgettaa commented Apr 16, 2024

Dear all,
I tried to plot genes that changed expression over pseudotime and I got a plot that all dots are on the x-axis, the plot and code are as follow:
plot_genes_in_pseudotime(cds_order_1["CSN3",],color_cells_by="condition")
微信图片_20240416144838

Then I added the "min_expr" mentioned in #602 . The plot seems to be incorrect since the curve is not fitted by the dots, the plot and code are as follow:

p1<-plot_genes_in_pseudotime(cds_order_1["CSN3",],color_cells_by="condition") 
p2<-plot_genes_in_pseudotime(cds_order_1["CSN3",],color_cells_by="condition",min_expr=min(p1$data$expectation)) 
p2

微信图片_20240416150028

I checked the function plot_genes_in_pseudotime() https://rdrr.io/github/cole-trapnell-lab/monocle3/src/R/plotting.R. I think it seems that the problem in p1 was caused by round() function (cds_exprs <- reshape2::melt(round(as.matrix(cds_exprs))) line 1026), but I dont know why p2 would plot like that.

> table(p1$data$expression)
    0     1 
14598     1 
> table(p2$data$expression)
0.000180963278421048                    1 
               14598                    1 

Overall, I directly assigned the expression values based on line 1024-1025(https://rdrr.io/github/cole-trapnell-lab/monocle3/src/R/plotting.R). But I dont know whether the code is right or not:

a<-cds_order_1["CSN3",]
cds_exprs <- SingleCellExperiment::counts(a)
cds_exprs <- Matrix::t(counts(a))/size_factors(a)
p2$data$expression<-as.numeric(cds_exprs)
p2

微信图片_20240416162650

Any suggestions are appreciated, Thanks!

@wbiangw
Copy link

wbiangw commented May 20, 2024

Dear all, I tried to plot genes that changed expression over pseudotime and I got a plot that all dots are on the x-axis, the plot and code are as follow: plot_genes_in_pseudotime(cds_order_1["CSN3",],color_cells_by="condition") 微信图片_20240416144838

Then I added the "min_expr" mentioned in #602 . The plot seems to be incorrect since the curve is not fitted by the dots, the plot and code are as follow:

p1<-plot_genes_in_pseudotime(cds_order_1["CSN3",],color_cells_by="condition") 
p2<-plot_genes_in_pseudotime(cds_order_1["CSN3",],color_cells_by="condition",min_expr=min(p1$data$expectation)) 
p2

微信图片_20240416150028

I checked the function plot_genes_in_pseudotime() https://rdrr.io/github/cole-trapnell-lab/monocle3/src/R/plotting.R. I think it seems that the problem in p1 was caused by round() function (cds_exprs <- reshape2::melt(round(as.matrix(cds_exprs))) line 1026), but I dont know why p2 would plot like that.

> table(p1$data$expression)
    0     1 
14598     1 
> table(p2$data$expression)
0.000180963278421048                    1 
               14598                    1 

Overall, I directly assigned the expression values based on line 1024-1025(https://rdrr.io/github/cole-trapnell-lab/monocle3/src/R/plotting.R). But I dont know whether the code is right or not:

a<-cds_order_1["CSN3",]
cds_exprs <- SingleCellExperiment::counts(a)
cds_exprs <- Matrix::t(counts(a))/size_factors(a)
p2$data$expression<-as.numeric(cds_exprs)
p2

微信图片_20240416162650

Any suggestions are appreciated, Thanks!

Thank you vgettaa for asking these questions while proposing the solution, I got the same question about why there's a round() function in source code and I'm glad to see you asking this —— but actually I have no clue about it yet.
I managed to get the proper plot by assigning the expression values just as you did, It looks really better.

图片

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants