Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gene Variant Module #12

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export(mod_docs_page_server)
export(mod_docs_page_ui)
export(mod_explore_page_server)
export(mod_explore_page_ui)
export(mod_gene_variant_server)
export(mod_gene_variant_ui)
export(mod_latent_variables_server)
export(mod_latent_variables_ui)
export(mod_resources_page_server)
Expand Down
10 changes: 10 additions & 0 deletions R/mod_explore_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ mod_explore_page_ui <- function(id){
tabName = "immune_infiltration",
icon = icon("cog")
),
menuSubItem(
"Gene Variants",
tabName = "gene_var",
icon = icon("cog")
),
menuSubItem(
"Latent Variables",
tabName = "latent_variables",
Expand All @@ -44,6 +49,10 @@ mod_explore_page_ui <- function(id){
tabItem(
tabName = 'immune_infiltration'
),
tabItem(
tabName = "gene_var",
mod_gene_variant_ui(ns("gene_variant_ui"))
),
tabItem(
tabName = "latent_variables",
mod_latent_variables_ui(ns("latent_variables_ui_1"))
Expand All @@ -63,6 +72,7 @@ mod_explore_page_ui <- function(id){
mod_explore_page_server <- function(input, output, session, specimens){
ns <- session$ns

callModule(mod_gene_variant_server, "gene_variant_ui")
callModule(mod_latent_variables_server, "latent_variables_ui_1", specimens)
}

Expand Down
93 changes: 93 additions & 0 deletions R/mod_gene_var.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Module UI

#' @title mod_gene_variant_ui and mod_gene_variant_server
#' @description A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_gene_variant
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_gene_variant_ui <- function(id){
ns <- NS(id)

dashboardBody(
tagList(

# selectizeInput(ns("studyName"), label = "Study Name", choices = unique(kairos::exome_data$study),
# selected = unique(kairos::exome_data$study), multiple = T),
#
selectizeInput(ns("Genes"), label = "Genes", choices = unique(kairos::jhu_tumor_file@data$Hugo_Symbol),
selected = "NF1", multiple = F),

box(title = "Positional information of variants in tumor samples",
status = "primary", solidHeader = TRUE,
width = 1000,
collapsible = FALSE,
plotOutput(ns('lollipop_plot'))
)

)
)
}

# Module Server

#' @rdname mod_gene_variant
#' @export
#' @keywords internal

mod_gene_variant_server <- function(input, output, session){
ns <- session$ns

output$lollipop_plot <- shiny::renderPlot({

maftools::lollipopPlot(
kairos::jhu_tumor_file,
gene = input$Genes,
AACol = NULL,
labelPos = NULL,
labPosSize = 0.9,
showMutationRate = TRUE,
showDomainLabel = TRUE,
cBioPortal = FALSE,
refSeqID = NULL,
proteinID = NULL,
repel = FALSE,
collapsePosLabel = TRUE,
legendTxtSize = 1.5,
labPosAngle = 0,
domainLabelSize = 1.5,
axisTextSize = c(1, 1),
printCount = FALSE,
colors = NULL,
domainColors = NULL,
labelOnlyUniqueDoamins = TRUE,
defaultYaxis = FALSE,
titleSize = c(1.2, 1),
pointSize = 2.5
)

# maftools::oncoplot(kairos::jhu_tumor_file,
# genes = c("NF1", "EGR2"),
# drawRowBar = TRUE, drawColBar = TRUE,
# clinicalFeatures = c("tumorType", "sampleType","individualID"),
# #sortByAnnotation = TRUE, annotationColor = color_list, groupAnnotationBySize = FALSE,
# removeNonMutated = FALSE, logColBar = FALSE,
# SampleNamefont = 5,annotationFontSize = 1.5, fontSize = 1,legendFontSize = 1.8,
# titleFontSize = 1.0, keepGeneOrder = TRUE, GeneOrderSort = TRUE, bgCol = "white", borderCol = "white")
})

}

## To be copied in the UI
# mod_gene_variant_ui("gene_variant_ui")

## To be copied in the server
# callModule(mod_gene_variant_server, "gene_variant_ui")

3 changes: 3 additions & 0 deletions data-raw/jhu_maf.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Prep Maf file for plotting
load("data-raw/jhu_maf.RData")
usethis::use_data(jhu_tumor_file)
Binary file added data-raw/jhu_maf.RData
Binary file not shown.
Binary file added data/jhu_tumor_file.rda
Binary file not shown.
24 changes: 24 additions & 0 deletions man/mod_gene_variant.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.