diff --git a/vignettes/bonus_content_04.Rmd b/vignettes/bonus_content_04.Rmd index a03a254..c0ff489 100644 --- a/vignettes/bonus_content_04.Rmd +++ b/vignettes/bonus_content_04.Rmd @@ -60,20 +60,20 @@ TODO ## iSEEfier -Let's say we are interested in visualizing the expression of some specific marker genes side by side, or maybe we created different initial states with custom panels separately but would like to visualize them in the same instance. We previously learned that we can do a lot of this by running the command: +Let's say we are interested in visualizing the expression of a list of specific marker genes in one view, or maybe we created different initial states separately, but would like to visualize them in the same instance. As we previously learned, we can do a lot of these tasks by running the command: ```{r, eval=FALSE} # don't run iSEE(sce) ``` -then add/remove panels to our need. This can involve multiple steps (selecting the gene, color by a specific `coldData`...) -For that we can use the `iSEEfier` package, which is a faster way to start (or if you will, fire-up) an `iSEE` instance with few lines of code, avoiding the tedious way of setting up every `iSEE` panel individually. -In this chapter we will illustrate a simple example of how to use `iSEEfier`. -We will use the same pbmc3k data we worked with during this workshop. +then add/remove the panels to our need. This can involve multiple steps (selecting the gene of interest, color by a specific `colData`...), or probably even write multiple lines of code. +For that we can use the `iSEEfier` package, which streamlines the process of starting (or if you will, firing up) an `iSEE` instance with a small chunk of code, avoiding the tedious way of setting up every `iSEE` panel individually. +In this chapter we will illustrate a simple example of how to use `iSEEfier`. We will use the same pbmc3k data we worked with during this workshop. +We start by loading the data: ```{r} -# load the data into the environment +# import data sce <- readRDS( file = system.file("datasets", "sce_pbmc3k.RDS", package = "iUSEiSEE") ) @@ -81,52 +81,56 @@ sce <- readRDS( sce ``` -For example, we can be interested in visualizing the expression of *GZMB*, *TGFB*, and *CD28* genes. We start by providing a couple of parameters: +For example, we can be interested in visualizing the expression of *GZMB*, *TGFB*, and *CD28* genes all at once. We start by providing a couple of parameters: ```{r} # define the list of genes feature_list <- c("GZMB", "TGFB1", "CD28") # define the cluster/cell type cluster <- "labels_main" -# define the group/condition -#group <- "" +``` + +Now we can pass these parameters into `iSEEinit()` to create a customized initial configuration: +```{r} # create an initial state with iSEEinit -initial <- iSEEfier::iSEEinit(sce, - features = feature_list, - clusters = cluster, - add_markdown_panel = T) +initial <- iSEEinit(sce, + features = feature_list, + clusters = cluster, + add_markdown_panel = TRUE) ``` -This will create an initial configuration that can be passed as an argument to the `iSEE()` call +The rest can be as easy as passing this initial to the `iSEE()` call: ```{r} -iSEE::iSEE(sce,initial = initial) +iSEE(sce,initial = initial) ``` -While we are visualizing the expression of these genes, we might want to take some notes (gene X is more expressed in a certain cell type/cluster than some others...) For this, we used the argument `add_markdown_panel = TRUE`. It will display a `MarkdownBoard` where we can note our observations. +While we are visualizing the expression of these genes, we might want to take some notes (gene X is more expressed in a certain cell type/cluster than some others, maybe we are trying to annotate the cells ourselves if the annotation wasn't available...) For this, we used the argument `add_markdown_panel = TRUE`. It will display a `MarkdownBoard` panel where we can note our observations without leaving the app. We can also use the argument `add_dynamicTable_panel=TRUE` to add another custom panel to display the maker genes of certain cluster/cell type. ```{r} feature_list1 <- c("CD74","CD79B") -initial1 <- iSEEfier::iSEEinit(sce, - features = feature_list1, - clusters = cluster, - add_markdown_panel = TRUE, - add_dynamicTable_panel = TRUE) +initial1 <- iSEEinit(sce, + features = feature_list1, + clusters = cluster, + add_markdown_panel = TRUE, + add_dynamicTable_panel = TRUE) ``` ```{r} -iSEE::iSEE(sce,initial = initial1) +iSEE(sce,initial = initial1) ``` -We can create different initial configurations and see what are the included panels, or how these panels are linked between each other without running the app `view_initial_tiles()` and `view_initial_network()`: +We can check the initial's content, or how the included panels are linked between each other without running the app with `view_initial_tiles()` and `view_initial_network()`: ```{r} library("ggplot2") library("visNetwork") +# display a graphical representation of the initial configuration, where the panels are identified by their corresponding colors view_initial_tiles(initial = initial) +# display a network visualization for the panels view_initial_network(initial, plot_format = "igraph") # another alternative for network visualization view_initial_network(initial, plot_format = "visNetwork") @@ -140,7 +144,7 @@ merged_config <- glue_initials(initial,initial1) view_initial_tiles(initial = merged_config) ``` -`?function()` is always your friend whenever you need further documentation on a certain function and how to use it. +`?iSEEfier` is always your friend whenever you need further documentation on the package/a certain function and how to use it. ## iSEEindex