Title: | Generate, manage, and edit data and metadata files suitable for the import in cBioPortal for Cancer Genomics |
---|---|
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. Create and edit clinical patient data, sample data, and timeline data. Create custom timeline tracks for patients. |
Authors: | Arsenij Ustjanzew [aut, cre, cph] , Federico Marini [aut] |
Maintainer: | Arsenij Ustjanzew <[email protected]> |
License: | AGPL-3 + file LICENSE |
Version: | 1.15.0 |
Built: | 2024-11-29 04:24:06 UTC |
Source: | https://github.com/bioc/cbpManager |
Server logic of module for adding a column
addColumn_Server(input, output, session, data)
addColumn_Server(input, output, session, data)
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
source data as data.frame |
reactive data.frame of modified source data
UI elements of module for adding a column
addColumn_UI(id, label = "Add column")
addColumn_UI(id, label = "Add column")
id |
module id |
label |
label of the button |
UI module
Server logic of module for adding a row
addRow_Server( input, output, session, data, patient_ids = NULL, dates_first_diagnosis = NULL, mode = c("timeline", "timepoint") )
addRow_Server( input, output, session, data, patient_ids = NULL, dates_first_diagnosis = NULL, mode = c("timeline", "timepoint") )
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
source data as data.frame |
patient_ids |
reactive vector of existing patient IDs |
dates_first_diagnosis |
data.frame with dates of the first diagnosis and patient IDs |
mode |
Mode of the timeline data. Controls which columns are displayed. |
reactive data.frame of modified source data
UI elements of module for adding a row
addRow_UI(id, label = "Add")
addRow_UI(id, label = "Add")
id |
module id |
label |
label of the button |
UI module
Server logic of Resource tab module for adding a row
addRowRc_Server( input, output, session, data, patient_ids = NULL, sample_ids = NULL, resource_ids = NULL, resource_type = c("definition", "sample", "patient", "study") )
addRowRc_Server( input, output, session, data, patient_ids = NULL, sample_ids = NULL, resource_ids = NULL, resource_type = c("definition", "sample", "patient", "study") )
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
Source data as data.frame |
patient_ids |
Reactive vector of existing patient IDs |
sample_ids |
Reactive data.frame of existing patient IDs and sample IDs |
resource_ids |
Reactive data.frame of data_resource_definition |
resource_type |
The type of the resource. Can be "definition", "sample", "patient", "study" |
reactive data.frame of modified source data
UI elements of Resource tab module for adding a row
addRowRc_UI(id, label = "Add")
addRowRc_UI(id, label = "Add")
id |
module id |
label |
label of the button |
UI module
This function takes a file object (from read.table), removes the # symbol,
sets the 5th row as the column names of the data.frame
and removes the rows containing the priority, data type and column name.
use read.table as follows: read.table(file, sep='\t', colClasses = 'character', comment.char = '')
cBioPortalToDataFrame(data)
cBioPortalToDataFrame(data)
data |
The data.frame of a cBioPortal sample/patient data file |
data.frame
df <- data.frame( V1=c("#attr_1", "#attribute 1", "#STRING", "#1", "ATTRIBUTE_1", "value_1"), V2=c("attr_2", "attribute 2", "STRING", "1", "ATTRIBUTE_2", "value_2") ) cbpManager:::cBioPortalToDataFrame(df)
df <- data.frame( V1=c("#attr_1", "#attribute 1", "#STRING", "#1", "ATTRIBUTE_1", "value_1"), V2=c("attr_2", "attribute 2", "STRING", "1", "ATTRIBUTE_2", "value_2") ) cbpManager:::cBioPortalToDataFrame(df)
Launch the cbpManager Shiny application.
cbpManager(studyDir = NULL, logDir = NULL, returnAppObj = FALSE, ...)
cbpManager(studyDir = NULL, logDir = NULL, returnAppObj = FALSE, ...)
studyDir |
Path to study folder containing studies of cBioPortal. |
logDir |
Path where a logfile should be saved. If NULL, logs are not stored |
returnAppObj |
Logical value, whether to return the app object if set to TRUE. Default behavior: directly runs the app (FALSE) |
... |
Further parameters that are used by |
shiny application object
if (interactive()) { cbpManager() }
if (interactive()) { cbpManager() }
'cbpManager' is an R package that provides an interactive Shiny-based graphical user interface for...
Arsenij Ustjanzew [email protected]
Check the input of dates
check_input_dates(diagnosisDate, startDate = NULL, endDate = NULL)
check_input_dates(diagnosisDate, startDate = NULL, endDate = NULL)
diagnosisDate |
date of first diagnosis |
startDate |
start date of timeline event |
endDate |
end date of timeline event |
Returns a number indicating the warning
cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", startDate = "2020-02-01", endDate = "2020-03-01" ) #returns 0 cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", startDate = "2019-02-01" ) #returns 2 cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", endDate = "2019-02-01" ) #returns 2 cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", startDate = "2020-03-01", endDate = "2020-02-01" ) #returns 1
cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", startDate = "2020-02-01", endDate = "2020-03-01" ) #returns 0 cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", startDate = "2019-02-01" ) #returns 2 cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", endDate = "2019-02-01" ) #returns 2 cbpManager:::check_input_dates( diagnosisDate = "2020-01-01", startDate = "2020-03-01", endDate = "2020-02-01" ) #returns 1
Convert the data.frame to the appropriate file format for cBioPortal
convertDataFrame(df)
convertDataFrame(df)
df |
data.frame |
Data.frame formated for the cBioPortal file format
cbpManager:::convertDataFrame( data.frame( ATTRIBUTE1=c("attr_1", "attribute 1", "STRING", "value_a1"), ATTRIBUTE2=c("attr_2", "attribute 2", "STRING", "value_b1") ) )
cbpManager:::convertDataFrame( data.frame( ATTRIBUTE1=c("attr_1", "attribute 1", "STRING", "value_a1"), ATTRIBUTE2=c("attr_2", "attribute 2", "STRING", "value_b1") ) )
This function takes a character string, replaces spaces by underscores and runs make.names.
create_name(x, toupper = TRUE)
create_name(x, toupper = TRUE)
x |
A character string. |
toupper |
If TRUE, the name wil be upper-case; if FALSE, the name will be lower-case. |
A sanitized string.
cbpManager:::create_name("Study name 1") #returns "STUDY_NAME_1" cbpManager:::create_name("FANCY;name", toupper = FALSE) #returns "fancy.name"
cbpManager:::create_name("Study name 1") #returns "STUDY_NAME_1" cbpManager:::create_name("FANCY;name", toupper = FALSE) #returns "fancy.name"
Server logic of module for deleting a column
deleteColumn_Server(input, output, session, data, exclude)
deleteColumn_Server(input, output, session, data, exclude)
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
source data as data.frame |
exclude |
column names that shoud be excluded from deletion |
reactive data.frame of modified source data
UI elements of module for deleting a column
deleteColumn_UI(id, label = "Delete column(s)")
deleteColumn_UI(id, label = "Delete column(s)")
id |
module id |
label |
label of the button |
UI module
Server logic of module for removing a row
deleteRow_Server(input, output, session, data, selected_row)
deleteRow_Server(input, output, session, data, selected_row)
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
source data as data.frame |
selected_row |
Index of the selected row from the table |
reactive data.frame of modified source data
UI elements of module for removing a row
deleteRow_UI(id, label = "Delete")
deleteRow_UI(id, label = "Delete")
id |
module id |
label |
label of the button |
UI module
Server logic of Resource tab module for deleting a row
deleteRowRc_Server( input, output, session, data, selected_row, mode = "default", sample_data = NULL, patient_data = NULL, study_data = NULL )
deleteRowRc_Server( input, output, session, data, selected_row, mode = "default", sample_data = NULL, patient_data = NULL, study_data = NULL )
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
Source data as data.frame |
selected_row |
Index of the selected row from the table |
mode |
If 'recursive' the resources bind to the resource definition will be deleted. |
sample_data |
Data of the resource from type 'sample' |
patient_data |
Data of the resource from type 'patient' |
study_data |
Data of the resource from type 'study' |
reactive data.frame of modified source data
UI elements of module for removing a row
deleteRowRc_UI(id, label = "Delete")
deleteRowRc_UI(id, label = "Delete")
id |
Module id |
label |
Label of the button |
UI module
Server logic of module for editing a row
editRow_Server( input, output, session, data, patient_ids = NULL, dates_first_diagnosis = NULL, selected_row = NULL, mode = c("timeline", "timepoint") )
editRow_Server( input, output, session, data, patient_ids = NULL, dates_first_diagnosis = NULL, selected_row = NULL, mode = c("timeline", "timepoint") )
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
source data as data.frame |
patient_ids |
reactive vector of existing patient IDs |
dates_first_diagnosis |
data.frame with dates of the first diagnosis and patient IDs |
selected_row |
the index of the selected row |
mode |
Mode of the timeline data. Controls which columns are displayed. |
reactive data.frame of modified source data
UI elements of module for editing a row
editRow_UI(id, label = "Edit")
editRow_UI(id, label = "Edit")
id |
module id |
label |
label of the button |
UI module
Server logic of Resource tab module for editing a row
editRowRc_Server( input, output, session, data, patient_ids = NULL, sample_ids = NULL, resource_ids = NULL, selected_row = NULL, resource_type = c("definition", "sample", "patient", "study") )
editRowRc_Server( input, output, session, data, patient_ids = NULL, sample_ids = NULL, resource_ids = NULL, selected_row = NULL, resource_type = c("definition", "sample", "patient", "study") )
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
Source data as data.frame |
patient_ids |
Reactive vector of existing patient IDs |
sample_ids |
Reactive data.frame of existing patient IDs and sample IDs |
resource_ids |
Reactive data.frame of data_resource_definition |
selected_row |
Index of the selected row |
resource_type |
The type of the resource. Can be "definition", "sample", "patient", "study" |
reactive data.frame of modified source data
UI elements of module for editing a row
editRowRc_UI(id, label = "Edit")
editRowRc_UI(id, label = "Edit")
id |
Module id |
label |
Label of the button |
UI module
Add empty column to a data.frame, if column does not exist in the data.frame
fncols(data, cname)
fncols(data, cname)
data |
data.frame |
cname |
column name |
data.frame
cbpManager:::fncols(data.frame(a=c(1,2,3), b=c(4,5,6)), "new")
cbpManager:::fncols(data.frame(a=c(1,2,3), b=c(4,5,6)), "new")
Create shiny UI-widget for specific columns of oncotree entries
generateOncotreeUIwidgets( colname, mode = c("add", "edit"), tab = c("Patient", "Sample") )
generateOncotreeUIwidgets( colname, mode = c("add", "edit"), tab = c("Patient", "Sample") )
colname |
column name |
mode |
determines the inputId prefix of the UI-widget |
tab |
"Patient", "Sample" - The used tab; sets the html id prefix of the input |
A oncotree specific shiny UI-widget
oncotree <- jsonlite::fromJSON(system.file("extdata", "oncotree.json", package = "cbpManager")) cancer_type <- unique(oncotree$mainType[which(!is.na(oncotree$mainType))]) cbpManager:::generateOncotreeUIwidgets("CANCER_TYPE", "add")
oncotree <- jsonlite::fromJSON(system.file("extdata", "oncotree.json", package = "cbpManager")) cancer_type <- unique(oncotree$mainType[which(!is.na(oncotree$mainType))]) cbpManager:::generateOncotreeUIwidgets("CANCER_TYPE", "add")
Generate UI input widget
generateUIwidgets( colname, mode = c("add", "edit"), tab = c("Patient", "Sample", "Mutation"), data = NULL, selected_row = NULL, patientIDs = NULL, sampleIDs = NULL )
generateUIwidgets( colname, mode = c("add", "edit"), tab = c("Patient", "Sample", "Mutation"), data = NULL, selected_row = NULL, patientIDs = NULL, sampleIDs = NULL )
colname |
A character string - the name of the column, that will be the label of the input |
mode |
"add" or "edit" - whether to use existing values or not |
tab |
"Patient", "Sample" - The used tab; sets the html id prefix of the input |
data |
A data.frame. |
selected_row |
A number indicating the row number of the selected row in the data.frame. |
patientIDs |
Vector of patient IDs used for drop down menu of the PATIENT_ID column |
A sanitized string.
cbpManager:::generateUIwidgets(colname = "attribute", mode = "add", tab = "Patient")
cbpManager:::generateUIwidgets(colname = "attribute", mode = "add", tab = "Patient")
Get Sample IDs associated with Patient IDs from the data_clinical_sample.txt file
getSampleIDs(file_path, patIDs)
getSampleIDs(file_path, patIDs)
file_path |
A character string. |
patIDs |
A character string. |
vector with Sample IDs
cbpManager:::getSampleIDs( system.file("study/testpatient/data_clinical_sample.txt", package = "cbpManager"), patIDs = "Testpatient")
cbpManager:::getSampleIDs( system.file("study/testpatient/data_clinical_sample.txt", package = "cbpManager"), patIDs = "Testpatient")
Import patient data into current study data.frames
importPatientData( mode = c("patient", "sample", "mutations", "timelines"), file_name, file_path, patIDs, data, associatedSampleIDs = NULL )
importPatientData( mode = c("patient", "sample", "mutations", "timelines"), file_name, file_path, patIDs, data, associatedSampleIDs = NULL )
mode |
Defines the type of imported data |
file_name |
Filename of source data |
file_path |
Filepath with filename of source data |
patIDs |
PATIENT_IDs of patients that should be imported |
data |
Source data, to be subsetted according to patIDs |
associatedSampleIDs |
The sample IDs associated to the patIDs |
data.frame
Check if input is in the appropriate date format
IsDate(mydate, date.format = "%Y-%m-%d")
IsDate(mydate, date.format = "%Y-%m-%d")
mydate |
date |
date.format |
string describig the date format |
boolean
cbpManager:::IsDate("2020-02-20") cbpManager:::IsDate("20.01.2020", date.format = "%d.%m.%Y")
cbpManager:::IsDate("2020-02-20") cbpManager:::IsDate("20.01.2020", date.format = "%d.%m.%Y")
Server logic of module for saving the resource data
saveResource_Server( input, output, session, data, study_id, data_filename, meta_filename, resource_type = c("SAMPLE", "DEFINITION", "PATIENT", "STUDY") )
saveResource_Server( input, output, session, data, study_id, data_filename, meta_filename, resource_type = c("SAMPLE", "DEFINITION", "PATIENT", "STUDY") )
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
Source data as data.frame |
study_id |
The current study ID |
data_filename |
File name of the data file |
meta_filename |
file name of the meta file |
resource_type |
The type of the resource. Can be "definition", "sample", "patient", "study" |
boolean value; TRUE if function was used.
UI elements of module for saving the resource data
saveResource_UI(id, label = "Save")
saveResource_UI(id, label = "Save")
id |
module id |
label |
label of the button |
UI module
Server logic of module for saving the source data
saveTimeline_Server(input, output, session, data, study_id)
saveTimeline_Server(input, output, session, data, study_id)
input |
Shiny input |
output |
Shiny output |
session |
Shiny session |
data |
source data as data.frame |
study_id |
the current study ID |
boolean value; TRUE if function was used.
UI elements of module for saving the data
saveTimeline_UI(id, label = "Save")
saveTimeline_UI(id, label = "Save")
id |
module id |
label |
label of the button |
UI module
Install conda environment with basilisk before launching the app
setupConda_cbpManager()
setupConda_cbpManager()
Nothing to return
## Not run: setupConda_cbpManager() ## End(Not run)
## Not run: setupConda_cbpManager() ## End(Not run)
Shiny app server function
shinyAppServer(input, output, session)
shinyAppServer(input, output, session)
input |
provided by shiny |
output |
provided by shiny |
session |
provided by shiny |
nothing to return
Shiny app server object create the shiny application user interface
shinyAppUI
shinyAppUI
An object of class shiny.tag
of length 3.
Updates UI-widgets for specific columns of oncotree entries
updateOncotreeUIwidgets( session, row_last_clicked, mode = c("add", "edit"), tab = c("Patient", "Sample") )
updateOncotreeUIwidgets( session, row_last_clicked, mode = c("add", "edit"), tab = c("Patient", "Sample") )
session |
Shiny session |
row_last_clicked |
the index of the row last clicked in the oncotree_table |
mode |
determines the inputId prefix of the UI-widget |
tab |
"Patient", "Sample" - The used tab; sets the html id pr |
nothing to return
Validate resource_definition input
validateResourceDefinition(values, resourceDf, mode = "add")
validateResourceDefinition(values, resourceDf, mode = "add")
values |
List of input values |
resourceDf |
data.frame of data_resource_definition |
mode |
The mode of the function ('add' or 'edit') |
boolean
Validate resource_patient input
validateResourcePatient(values)
validateResourcePatient(values)
values |
List of input values |
boolean
Validate resource_sample input
validateResourceSample(values)
validateResourceSample(values)
values |
List of input values |
boolean
Validate resource_study input
validateResourceStudy(values)
validateResourceStudy(values)
values |
List of input values |
boolean
Vector defining a set of Python dependencies and versions required to operate with the validation scripts for cBioPortal
.validation_dependencies
.validation_dependencies
A character vector containing the pinned versions of all Python packages on which the import validation depends.
Write a line to a logfile containing the date, time, username (from Shinyproxy), and the name of the modified file.
writeLogfile(outdir, modified_file, log_filename = "cbpManager_logfile.txt")
writeLogfile(outdir, modified_file, log_filename = "cbpManager_logfile.txt")
outdir |
directory, where the logfile should be saved |
modified_file |
Name of the modified file |
log_filename |
Name of the logfile |
Nothing to return
cbpManager:::writeLogfile(tempdir(), "data_clinical_patient.txt")
cbpManager:::writeLogfile(tempdir(), "data_clinical_patient.txt")