Allow selecting the expression dataset

This commit is contained in:
Elias Projahn 2022-12-01 21:23:46 +01:00
parent 2f24812c90
commit 510fafeb6e
15 changed files with 110 additions and 57 deletions

View file

@ -1,2 +1,9 @@
#' A `data.table` containig data on genes and their expression behavior.
#' A `data.table` containig mappings of Ensembl gene ID to HGNC symbol.
"genes"
#' The results from the analysis across all GTEx samples.
"gtex_all"
#' The results from the analysis across Human Protein Atlas' tissue aggregated
#' data.
"hpa_tissues"

View file

@ -10,7 +10,7 @@
#' percentiles for each gene.
#'
#' @export
rank_genes <- function(data = ubigen::genes,
rank_genes <- function(data = ubigen::gtex_all,
cross_sample_metric = "above_95",
cross_sample_weight = 0.5,
level_metric = "median_expression_normalized",

View file

@ -1,8 +1,19 @@
#' Server implementing the main user interface.
#' @noRd
server <- function(input, output, session) {
dataset <- reactive({
analysis <- if (input$dataset == "hpa_tissues") {
ubigen::hpa_tissues
} else {
ubigen::gtex_all
}
merge(analysis, ubigen::genes, by = "gene")
})
ranked_data <- reactive({
rank_genes(
data = dataset(),
cross_sample_metric = input$cross_sample_metric,
cross_sample_weight = input$cross_sample_weight,
level_metric = input$level_metric,

8
R/ui.R
View file

@ -19,6 +19,14 @@ ui <- function() {
h3("Your genes"),
gene_selector_ui("custom_genes"),
h3("Method"),
selectInput(
"dataset",
label = strong("Expression dataset"),
list(
"GTEx (all samples)" = "gtex_all",
"Human Protein Atlas (tissues)" = "hpa_tissues"
)
),
selectInput(
"cross_sample_metric",
verticalLayout(