Plumber DimPlot cannot print graph in response body

Hi R community,
I am trying to show a dimplot graph with a object reduced with umap. However, I cannot run this and it response me with "An exception occurred". I can demonstrate the graphs of VlnPlot and ElbowPlot in the response section but just not DimPlot. Can anyone tell me how to fix this problem? Thank you.

#* clustering_umap
#* serializer png
#* @post /clustering_umap
clustering_umap <- function(dims, resolution){
  seurat_obj <- uploaded_file

  dims <- as.numeric(dims)
  resolution <- as.numeric(resolution)

  seurat_obj <- FindNeighbors(seurat_obj, dims = 1:dims) #dims = dimensions
  seurat_obj <- FindClusters(seurat_obj, resolution = resolution)
  seurat_obj <- RunUMAP(seurat_obj, dims = 1:dims)
  # SaveSeuratRds(seurat_obj, file='clustering_umap.RDS')

  p <- DimPlot(seurat_obj, reduction = "umap")

  uploaded_file <<- seurat_obj

Would you mind adding this block to your API. At least to get more information about the error.

#* @plumber
function(pr) {
  pr |> pr_set_debug(TRUE)

Hi, I found that I forgot to add "@" before serializer png. After I add this, it works. Thank you!

This topic was automatically closed 42 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.