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

Cna tab #18

Open
wants to merge 23 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Version: 0.99.3
Date: 2021-03-16
Authors@R: c(
person(given = "Arsenij", family = "Ustjanzew", email = "[email protected]", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-1014-4521")),
person("Federico", "Marini", role = "aut", email = "[email protected]", comment = c(ORCID = '0000-0003-3252-7758')))
person("Federico", "Marini", role = "aut", email = "[email protected]", comment = c(ORCID = '0000-0003-3252-7758')),
person(given = "Charlotte", family = "Reuschel", email = "[email protected]", role = "aut", comment = c(ORCID = "0000-0003-2722-279X")))
Description: This R package provides an R Shiny application that enables the user to generate,
manage, and edit data and metadata files suitable for the import in cBioPortal for Cancer Genomics.
Create cancer studies and edit its metadata. Upload mutation data of a patient that will be concatenated to the data_mutation_extended.txt file of the study.
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ importFrom(basilisk,basiliskStart)
importFrom(basilisk,basiliskStop)
importFrom(dplyr,bind_rows)
importFrom(dplyr,mutate)
importFrom(htmltools,HTML)
importFrom(htmltools,tagList)
importFrom(jsonlite,fromJSON)
importFrom(magrittr,"%<>%")
Expand Down Expand Up @@ -52,6 +53,7 @@ importFrom(shiny,selectInput)
importFrom(shiny,shinyApp)
importFrom(shiny,showModal)
importFrom(shiny,showNotification)
importFrom(shiny,splitLayout)
importFrom(shiny,tags)
importFrom(shiny,textInput)
importFrom(shiny,uiOutput)
Expand Down
4 changes: 2 additions & 2 deletions R/cbpManager-pkg.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @author Arsenij Ustjanzew \email{arsenij.ustjanzew@@gmail.com}
#'
#' @importFrom magrittr %>% %<>%
#' @importFrom shiny actionButton column dateInput fluidRow icon invalidateLater
#' @importFrom shiny actionButton column dateInput fluidRow icon invalidateLater splitLayout
#' modalButton modalDialog NS numericInput observeEvent reactive reactiveValues
#' reactiveValuesToList removeModal renderText renderUI runApp selectInput
#' shinyApp showModal showNotification textInput uiOutput updateSelectInput
Expand All @@ -17,7 +17,7 @@
#' @importFrom dplyr bind_rows mutate
#' @importFrom jsonlite fromJSON
#' @importFrom vroom vroom
#' @importFrom htmltools tagList
#' @importFrom htmltools tagList HTML
#' @importFrom shinydashboard box dashboardBody dashboardHeader dashboardPage
#' dashboardSidebar menuItem sidebarMenu tabBox tabItem tabItems
#' @importFrom DT renderDT styleEqual DTOutput datatable formatStyle renderDataTable
Expand Down
27 changes: 27 additions & 0 deletions R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -534,3 +534,30 @@ Please try reinstalling cbpManager and basilisk or contact the support at https:
}
})
}

#' Read a metafile line by line into a data frame.
#'
#' @param filepath Filepath with filename of metafile.
#' @return data.frame
#' @examples
#' cbpManager:::read_meta(system.file("study", "testpatient", "meta_CNA.txt", package = "cbpManager"))
#'
read_meta <- function(filepath) {
meta_df <- data.frame(attribute = character(), value = character())
con = file(filepath, "r")
while (TRUE) {
line = readLines(con, n = 1)
if (length(line) == 0) {
break
}
splited_line <- stringr::str_split(line, ": ", n = 2)
meta_df <-
rbind(meta_df,
list(
attribute = splited_line[[1]][1],
value = splited_line[[1]][2])
)
}
close(con)
return(meta_df)
}
1 change: 1 addition & 0 deletions R/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source(system.file("tabs", "studyTab.R", package = "cbpManager"), local = TRUE)
source(system.file("tabs", "patientTab.R", package = "cbpManager"), local = TRUE)
source(system.file("tabs", "sampleTab.R", package = "cbpManager"), local = TRUE)
source(system.file("tabs", "mutationsTab.R", package = "cbpManager"), local = TRUE)
source(system.file("tabs", "cnaTab.R", package = "cbpManager"), local = TRUE)
source(system.file("tabs", "timelineTab.R", package = "cbpManager"), local = TRUE)
source(system.file("tabs", "resourceTab.R", package = "cbpManager"), local = TRUE)
source(system.file("tabs", "validationTab.R", package = "cbpManager"), local = TRUE)
Expand Down
8 changes: 5 additions & 3 deletions R/shinyAppServer.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ shinyAppServer <- function(input, output, session) {
source(system.file("reactives", "reactivesSampleTab.R", package = "cbpManager"), local = TRUE)
# Tab 4 Mutations ---------------------------------------------------------------
source(system.file("reactives", "reactivesMutationsTab.R", package = "cbpManager"), local = TRUE)
# Tab 5 Timelines ---------------------------------------------------------------
# Tab 5 Copy Number Data ---------------------------------------------------------
source(system.file("reactives", "reactivesCnaTab.R", package = "cbpManager"), local = TRUE)
# Tab 6 Timelines ---------------------------------------------------------------
source(system.file("reactives", "reactivesTimelineTab.R", package = "cbpManager"), local = TRUE)
# Tab 6 Resource data ---------------------------------------------------------------
# Tab 7 Resource data ---------------------------------------------------------------
source(system.file("reactives", "reactivesResourceTab.R", package = "cbpManager"), local=TRUE)
# Tab 7 Validation ---------------------------------------------------------------
# Tab 8 Validation ---------------------------------------------------------------
source(system.file("reactives", "reactivesValidationTab.R", package = "cbpManager"), local=TRUE)
}
4 changes: 4 additions & 0 deletions R/shinyAppUI.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ shinyAppUI <- dashboardPage(
menuItem("Patient", tabName = "patient"),
menuItem("Sample", tabName = "sample"),
menuItem("Mutations", tabName = "mutations"),
menuItem("Copy Number Data", tabName = "cna"),
menuItem("Timelines", tabName = "timelines"),
menuItem("Resources", tabName = "resource"),
menuItem("Validation", tabName = "validation")
Expand Down Expand Up @@ -98,6 +99,9 @@ shinyAppUI <- dashboardPage(

# Tab 4 Mutations - mutationsTab.R
mutationsTab,

# Tab Copy Number Data - cnaTab.R
cnaTab,

# Tab 5 Timelines - timelineTab.R
timelineTab,
Expand Down
23 changes: 23 additions & 0 deletions inst/apphelp/descriptionCnaTab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Load a valid copy number data file.** This file is used in cBioPortal for the copy number data panel (see image on the right.)

---

#### Description of a valid copy number alteration data file:

The user can currently upload the file **"all_thresholded.by_genes.txt"** derived from GISTIC 2.0 or a **tab-separated file** containing the following columns:

One or both of:

- **Hugo_Symbol (Required)**: A HUGO gene symbol.
- **Entrez_Gene_Id (Optional, but recommended)**: An Entrez Gene identifier.

**For each sample in the dataset an additional column is required using the sample ID as column header.** Please make sure that all of the sample IDs have been added to the loaded study via the Sample tab before upload the file.

The discrete copy number data file contains for each gene-sample combination a copy number level. By default the following applies:
- "-2" is a deep loss, possibly a homozygous deletion
- "-1" is a single-copy loss (heterozygous deletion)
- "0" is diploid
- "1" indicates a low-level gain
- "2" is a high-level amplification

The information "profile_name" and "profile_description" listed in the metafile can be adapted to the uploaded file (see "Change metadata of copy number alteration" below). It is recommended to provide the source and a brief characterization of the data under "profile_name" and to define the interpretation of the copy number level in the "profile_description".
9 changes: 9 additions & 0 deletions inst/apphelp/tour_cna.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
element;intro
#Welcome;Welcome to the interactive tour for <code>cbpManager</code>!<br><br>In the <b>Copy Number Data</b> tab, you can add copy number alteration data to samples by uploading a file in the appropriate format. In the following you will learn how to do this in detail.
#cna_description;This box contains a description of the <b>Copy Number Data</b> tab.
#cna_img;Here you can see an example image how the copy number data will look later in cBioPortal.
#cna_metadata; Here you have the opportunity of changing the information that is saved in the metafile of the copy number data under "profile_name" and "profile_description". Please refer to the description above for more information.
#CNAdata;If the loaded study already has copy number data, it would be shown in this table.
#chooseCNADiv;Upload a copy number data file to the study. This file will be concatenated to the existing copy number data. Please have a look at the description box for the correct file format! If the upload was successful, the new copy number data is added to the table on the right.
#saveCNA;Make the changes persistent by saving the file!
#Thanks;Thank you for taking the <b>Copy Number Data</b> tab tour of <code>cbpManager</code>!
Loading