Commit 8cff60f6 authored by António Domingues's avatar António Domingues

Automatically replaces missing gene symbols by Ensembl genes IDS and shows warning.

parent 2315be90
......@@ -53,6 +53,7 @@ calc_ci = function(df, variable, ci_interval=0.95){
# LOAD data ------------------------------------------------------------------------------------------------------------
missing_gene_name = FALSE
de_res <- read_tsv(file.path(dataPath, "de_results.txt")) %>%
transmute(external_gene_name, ensembl_gene_id, condition_1, condition_2, logfc = c1_over_c2_logfc, pvalue, padj, is_hit, c1_overex)
......@@ -79,8 +80,15 @@ norm_counts <- read_tsv(file.path(dataPath, "sizefac_normalized_counts_by_replic
left_join(de_res %>% distinct(ensembl_gene_id, external_gene_name), by = "ensembl_gene_id") %>%
transmute(gene_name = external_gene_name, ensembl_gene_id, method = "norm_counts", replicate, rep_values, condition)
all <- rbind(fpkms, tpms, norm_counts)
if(any(is.na(all$gene_name))) {
all %<>% mutate(gene_name = ifelse(is.na(gene_name), ensembl_gene_id, gene_name))
missing_gene_name = TRUE
}
#calculate confidence intervals:
ci <- all %>% group_by(gene_name, condition, method) %>% calc_ci(., rep_values)
all %<>% left_join(ci)
......@@ -109,13 +117,14 @@ app <- shinyApp(
),
fixedRow(
column(4, style = "height:100px",
selectInput(inputId = "gene_name", label = "Gene name", choices = gene_names, multiple = TRUE, selected = first_entry, selectize=TRUE)
column(4, style = "height:150px",
selectInput(inputId = "gene_name", label = "Gene name", choices = gene_names, multiple = TRUE, selected = first_entry, selectize=TRUE),
textOutput("no_gene_name")
),
column(4, style = "height:100px",
column(4, style = "height:150px",
radioButtons("method", label = "Normalization method", choiceNames = c("FPKM", "TPM", "Normalized Counts"), choiceValues = c("fpkm", "tpm", "norm_counts"))
),
column(4, style = "height:100px",
column(4, style = "height:150px",
checkboxGroupInput("options", label = "Optional", choiceNames = c("show confidence interval", "show line"), choiceValues = c("plot_ci", "plot_line"))
)
......@@ -235,6 +244,12 @@ app <- shinyApp(
output$table <- DT::renderDataTable({ DT::datatable(table_data()) })
output$no_gene_name <- renderText({
if(missing_gene_name) {
paste0("Attention: some of the gene symbols were missing and replaced by ensembl IDs")
}
})
}
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment