#' GOBubblePlotly
#'
#' Produces a Bubble Plot for the genes of a given GO term.
#'
#' @param object Seurat object
#' @param go_term Gene Ontology term identifier (i.e. GO:0046774)
#' @param grouping_var Factor by which to group cells. Default: ident
#' @param plot_height Plot height in pixels. Default: 900
#' @param gene_filter Display only genes in this list. Default: NULL
#' @param ... Additional arguments to pass to BubblePlotly
#' @param plot_width Plot width in pixels. (default: 900)
#'
#' @importFrom dplyr select distinct filter
#'
#' @return
#' @export
#'
GOBubblePlotly <- function(object,
go_term,
grouping_var = "ident",
plot_height = 900,
plot_width = 900,
gene_filter = NULL,
...){
hgnc_symbol <- NULL
if(missing(go_term)){
stop("No GO term supplied")
}
go_genes_to_plot <- retrieveGO(go_term) %>%
select(hgnc_symbol) %>%
distinct() %>%
if (!is.null(gene_filter)){
filter(hgnc_symbol %in% gene_filter)
}
if(length(go_genes_to_plot) > 0){
BubblePlotly(object,
features_plot = go_genes_to_plot$hgnc_symbol,
grouping_var = grouping_var,
plot_height = plot_height,
plot_width = plot_width,
...)
} else {
print("No genes for that term are expressed in the dataset.")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.