mirror of
https://github.com/johrpan/ubigen.git
synced 2025-10-26 19:57:24 +01:00
Add outputs for custom genes
This commit is contained in:
parent
5f5670171d
commit
7f69b26a49
3 changed files with 95 additions and 11 deletions
29
R/plots.R
29
R/plots.R
|
|
@ -24,7 +24,7 @@ overview_plot <- function(ranked_data,
|
|||
yaxis = list(title = "Score")
|
||||
)
|
||||
|
||||
if (!is.null(highlighted_genes)) {
|
||||
if (length(highlighted_genes) > 0) {
|
||||
figure <- figure |>
|
||||
plotly::add_markers(
|
||||
data = ranked_data[gene %chin% highlighted_genes],
|
||||
|
|
@ -44,6 +44,33 @@ overview_plot <- function(ranked_data,
|
|||
figure
|
||||
}
|
||||
|
||||
#' Create a plot comparing some genes with the overall ranking.
|
||||
#'
|
||||
#' @param ranked_data The ranking to visualize.
|
||||
#' @param highlighted_genes Genes that will be compared.
|
||||
#'
|
||||
#' @return A `plotly` figure.
|
||||
#' @noRd
|
||||
box_plot <- function(ranked_data, highlighted_genes) {
|
||||
data <- data.table::copy(ranked_data)
|
||||
data[, group := data.table::fifelse(
|
||||
gene %chin% highlighted_genes,
|
||||
"Your genes",
|
||||
"Other genes"
|
||||
)]
|
||||
|
||||
plotly::plot_ly() |>
|
||||
plotly::add_boxplot(
|
||||
data = data,
|
||||
x = ~score,
|
||||
y = ~group,
|
||||
boxpoints = FALSE
|
||||
) |> plotly::layout(
|
||||
xaxis = list(title = "Score"),
|
||||
yaxis = list(title = "")
|
||||
)
|
||||
}
|
||||
|
||||
#' Create plot showing the distribution of scores using `plotly`.
|
||||
#'
|
||||
#' @param ranked_data Data on genes with precomputed ranks.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue