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

Disabling "Toggle to subset cells" in the app #15

Closed
dKlee99 opened this issue May 24, 2021 · 8 comments
Closed

Disabling "Toggle to subset cells" in the app #15

dKlee99 opened this issue May 24, 2021 · 8 comments

Comments

@dKlee99
Copy link

dKlee99 commented May 24, 2021

Hi,
Our lab is planning to use your package to create a database to be published soon and there are some functions in the app that we don't really want to make it appear such as "Toggle to subset cells" or "Download PDF/PNG". I would like to know if I should do this by manually changing ui/server script or by functions like "delMeta"/"modMetaName" available to customize options.

Thank you very much for providing this wonderful package!

@jfouyang
Copy link
Collaborator

jfouyang commented May 24, 2021

Hi, to remove the "Toggle to subset cells", you will have to edit both the ui.R and server.R scripts manually for now.

First, in server.R, you need to replace all instance of inpConf[UI == inpsub1]$ID with inpConf$ID[1]. This will deactivate the subsetting of cells on the plots.

Second, in ui.R, you need to comment out all the UI blocks related to the subsetting of cells. To do so, search for the phrase Toggle to subset cells. Then comment out the whole block of UI code related to it. An example is shown below where the line with # column( to the line with # ), # End of column (6 space) . This then has to be repeated for all the UI blocks to the subsetting of cells (of which there should be 4 of them).

The process is tedious and error-prone but I am afraid that this is the only way to remove the "Toggle to subset cells" function at this point in time.

            12, selectInput("sc1a1drX", "X-axis:", choices = sc1conf[dimred == TRUE]$UI, 
                           selected = sc1def$dimred[1]), 
            selectInput("sc1a1drY", "Y-axis:", choices = sc1conf[dimred == TRUE]$UI, 
                        selected = sc1def$dimred[2])) 
        ) 
      ), # End of column (6 space) 
      # column( 
      #   3, actionButton("sc1a1togL", "Toggle to subset cells"), 
      #   conditionalPanel( 
      #     condition = "input.sc1a1togL % 2 == 1", 
      #     selectInput("sc1a1sub1", "Cell information to subset:", 
      #                 choices = sc1conf[grp == TRUE]$UI, 
      #                 selected = sc1def$grp1), 
      #     uiOutput("sc1a1sub1.ui") 
      #   ) 
      # ), # End of column (6 space) 
      column( 
        6, actionButton("sc1a1tog0", "Toggle graphics controls"), 
        conditionalPanel( 
          condition = "input.sc1a1tog0 % 2 == 1", 
          fluidRow( 
            column( 

@jfouyang
Copy link
Collaborator

jfouyang commented May 24, 2021

Regarding the removal of "Download PDF/PNG" functionality, I strongly advise against it. Being able to export the images in your shiny app would likely boost the number of citations that your work will receive. Furthermore, even if this image exporting function is being removed, users of the shinyapp can still get images of your plots by taking screenshots or right-clicking on the plots to save images.

@jfouyang jfouyang changed the title Deleting some functions in the app Disabling "Toggle to subset cells" in the app May 24, 2021
@dKlee99
Copy link
Author

dKlee99 commented May 25, 2021

Thank you very much for your comment, it worked!
Regarding "Download PDF/PNG" functionality, I agree to your comment.

Should I apply the same method to disable other Toggle graphics controls Toggle plot controls?
Also, I have set default dimensional reduction to UMAP (we only want to show UMAP) so I tried to to disable "dimensional reduction" by commenting out corresponding section in ui.R but it didn't work. Should I apply the same method you mentioned above here as well? Thank you so much!

@jfouyang
Copy link
Collaborator

Hi,

For Toggle graphics controls, it is used to control the aesthetics of the plot like the point size etc. And for Toggle plot controls, it is used to change the colour scheme for continuous data e.g. gene expression. So there is no harm in keeping these buttons as they help to finetune the appearance of your plots. We added these functionalities to make it easier to browse on a variety of devices, for example, you might want a smaller plot size or font size if you are browsing the app on your mobile and bigger sizes if you are browsing on a desktop.

As for the dimension reduction, if you only ran UMAP, the shinycell app should only contain UMAP and PCA coordinates as plotting options. I don't see why you would want to hide the PCA coordinates and most people would not be interested in the PCA anyways.

@dKlee99
Copy link
Author

dKlee99 commented May 26, 2021

Hi,
Thank you for your prompt comment!
We will keep Toggle graphics controls and Toggle plot controls functions as you suggested.

For the dimensional reduction, we are trying to keep our data visualization as simple as possible. As you mentioned, most viewers would not be interested in the PCA so we would rather only show UMAP. Would it be still possible to comment out dimension reduction section by editing ui.R and server.R? Additional dimensional reductions, such as PC and harmony1, also appear in cell information. It would grateful to know your suggestion to solve this issue. Thank you very much and have a great day!

@jfouyang
Copy link
Collaborator

The dimensional reduction code is very well integrated into the ShinyCell package, appearing at numerous locations throughout the code. Thus, it is not practical to comment out code related to it. The best solution I have is to remove the PCA and harmony coordinates in the Seurat object before running ShinyCell. This will prevent the PC / harmony1 coordinates from appearing.

To do so, you can run the following to modify your seurat object before running ShinyCell:

Reductions(seu)           # This gets you the names of the dimensional reduction 
seu[["pca"]] = NULL       # Removes PCA coordinates
seu[["harmony"]] = NULL   # make sure this name matches the one shown by Reductions(seu) 

@dKlee99
Copy link
Author

dKlee99 commented Jun 11, 2021

Thank you so much for your help!!

@dKlee99 dKlee99 closed this as completed Jun 11, 2021
@jfouyang
Copy link
Collaborator

jfouyang commented Jul 6, 2021

Hi, in the latest update of ShinyCell, there is now a new argument enableSubset in the makeShinyApp or makeShinyCodesMulti function. If you want to disable the "Toggle to subset cells", you can set enableSubset = FALSE to deactivate the functionality. Do try it out!

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