R code run slow with plot_genes_violin (monocles)?

Dear I've had problem with running R code. I've used monocles for my out-put plots (e.g. cluster plot and violin one).
It runs pretty fast (~ 20-40 sec) with loading data and executing cluster plot even with the user interaction command (which allows user can choose/change specific gene/marker she/he wants to express in cluster plot). However, it takes ~7 min to display the plots with ONLY ONE extra command: plot_gene_violin function/command? Could you guys help me with it? Is there any wrong with my code???? I've appreciated yours help a lot.
Thanks and best, NT

Here is server.R code which includes cluster plot and violin plot commands
(I can upload the whole code if it is necessary).
server <- function(input, output, session) {

    output$plot_cell_clusters1<-renderPlot(
      plot_cell_clusters (cds_all495Cells, color_by="Cluster", cell_size = 2.0))
    
    output$plot_cell_clusters2<-renderPlot(
      plot_cell_clusters(cds_all495Cells, cell_size = 2, color_by = "FACScellType"))
    
    output$plot_cell_clusters3 <-renderPlot({
      updateSelectInput(session, inputId='genes', label='please enter you marker', selected = NULL)  
       validate(need(input$genes == disp_table$gene_id, "A chosen gene is not found/type your gene"))
            plot_cell_clusters (cds_all495Cells, markers=input$genes, cell_size = 3.0) + 
                    scale_colour_gradient2(low = "#999999", mid = "lightblue", high = "darkblue", midpoint = 1.5, limits = c(-1, 4))
    })
 
    output$plot4<-renderPlot(
    plot_genes_violin(cds_all495Cells, color_by= "Cluster", grouping = "Cluster", panel_order = input$genes))

}

Run the same code locally to eliminate server-client issues before adjusting the code.

Thanks for your advice.
I did run it locally before and after adjusting code, but it's still a problem.. any further suggestion? thanks

Have you profiled your code to see what's taking longest? profvis, for example, might help:
https://rstudio.github.io/profvis/

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.