Title: | Easily explore patterns of somatic variation in cancer using 'CRUX' |
---|---|
Description: | Shiny app for exploring somatic variation in cancer. Powered by maftools. |
Authors: | Sam El-Kamand [cre, aut] |
Maintainer: | Sam El-Kamand <[email protected]> |
License: | GPL-3 + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-11-11 06:03:54 UTC |
Source: | https://github.com/CCICB/CRUX |
Reads the first line of a file and confirms that it is an ANNOVAR file, then returns 'ensGene' or 'refGene' base on whether refseq or ensemble reference tables were for gene-based annotations
annovar_guess_reference_table(path)
annovar_guess_reference_table(path)
path |
path to file |
one of MAF, ANNOVAR, VCF, OTHER
Runs a bunch of assertions on the supplied rnaseq dataframe to determine whether it is valid. Will error if it is not.
assert_rnaseq_df_is_formatted_correctly(rnaseq_df)
assert_rnaseq_df_is_formatted_correctly(rnaseq_df)
rnaseq_df |
Dataframe containing at least three columns, named "Tumor_Sample_Barcode", "Hugo_Symbol" and "TPM". May optionally include columns named "Fold_Change" and "Transcript" (dataframe) |
Nothing, run for its side effects
Assert that class is maf_data_pool object
assert_that_class_is_maf_data_pool(object)
assert_that_class_is_maf_data_pool(object)
object |
some object whose class you want to assert (anything) |
(invisible) TRUE if assertion succeeds, Throws an error if it doesn't
Other class_assertions:
assert_that_class_is_maf_dataset_wrapper()
Assert that class is maf_data_pool
assert_that_class_is_maf_dataset_wrapper(object)
assert_that_class_is_maf_dataset_wrapper(object)
object |
some object whose class you want to assert (anything) |
(invisible) TRUE if assertion succeeds, Throws an error if it doesn't
Other class_assertions:
assert_that_class_is_maf_data_pool()
Turn Text into A Badge
badgify( vec, fontweight = c("bold", "bolder", "normal", "inherit", "initial", "lighter", "unset"), fontsize = c("xx-small", "x-small", "small", "medium", "large", "unset", "inherit"), color_background = "#d2d6de", color_text = "#444" )
badgify( vec, fontweight = c("bold", "bolder", "normal", "inherit", "initial", "lighter", "unset"), fontsize = c("xx-small", "x-small", "small", "medium", "large", "unset", "inherit"), color_background = "#d2d6de", color_text = "#444" )
vec |
a vector of terms to make into a badge |
fontweight |
fontweight of badge text |
fontsize |
fontsize of badge text |
color_background |
background colour. Can be a single value or a vector the same length as vec. |
color_text |
text colour. Can be a single value or a vector the same length as vec. |
string with html encoding for the badge
Hex codes
bool_to_colour( boolean, colour_if_true = "#69C776", colour_if_false = "#ED7676" )
bool_to_colour( boolean, colour_if_true = "#69C776", colour_if_false = "#ED7676" )
boolean |
TRUE/FALSE (boolean) |
colour_if_true |
colour to return if true (string) |
colour_if_false |
colour to return if false (string) |
colour code (string)
CRUX:::bool_to_colour(1==1)
CRUX:::bool_to_colour(1==1)
Check if class is a maf_data_pool object
class_is_maf_data_pool(object)
class_is_maf_data_pool(object)
object |
some object whose class you want to check |
TRUE if class of object is maf_data_pool, FALSE if not. (logical)
CRUX:::class_is_maf_data_pool("Hi") CRUX:::class_is_maf_data_pool(CRUX:::new_maf_data_pool())
CRUX:::class_is_maf_data_pool("Hi") CRUX:::class_is_maf_data_pool(CRUX:::new_maf_data_pool())
Check if class is a maf_dataset_wrapper object
class_is_maf_dataset_wrapper(object)
class_is_maf_dataset_wrapper(object)
object |
some object whose class you want to check |
TRUE if class of object is maf_dataset_wrapper, FALSE if not. (logical)
CRUX:::class_is_maf_dataset_wrapper("Hi")
CRUX:::class_is_maf_dataset_wrapper("Hi")
This function takes some UI element and a compiletime-evaluated expression and returns the UI element ONLY if the condition is true
conditionalUI(expression, ui_element)
conditionalUI(expression, ui_element)
expression |
compile-time evaluated expression (no server/reactive variables) |
ui_element |
the UI element to display if expression = TRUE |
if expression==TRUE: taglist wrapping passed UI element. If expression == FALSE, empty taglist
# In UI: somevariable=TRUE shinyWidgets::panel( heading="constitutivepanel", CRUX:::conditionalUI( somevariable, shinyWidgets::panel(somevariable, heading="ConditionalPanel") ), shiny::h1("constitutive title"), shiny::p("constitutive paragraph") )
# In UI: somevariable=TRUE shinyWidgets::panel( heading="constitutivepanel", CRUX:::conditionalUI( somevariable, shinyWidgets::panel(somevariable, heading="ConditionalPanel") ), shiny::h1("constitutive title"), shiny::p("constitutive paragraph") )
#' Install dependencies #' #' @export #' install_dependencies <- function() BiocManager::install("PoisonAlien/TCGAmutations") #BiocManager::install("maftools")
create_mac_binary()
create_mac_binary()
Downloads a MAF file (inc. silent mutations). Does NOT download clinical datafile.
download_maf(maf, file)
download_maf(maf, file)
maf |
a loaded maf object |
file |
the path to save maf to |
NOTHING. Run for its side effects
## Not run: CRUX:::download_maf(maftools::tcgaLoad("GBM"), "tcga_gbm.maf")
## Not run: CRUX:::download_maf(maftools::tcgaLoad("GBM"), "tcga_gbm.maf")
Appends tool metadata on the end of a dataframe
external_tools_add_tool_to_dataframe( external_tools_df = dplyr::tibble(), tool_name, tool_id, tool_group, tool_class, tool_description, instructions = "No instructions available yet. You're on your own buddy", platform = "Web App", website, doi, requires_maf_export = TRUE, requires_gene_selection = FALSE, maf_conversion_function = NA, extension = "tsv" )
external_tools_add_tool_to_dataframe( external_tools_df = dplyr::tibble(), tool_name, tool_id, tool_group, tool_class, tool_description, instructions = "No instructions available yet. You're on your own buddy", platform = "Web App", website, doi, requires_maf_export = TRUE, requires_gene_selection = FALSE, maf_conversion_function = NA, extension = "tsv" )
external_tools_df |
the dataframe to add tool metadata to. By default, will create and return a new dataframe |
tool_name |
name of tool (string) |
tool_id |
id of tool (string) |
tool_group |
research group that built/maintains the tool (string) |
tool_class |
class of tool. Usually 'Positive Selection', 'Variant Interpretation' (string) |
tool_description |
brief description of tool (string) |
instructions |
brief description of how to use the tool. Any HTML tags in the string will be correctly resolved. (string) |
platform |
what platform do we access the tool from. Examples include web, desktop app, cli (string) |
website |
url of tool (string) |
doi |
publicatoin doi (string) |
requires_maf_export |
does the tool require a maf to be exported in some other form (flag) |
requires_gene_selection |
does user need to select a specific gene for export to work? (bool) |
maf_conversion_function |
only relevent if requires_maf_export == true. A function that takes a maf_dataset_wrapper object (first argument), a filepath (second argument) and, if requires_gene_selection == TRUE, a gene name (third argument) writes a file to that filepath. The idea is that said file can then be used as input to the specified tool. |
extension |
what type of file is written by maf_conversion_function. default is 'tsv'. Used to appropriately name exported file (string) |
dataframe containing external_tool_metadata
Convets MAF object to BBGLab Cancer Genome Interpreter Input (Genomic tabular format) then writes to a file. Works as a maf_conversion_function. Please don't change arguments
external_tools_convert_maf_to_bbglab(maf_dataset_wrapper, filepath)
external_tools_convert_maf_to_bbglab(maf_dataset_wrapper, filepath)
maf_dataset_wrapper |
object to add to the data pool (maf_dataset_wrapper) |
filepath |
(string) |
Run for side effects (writes bbglab datamframe to file)
Convets MAF object to BBGLab Cancer Genome Interpreter Input (Genomic tabular format) (a tsv).
external_tools_convert_maf_to_bbglab_return_dataframe(maf)
external_tools_convert_maf_to_bbglab_return_dataframe(maf)
maf |
(MAF) |
bbglab compatible dataframe
Takes a MAF and converts variants hitting a particular gene to the form the cBioPortal Mutation Mapper uses as input.
external_tools_convert_maf_to_cbioportal_mutation_mapper_return_dataframe( maf, gene_hugo_symbol )
external_tools_convert_maf_to_cbioportal_mutation_mapper_return_dataframe( maf, gene_hugo_symbol )
maf |
a maftools maf object (maf) |
gene_hugo_symbol |
hugo symbol representing the gene to export (string) |
You can find the tool at: https://www.cbioportal.org/mutation_mapper
dataframe in a form usable as input at https://www.cbioportal.org/mutation_mapper (data.frame)
Convets MAF object to BBGLab Oncodrive mutation format.
external_tools_convert_maf_to_oncodrive_return_dataframe(maf)
external_tools_convert_maf_to_oncodrive_return_dataframe(maf)
maf |
(MAF) |
data.frame of appropriate format to supply to oncodrive
Convert a maf to a vanilla vcf (single sample)
external_tools_convert_maf_to_vanilla_vcf_return_dataframe(maf_df)
external_tools_convert_maf_to_vanilla_vcf_return_dataframe(maf_df)
maf_df |
either a maf object or a dataframe created using maftools_get_all_data |
data.frame with VCF columns
external_tools_get_property_by_tool_name
external_tools_get_property_by_tool_name( tool_name, property_to_retrieve, external_tools_df = external_tool_metadata )
external_tools_get_property_by_tool_name( tool_name, property_to_retrieve, external_tools_df = external_tool_metadata )
tool_name |
name of tool |
property_to_retrieve |
which property to retrieve. see details for options. (string) |
external_tools_df |
the dataframe to add tool metadata to. By default, will use global variable: GLOBAL_external_tools_dataframe |
Options for property_to_retrieve
tool_name
tool_id
tool_group
tool_class
tool_description
instructions
website
doi
requires_maf_export
requires_gene_selection
maf_conversion_function
extension
See ?external_tools_add_tool_to_dataframe
for more info on these properties
run external_tool_metadata
to see the built in tool metadata dataframe
value of retrieved property (string)
CRUX:::external_tools_get_property_by_tool_name(tool_name = "OncodriveFML", "website")
CRUX:::external_tools_get_property_by_tool_name(tool_name = "OncodriveFML", "website")
Loads metadata for all tools, returning a dataframe.
If any of the constitutent functions are changed, run external_tools_update_builtin_dataset
external_tools_load_all_tools()
external_tools_load_all_tools()
external_tools_df with metadata of tool appeneded (data.frame). see ?external_tools_add_tool_to_dataframe
for more info on the columnss in this data.frame
CRUX:::external_tools_load_all_tools()
CRUX:::external_tools_load_all_tools()
Appends metadata for the "Cancer Genome Interpreter (cgi) tool onto external_tools_df
external_tools_load_bbglab_cgi(external_tools_df = data.frame())
external_tools_load_bbglab_cgi(external_tools_df = data.frame())
external_tools_df |
the dataframe to add tool metadata to. By default, will create and return a new dataframe |
external_tools_df with metadata of tool appeneded (data.frame)
CRUX:::external_tools_load_bbglab_cgi()
CRUX:::external_tools_load_bbglab_cgi()
Appends metadata for the OncodriveCLUSTL tool onto external_tools_df
external_tools_load_bbglab_oncodrive_clustl(external_tools_df = data.frame())
external_tools_load_bbglab_oncodrive_clustl(external_tools_df = data.frame())
external_tools_df |
the dataframe to add tool metadata to. By default, will create and return a new dataframe |
external_tools_df with metadata of tool appeneded (data.frame)
CRUX:::external_tools_load_bbglab_cgi()
CRUX:::external_tools_load_bbglab_cgi()
Loads metadata for the OncodriveFML tool into a global variable GLOBAL_external_tools_dataframe
external_tools_load_bbglab_oncodrive_fml(external_tools_df = data.frame())
external_tools_load_bbglab_oncodrive_fml(external_tools_df = data.frame())
external_tools_df |
the dataframe to add tool metadata to. By default, will create and return a new dataframe |
external_tools_df with metadata of tool appeneded (data.frame)
CRUX:::external_tools_load_bbglab_cgi()
CRUX:::external_tools_load_bbglab_cgi()
Appends metadata for the OncodriveCLUSTL tool onto external_tools_df
external_tools_load_proteinpaint(external_tools_df = data.frame())
external_tools_load_proteinpaint(external_tools_df = data.frame())
external_tools_df |
the dataframe to add tool metadata to. By default, will create and return a new dataframe |
external_tools_df with metadata of tool appeneded (data.frame)
Takes the output of external_tools_load_all_tools and saves it to CRUX/data as the dataset: external_tool_metadata. This saved dataset is what is used by the app. If you make change to any external_tools_load_... function, you must rerun this function.
external_tools_update_builtin_dataset()
external_tools_update_builtin_dataset()
Get Width/Height of a rendered element
get_rendered_plot_height(output_id, session, return_inches = F, dpi = 70)
get_rendered_plot_height(output_id, session, return_inches = F, dpi = 70)
output_id |
"ID of the plot/element who's width/height you want to know" |
session |
"Current Session. Used to get namespacing and clientData information" |
return_inches |
"Should we return width/height in pixels or inches" |
dpi |
"dpi used to convert pixels to inches" |
"Width/Height in pixels/inches"
Get Width/Height of a rendered element
get_rendered_plot_width(output_id, session, return_inches = F, dpi = 70)
get_rendered_plot_width(output_id, session, return_inches = F, dpi = 70)
output_id |
"ID of the plot/element who's width/height you want to know" |
session |
"Current Session. Used to get namespacing and clientData information" |
return_inches |
"Should we return width/height in pixels or inches" |
dpi |
"dpi used to convert pixels to inches" |
"Width/Height in pixels/inches"
Get TCGA MAFs
get_tcga_mafs(study_name)
get_tcga_mafs(study_name)
study_name |
Abbreviation of TCGA dataset to install. To see options, run maftools::tcgaAvailable() |
A single MAF object.
Parses a gistic path_to_amp_or_del_genes_file
gistic_tabulate_amp_or_del_genes_file(path_to_amp_or_del_genes_file)
gistic_tabulate_amp_or_del_genes_file(path_to_amp_or_del_genes_file)
path_to_amp_or_del_genes_file |
path to either del_genes.conf_XX.txt OR amp_genes.conf_90.txt. These files can be produced using gistic (string) |
a dataframe containing cytobands, q values, peak locations and which genes are in each peak
Reads the first line of a file and attempt to determine the filetype based on the header
guess_genomic_mutation_filetype(path)
guess_genomic_mutation_filetype(path)
path |
path to file |
one of MAF, ANNOVAR, VCF, OTHER
HTML_alert
html_alert(text, status = "warning")
html_alert(text, status = "warning")
text |
Alert text (string) |
status |
Boostrap status. One of primary,secondary,success,danger,warning,info,light,dark (string) |
html-flagged text (string")
icon_down_arrow
icon_down_arrow(fontsize = "40px", alignment = "center", break_after = FALSE)
icon_down_arrow(fontsize = "40px", alignment = "center", break_after = FALSE)
fontsize |
a valid css fontsize, e.g. 60px (string) |
alignment |
One of 'left', 'right', 'center' or 'inherit'(string) |
break_after |
insert a linebreak after icon (flag) |
centered down arrow fluidrow()
Runs read.maf with a given clinicalData and maf object pair and returns TRUE ONLY if the clinicalData file is appropriate for the given MAF. If maf object is not valid, this function will also return FALSE. By using clinicalData=NULL the function allows testing validity of a MAF file in Isolation.
is_valid_clinicalfeaturefile(clinicalData, maf)
is_valid_clinicalfeaturefile(clinicalData, maf)
clinicalData |
Clinical data associated with each sample/Tumor_Sample_Barcode in MAF. Could be a text file or a data.frame. Default NULL. |
maf |
tab delimited MAF file. File can also be gz compressed. Required. Alternatively, you can also provide already read MAF file as a dataframe. |
If clinical feature file has duplicated Tumor_Sample_Barcodes, only the first entry is considered and the file is still 'valid'.
True / False (boolean)
Runs read.maf with a given clinicalData and maf object pair and returns the relevant error messages If maf object is not valid, this function will also return the appropriate error message. By using clinicalData=NULL the function allows testing validity of a MAF file in isolation
is_valid_clinicalfeaturefile_return_error(clinicalData, maf)
is_valid_clinicalfeaturefile_return_error(clinicalData, maf)
clinicalData |
Clinical data associated with each sample/Tumor_Sample_Barcode in MAF. Could be a text file or a data.frame. Default NULL. |
maf |
tab delimited MAF file. File can also be gz compressed. Required. Alternatively, you can also provide already read MAF file as a dataframe. |
If clinical feature file has duplicated Tumor_Sample_Barcodes, only the first entry is considered and the file is still 'valid'.
Metadata and MAF are valid if they are. The relevant string if they are not (character)
Link
link(url, newtab = TRUE, text)
link(url, newtab = TRUE, text)
url |
URL |
newtab |
shoule the link be opened in a new tab? (flag) |
text |
display text for link |
list() with a shiny.tag class. Can convert to HTML string via as.character()
Add a maf_dataset_wrapper object to the maf_data_pool
maf_data_pool_add_dataset(maf_dataset_wrapper, maf_data_pool)
maf_data_pool_add_dataset(maf_dataset_wrapper, maf_data_pool)
maf_dataset_wrapper |
object to add to the data pool (maf_dataset_wrapper) |
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
a new maf_data_pool object with the additional objects appended (maf_data_pool)
Add RNA data to a dataset_wrapper within a maf_data_pool.
maf_data_pool_add_rnaseq(maf_data_pool, unique_name, rnaseq_path)
maf_data_pool_add_rnaseq(maf_data_pool, unique_name, rnaseq_path)
maf_data_pool |
see ?new_maf_data_pool for details (maf_data_pool) |
unique_name |
Unique name of the maf_data_wrapper. see ?new_maf_data_wrapper for details (string) |
rnaseq_path |
Path to rnaseq file (string) |
How this works: We read in the file at rnaseq_path as data frame, check if it looks like we expect. If so, the filepath is saved to the maf_dataset_wrapper (NOT THE DATAFRAME!). This is so we don't have to keep the RNA data in memory. When we go to export or visualise, we'll just reload it using maf_data_wrapper_get_rnaseq_df, which returns a dataframe (or NULL if none is found).
Also note that no cohort subsetting will affect this RNA file, as all we have is the filepath. This is not a problem, since the functions that export / visualise the data simply load it into memory, then check the clinical datafile to see which samples we need to export. If they've been subset out of the clinical datafile, the user probably wont want to export RNA data from these samples ... my export function are aware of this.
Also note, that this file wont be subset
maf_data_pool with updated maf_data_pool_add_rnaseq
Gets the names of all maf_dataframe_wrapper properties that don't hold functions. This information is useful when converting to a data.frame which can't hold functions
maf_data_pool_get_all_nonfunction_property_names(maf_data_pool)
maf_data_pool_get_all_nonfunction_property_names(maf_data_pool)
maf_data_pool |
data pool of interest (maf_data_pool) |
This function works by only looking at the first element in the list, which means if one day we change the constructor such that not all wrappers have the same set of properties, we may see unexpected behaviour. Since it is extremely unlikely this will change, I won't make this more robust for now. If I am wrong ... sorry future me :(
a vector of list_within_list 'properties' that are not functions (character)
Will throw error if unique_name is not found
maf_data_pool_get_data_wrapper_from_unique_name(maf_data_pool, unique_name)
maf_data_pool_get_data_wrapper_from_unique_name(maf_data_pool, unique_name)
maf_data_pool |
The data pool of interest (maf_data_pool) |
unique_name |
unique_name of the maf_dataset_wrapper fetch (string). |
specified maf_dataset_wrapper
Will throw error if unique_name is not found
maf_data_pool_get_index_from_unique_name(maf_data_pool, unique_name)
maf_data_pool_get_index_from_unique_name(maf_data_pool, unique_name)
maf_data_pool |
The data pool of interest (maf_data_pool) |
unique_name |
unique_name of the maf_dataset_wrapper you're interested in(string). |
index of the specified maf_dataset_wrapper within the maf_data_pool
Extract 'unique_name' from each maf_dataset_wrapper within a maf_data_pool. NOTE: 'unique_name' is a property of maf_dataset_wrapper, however since these wrappers are created independently from each other (no check for uniqueness at the time of creation) they may not actually be unique. Please check this using maf_data_pool_validate_unique_names
maf_data_pool_get_unique_names(maf_data_pool)
maf_data_pool_get_unique_names(maf_data_pool)
maf_data_pool |
A data pool to mine unique_names from (maf_data_pool) |
a vector listing the 'unique_name' of each maf_dataset_wrapper in the data pool (character)
use maf_data_pool_robust_load instead. It wraps this function Will throw error if unique_name is not found or status is anything other than 'not_loaded'.
maf_data_pool_load_data(maf_data_pool, unique_name)
maf_data_pool_load_data(maf_data_pool, unique_name)
maf_data_pool |
The data pool of interest (maf_data_pool) |
unique_name |
unique_name of the maf_dataset_wrapper you want to load (string). |
maf_data_pool object with the wrapped dataset now loaded (maf_data_pool)
Checks if a name is unique in a given data pool.
If not, the function will append 15 letters randomly to the name until it finds a unique name, or surpasses max_number_of_attempts
.
Will throw an error if it can't find a unique name
maf_data_pool_make_name_unique( maf_data_pool, name, max_number_of_attempts = 50 )
maf_data_pool_make_name_unique( maf_data_pool, name, max_number_of_attempts = 50 )
maf_data_pool |
The data pool of interest (maf_data_pool) |
name |
name to make unique (string) |
max_number_of_attempts |
max number of attempts (whole number) |
a unique name (string)
This function allows user to pass a maf data pool and a unique name of the dataset of interest. It differs from maf_data_pool_load_data in that maf_data_pool_load_data will throw an error if the status of the loaded object is anything other than "not_loaded". This function will take any valid status and try to get the data loaded. It decides if the data actually needs loading, and if so, loads it.
It is designed to run before you run maf_data_pool_unique_name_to_maf / maf_data_pool_get_data_wrapper_from_unique_name.
maf_data_pool_robust_load(maf_data_pool, unique_name)
maf_data_pool_robust_load(maf_data_pool, unique_name)
maf_data_pool |
The data pool of interest (maf_data_pool) |
unique_name |
unique_name of the maf_dataset_wrapper you want to load (string). |
maf_data_pool with the specified datawrapper loaded (maf_data_pool)
Converts a data pool to a data.frame form.
maf_data_pool_to_dataframe(maf_data_pool)
maf_data_pool_to_dataframe(maf_data_pool)
maf_data_pool |
the data pool to convert to a dataframe (maf_data_pool) |
a data.frame containing all properties of maf_data_pool except for those containing functions (data.frame)
Checks if a particular 'unique_name' is already being used by an object in the some data pool.
maf_data_pool_unique_name_is_available(maf_data_pool, unique_name)
maf_data_pool_unique_name_is_available(maf_data_pool, unique_name)
maf_data_pool |
The data pool of interest (maf_data_pool) |
unique_name |
some string you want to check is not currently used as the 'unique_name' of any object in the datapool (string). |
TRUE/FALSE depending on whether the unique_name is available (logical)
Takes a unique name and returns the maf object associated with said entry in the maf_data_pool. Involves loading the dataset but does NOT actually update the maf_data_pool.
maf_data_pool_unique_name_to_maf_nonreactive(maf_data_pool, unique_name)
maf_data_pool_unique_name_to_maf_nonreactive(maf_data_pool, unique_name)
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
unique_name |
unique name (string) |
return loaded data (maf object, nonreactive)
Loads the relevant MAF if possible, appplies changes to maf_data_pool reactive then returns the loaded maf
maf_data_pool_unique_name_to_maf_reactive(maf_data_pool, unique_name)
maf_data_pool_unique_name_to_maf_reactive(maf_data_pool, unique_name)
maf_data_pool |
the reactiveVal we want will search for our dataset of interest, and is also the object we apply any changes to. (reactiveVal) |
unique_name |
unique_name of the maf_dataset_wrapper fetch (string). |
maf object (maf)
Will throw error if unique_name is not found
maf_data_pool_unload_data(maf_data_pool, unique_name)
maf_data_pool_unload_data(maf_data_pool, unique_name)
maf_data_pool |
The data pool of interest (maf_data_pool) |
unique_name |
unique_name of the maf_dataset_wrapper you want to unload (string). |
maf_data_pool object with the wrapped dataset now unloaded (maf_data_pool)
Uses the functions in maf_dataset_wrapper to load data into the loaded_data element and update status.
maf_data_set_wrapper_load_data(maf_dataset_wrapper)
maf_data_set_wrapper_load_data(maf_dataset_wrapper)
maf_dataset_wrapper |
the wrapper of the dataset you want to load into memory (maf_dataset_wrapper) |
It is only the maf object that is loaded. RNA data stays sitting in a file until it is retrieved via maf_dataset_wrapper_get_rnaseq
a copy of the original wrapper with status and loaded data updated. (maf_dataset_wrapper)
Other data_set_wrapper_loading:
maf_data_set_wrapper_unload_data()
#Generate wrapper my_data <- CRUX:::tcga_dataset_to_maf_dataset_wrapper( maf_data_pool = CRUX:::new_maf_data_pool(), tcga_study_abbreviation = "ACC" ) #Load data my_data <- CRUX:::maf_data_set_wrapper_load_data(my_data) #Access loaded data print(my_data$loaded_data) #Unload when finished my_data <- CRUX:::maf_data_set_wrapper_unload_data(my_data)
#Generate wrapper my_data <- CRUX:::tcga_dataset_to_maf_dataset_wrapper( maf_data_pool = CRUX:::new_maf_data_pool(), tcga_study_abbreviation = "ACC" ) #Load data my_data <- CRUX:::maf_data_set_wrapper_load_data(my_data) #Access loaded data print(my_data$loaded_data) #Unload when finished my_data <- CRUX:::maf_data_set_wrapper_unload_data(my_data)
Uses the functions in maf_dataset_wrapper to load data into the loaded_data element and update status.
maf_data_set_wrapper_unload_data(maf_dataset_wrapper)
maf_data_set_wrapper_unload_data(maf_dataset_wrapper)
maf_dataset_wrapper |
the wrapper of the dataset you want to unload into memory (maf_dataset_wrapper) |
a copy of the original wrapper with status and loaded data elements updated. Status is changed from "ready" => "not_loaded". loaded_data is changed from maf_object to NA. (maf_dataset_wrapper)
Other data_set_wrapper_loading:
maf_data_set_wrapper_load_data()
#Generate wrapper my_data <- CRUX:::tcga_dataset_to_maf_dataset_wrapper( maf_data_pool = CRUX:::new_maf_data_pool(), tcga_study_abbreviation = "ACC" ) #Load data my_data <- CRUX:::maf_data_set_wrapper_load_data(my_data) #Access loaded data print(my_data$loaded_data) #Unload when finished my_data <- CRUX:::maf_data_set_wrapper_unload_data(my_data)
#Generate wrapper my_data <- CRUX:::tcga_dataset_to_maf_dataset_wrapper( maf_data_pool = CRUX:::new_maf_data_pool(), tcga_study_abbreviation = "ACC" ) #Load data my_data <- CRUX:::maf_data_set_wrapper_load_data(my_data) #Access loaded data print(my_data$loaded_data) #Unload when finished my_data <- CRUX:::maf_data_set_wrapper_unload_data(my_data)
Add rnaseq data to maf_dataset_wrapper object
maf_data_wrapper_add_rnaseq(maf_dataset_wrapper, rnaseq_path)
maf_data_wrapper_add_rnaseq(maf_dataset_wrapper, rnaseq_path)
maf_dataset_wrapper |
any maf object (maf_dataset_wrapper) |
rnaseq_path |
path to rnaseq dataset (string) |
the input maf_dataset_wrapper with rnaseq_path in rnaseq_filepath slot
Similar tomaf_data_wrapper_get_rnaseq_df but only returns expression data for samples that have corresponding mutation data
maf_data_wrapper_get_rnaseq_data_for_samples_with_mutation_data( maf_dataset_wrapper )
maf_data_wrapper_get_rnaseq_data_for_samples_with_mutation_data( maf_dataset_wrapper )
maf_dataset_wrapper |
a maf_dataset wrapper. See ?new_maf_dataset_wrapper for details. |
RNAseq data if present or NULL if no RNA data has been associated with it yet. Will only return expression data for samples that have corresponding mutation data (dataframe)
# Prepare Data ## Not run: rna_path = system.file("example_data/blca_rnaseq.tsv", package = "CRUX") maf_data_wrapper = CRUX:::tcga_dataset_to_maf_dataset_wrapper(CRUX:::new_maf_data_pool(), "BLCA") # Add RNA data maf_data_wrapper_with_RNA = CRUX:::maf_data_wrapper_add_rnaseq( maf_data_wrapper, rnaseq_path = rna_path ) # Retrieve RNA data for samples with mutation data CRUX:::maf_data_wrapper_get_rnaseq_data_for_samples_with_mutation_data(maf_data_wrapper_with_RNA) ## End(Not run)
# Prepare Data ## Not run: rna_path = system.file("example_data/blca_rnaseq.tsv", package = "CRUX") maf_data_wrapper = CRUX:::tcga_dataset_to_maf_dataset_wrapper(CRUX:::new_maf_data_pool(), "BLCA") # Add RNA data maf_data_wrapper_with_RNA = CRUX:::maf_data_wrapper_add_rnaseq( maf_data_wrapper, rnaseq_path = rna_path ) # Retrieve RNA data for samples with mutation data CRUX:::maf_data_wrapper_get_rnaseq_data_for_samples_with_mutation_data(maf_data_wrapper_with_RNA) ## End(Not run)
You probaly want maf_data_wrapper_get_rnaseq_data_for_samples_with_mutation_data instead.
maf_data_wrapper_get_rnaseq_df(maf_dataset_wrapper)
maf_data_wrapper_get_rnaseq_df(maf_dataset_wrapper)
maf_dataset_wrapper |
a maf_dataset wrapper. See ?new_maf_dataset_wrapper for details. |
This function takes a maf_dataset_wrapper and retrieves ALL rnaseq data present (inc. for samples that would have been filtered out by subsetting operations).
RNAseq data if present or NULL if no RNA data has been associated with it yet (dataframe)
Maf Dataset has RNAseq data
maf_data_wrapper_has_rnaseq_data(maf_dataset_wrapper)
maf_data_wrapper_has_rnaseq_data(maf_dataset_wrapper)
maf_dataset_wrapper |
a maf dataset wrapper. See ?new_maf_dataset_wrapper |
TRUE if RNAseq data is present, False if not (Boolean)
Checks if maf is BRCA and contains cols required to classify as Triple Negative / Not Triple Negative. If so, adds a 'subtype' column describing whether its triple negative or not triple negative
maftools_add_brca_subtype(maf)
maftools_add_brca_subtype(maf)
maf |
maftools maf object |
maf object
Adds 'extra' clinical metadata to a maf object with existing metadata
maftools_add_clinical_data(maf, clindata_path)
maftools_add_clinical_data(maf, clindata_path)
maf |
an existing MAF object as produced by maftools::read.maf (MAF) |
clindata_path |
Eithera path to a csv/tsv that contains sample level metadata. Must include a |
maf object with
Takes a maf object and returns that same object but converts and chromosomes named 23 or 24 (or chr23 / chr24) to X and Y.
maftools_chrom_23_and_24_to_X_and_Y(maf)
maftools_chrom_23_and_24_to_X_and_Y(maf)
maf |
A MAF object (MAF) |
a MAF object with chr23/chr24 converted to "X" & "Y"
maftools_clinical_data_get_levels
maftools_clinical_data_get_levels(maf, clinical_feature)
maftools_clinical_data_get_levels(maf, clinical_feature)
maf |
MAF object (MAF) |
clinical_feature |
Name of a clinical feature (string) |
Number of distinct levels of a clinical feature
Plot Clinical Data Plot a particular column of clinical DATA.
maftools_clinical_data_visually_summarise( maf, clinical_feature = "Tumor_Sample_Barcode", threshold = NULL, selected_items = NULL, distance_from_bar = 2 )
maftools_clinical_data_visually_summarise( maf, clinical_feature = "Tumor_Sample_Barcode", threshold = NULL, selected_items = NULL, distance_from_bar = 2 )
maf |
MAF object (MAF) |
clinical_feature |
Name of a clinical feature (string) |
threshold |
threshold (number) |
selected_items |
selectd items |
distance_from_bar |
how far should text be from the bar (number) |
ggplot / grob
Get a data.frame describing each clinical feature of a MAF
maftools_clinical_feature_description( maf, checkmark = c("none", "oncoplottable") )
maftools_clinical_feature_description( maf, checkmark = c("none", "oncoplottable") )
maf |
a maftools maf object |
checkmark |
should a pass/fail checkmark icon be added before the annotations name. (none = no pass/fail checkmark; oncoplottable = whether feature can be added to an oncoplot) |
Rule for pass/fail checks: To be 'oncoplottable' there must be <= 100 non-missing levels OR the feature must be numeric
a data.frame with 3 columns. annotation (feature name); type (whether feature is numeric/categorical); levels (number of distinct, non-na values); content (html string with names + badges with additional information)
Identify and visualise clusters of cancer samples based on somatic mutation data (gene-level differences visualised, not variant-level)
Approach involves:
Selecting a geneset of interest (by default uses genes mutated in the most samples).
Calculating 1-jaccard distance between samples based on which genes of the genesets are mutated.
Running heirarchical clustering algorithm using pheatmap.
Visualise resulting heatmap with user-selected annotations.
maftools_cluster_samples( maf, custom_genelist_to_cluster_by = NULL, number_of_genes = 50, genes_to_annotate = NULL, annotate_most_altered_genes = TRUE, topn_genes = 5, metadata_columns = NULL, include_silent_mutations = FALSE, show_rownames = FALSE, show_colnames = FALSE, annotation_legend = TRUE, fontsize = 10 )
maftools_cluster_samples( maf, custom_genelist_to_cluster_by = NULL, number_of_genes = 50, genes_to_annotate = NULL, annotate_most_altered_genes = TRUE, topn_genes = 5, metadata_columns = NULL, include_silent_mutations = FALSE, show_rownames = FALSE, show_colnames = FALSE, annotation_legend = TRUE, fontsize = 10 )
maf |
maf object from maftools package (maf) |
custom_genelist_to_cluster_by |
names of genes to base clustering on. If unsure what genes to use. By default, the top 50 genes ranked by how manys samples they are mutated in will be used (character vector) |
number_of_genes |
number of genes to cluster based on. Chooses genes which are mutated in the most samples (only matters if not supplying custom_genelist_to_cluster_by) (integer) |
genes_to_annotate |
a custom list of genes to plot as a pseudo oncoplot (string) |
annotate_most_altered_genes |
automatically annotate with mutational status of genes mutated in the most samples (this is always based on coding/splice site mutation) (bool) |
topn_genes |
if annotate_most_altered_genes is true, how many genes to automatically visualise (integer) |
metadata_columns |
name of metadata columns to annotate heatmap based on (character) |
include_silent_mutations |
consider a gene mutated even if the only mutations present are silent (bool) |
show_rownames |
show sample names on rows (bool) |
show_colnames |
show sample names on columns (bool) |
annotation_legend |
show annotation legend (flag) |
fontsize |
font size (number) |
pheatmap object
maf <- maftools::tcgaLoad("GBM", source = "Firehose") maftools_cluster_samples(maf)
maf <- maftools::tcgaLoad("GBM", source = "Firehose") maftools_cluster_samples(maf)
Create a genelist containing the genes mutated in the most samples in a maf. If topn > total number of mutated genes then all mutated genes are returned.
maftools_extract_geneset_by_altered_samples(maf, topn = 100)
maftools_extract_geneset_by_altered_samples(maf, topn = 100)
maf |
tab delimited MAF file. File can also be gz compressed. Required. Alternatively, you can also provide already read MAF file as a dataframe. |
topn |
How many genes to include in the gene-set. |
The names of genes mutated in the most samples (character vector).
CRUX:::maftools_extract_geneset_by_altered_samples(maftools::tcgaLoad("GBM"), topn=50)
CRUX:::maftools_extract_geneset_by_altered_samples(maftools::tcgaLoad("GBM"), topn=50)
Returns a MAF with correctly typed clinical data. By default, many maftools operations (e.g. subsetting) results in a loss of clinical data type (everything gets cast as characters). This function can be run on any MAF to resolve this issue.
maftools_fix_clinical_data_types(maf)
maftools_fix_clinical_data_types(maf)
maf |
a maf object (MAF) |
MAF object with correctly typed clinical.data dataframe (MAF)
maf = maftools::tcgaLoad(study = "GBM", source = "Firehose") str(maftools::getClinicalData(maf)) new_maf = CRUX:::maftools_fix_clinical_data_types(maf) str(maftools::getClinicalData(new_maf))
maf = maftools::tcgaLoad(study = "GBM", source = "Firehose") str(maftools::getClinicalData(maf)) new_maf = CRUX:::maftools_fix_clinical_data_types(maf) str(maftools::getClinicalData(new_maf))
Input a maf object. Returns table containing ALL MAF data. Nonsynonymous AND synonymous
maftools_get_all_data(maf, include_silent_mutations = T)
maftools_get_all_data(maf, include_silent_mutations = T)
maf |
maf object |
include_silent_mutations |
include silent mutations (flag) |
a data.frame in MAF form where each variant has a separate row (data.frame)
CRUX:::maftools_get_all_data(maftools::tcgaLoad("GBM"))
CRUX:::maftools_get_all_data(maftools::tcgaLoad("GBM"))
Returns the transcript id from the 'Transcript_ID' column of a maf_df. If no Transcript_ID column is found, will return the longest refseq transcript for each gene name.
maftools_get_transcript_refseq(maf_df)
maftools_get_transcript_refseq(maf_df)
maf_df |
(HGNC ID of gene) |
vector of the same length as maf_df containing transcript refseq ids (character)
Number of samples in a MAF
maftools_number_of_samples(maf)
maftools_number_of_samples(maf)
maf |
@inherit maftools::read.maf |
int
CRUX:::maftools_number_of_samples(maftools::tcgaLoad("GBM"))
CRUX:::maftools_number_of_samples(maftools::tcgaLoad("GBM"))
Wraps maftools::rainfallPlot. The original function plots a rainfall graph, prints the predicted kataegis coords as a df, and writes it to a file. This function does all of this EXCEPT it hides the printed df, reads the df from the file and returns it. It also deletes the created file.
maftools_plot_rainfall( maf, tsb, detectChangePoints = TRUE, ref.build = "hg19", pointSize = 0.4, fontSize = 1.2 )
maftools_plot_rainfall( maf, tsb, detectChangePoints = TRUE, ref.build = "hg19", pointSize = 0.4, fontSize = 1.2 )
maf |
|
tsb |
specify sample names (Tumor_Sample_Barcodes) (string) |
detectChangePoints |
If TRUE, detectes genomic change points where potential kataegis are formed. Results are written to an output tab delimted file. |
ref.build |
Reference build for chromosome sizes. Can be hg18, hg19 or hg38. Default hg19. |
pointSize |
Default 0.8. |
fontSize |
Default 12. |
predicted kataegis sites (dataframe)
Filter out genes likely to appear in many analyses from your MAF (e.g. TTN & Olfactory receptors )
maftools_remove_dubious_genes(maf, genelist = somaticflags::somaticflags)
maftools_remove_dubious_genes(maf, genelist = somaticflags::somaticflags)
maf |
a MAF object |
genelist |
a character vector containing HUGO Symbols to remove from MAF |
MAF object
CRUX:::maftools_remove_dubious_genes(maftools::tcgaLoad("gbm"), "TTN")
CRUX:::maftools_remove_dubious_genes(maftools::tcgaLoad("gbm"), "TTN")
mod_data_import_step1 Server Functions
mod_data_import_maf_path_to_maf_server(id, maf_path, clinicalData)
mod_data_import_maf_path_to_maf_server(id, maf_path, clinicalData)
id |
Internal parameters for shiny. |
maf_path |
Path to maf file (string) (reactive) |
clinicalData |
Clinical data associated with each sample/Tumor_Sample_Barcode in MAF. Could be a text file or a data.frame. Default NULL. |
maf object if read was successful. NULL if it was not (MAF) (reactive)
GUI for taking a filepath returning a maf object. Includes a panel containing the MAF file summary or an error message if the supplied path does not point to a valid maf.
mod_data_import_maf_path_to_maf_ui(id)
mod_data_import_maf_path_to_maf_ui(id)
id |
Internal parameters for shiny. |
Returns a list of user-filled metadata. Do NOT evaluate any of the properties before checking all_valid == TRUE (list) (reactive).
mod_data_import_step2_server( id, default_data_source = reactive(NULL), default_display_name = reactive(NULL), default_short_name = reactive(NULL), default_description = reactive(NULL) )
mod_data_import_step2_server( id, default_data_source = reactive(NULL), default_display_name = reactive(NULL), default_short_name = reactive(NULL), default_description = reactive(NULL) )
id |
Internal parameters for shiny. |
default_data_source |
default data source value |
default_display_name |
default display name value |
default_short_name |
default short name value |
default_description |
default description value |
The list itself is reactive, so to access elements do:
metadata <- mod_data_import_step2_server(id="my_id") # In a reactive context: observe({ metadata()$all_valid metadata()$display_name metadata()$short_name metadata()$data_source metadata()$description })
named list with elements:
all_valid (bool)
display_name (string)
short_name (string)
data_source (string)
description (string)
external_tools Server Functions
mod_external_tools_server(id, maf_data_pool)
mod_external_tools_server(id, maf_data_pool)
id |
Internal parameters for shiny. |
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
Imports a clinical feature file.
mod_import_clinical_featurefile_server(id, maf_path)
mod_import_clinical_featurefile_server(id, maf_path)
id |
Internal parameters for shiny. |
maf_path |
path to maf file (reactive string) |
the object with metadata from a clinical feature
A shiny Module.
mod_import_clinical_featurefile_ui(id)
mod_import_clinical_featurefile_ui(id)
id |
Internal parameters for shiny. |
plot_apobec_diff Server Functions
mod_plot_apobec_diff_server(id, maf, tnm)
mod_plot_apobec_diff_server(id, maf, tnm)
id |
Internal parameters for shiny. |
maf |
an |
tnm |
output generated by |
plotforest: Wraps around maftools::forestPlot to more explicitly handle pval VS fdr option and allow both to be passed while onl using the value set by bool 'threshold_on_fdr'
mod_plot_lollipop_ui(id)
mod_plot_lollipop_ui(id)
id |
Internal parameters for shiny. |
plotforest <- function( mafCompareRes, pVal = 0.05, fdr = 0.05, threshold_on_fdr, color=NULL, geneFontSize = 1.2, lineWidth = 2.2, titleSize = 1.2 ){ message("running") if (threshold_on_fdr) maftools::forestPlot( mafCompareRes = mafCompareRes, fdr = fdr, color = color, geneFontSize = geneFontSize, lineWidth = lineWidth, titleSize = titleSize ) else{ maftools::forestPlot( mafCompareRes = mafCompareRes, pVal = pVal,color = color, geneFontSize = geneFontSize, lineWidth = lineWidth, titleSize = titleSize ) } }
plotforest <- function( mafCompareRes, pVal = 0.05, fdr = 0.05, threshold_on_fdr, color=NULL, geneFontSize = 1.2, lineWidth = 2.2, titleSize = 1.2 ){ message("running") if (threshold_on_fdr) maftools::forestPlot( mafCompareRes = mafCompareRes, fdr = fdr, color = color, geneFontSize = geneFontSize, lineWidth = lineWidth, titleSize = titleSize ) else{ maftools::forestPlot( mafCompareRes = mafCompareRes, pVal = pVal,color = color, geneFontSize = geneFontSize, lineWidth = lineWidth, titleSize = titleSize ) } }
somatic_interactions Server Functions
mod_plot_somatic_interactions_server(id, maf)
mod_plot_somatic_interactions_server(id, maf)
id |
Internal parameters for shiny. |
maf |
a maf object (maf) |
plot_survival Server Functions
mod_plot_survival_server(id, maf, geneset, time, status, or, is_tcga)
mod_plot_survival_server(id, maf, geneset, time, status, or, is_tcga)
id |
Internal parameters for shiny. |
maf |
MAF object, usually produced by maftools::read_maf (reactive MAF object) |
geneset |
character vector where each element is the hugo_symbol of a gene. (reactive character vector) |
time |
name of column in clinical data describing time to event (reactive string) |
status |
name of column in clinical data describing event status (reactive string) |
or |
should samples be classified as mutant if ANY gene in geneset is mutated (default is ALL must be mutated) (reactive flag) |
is_tcga |
is sample from TCGA? (flag) |
Title
mod_render_clinical_data_table_server(id, maf)
mod_render_clinical_data_table_server(id, maf)
id |
Internal parameters for shiny. |
maf |
maf object (reactive) |
Nothing. Run for its side effects
A shiny Module. Renders clinica data attached to a maf object in the form of a datatable
mod_render_clinical_data_table_ui(id)
mod_render_clinical_data_table_ui(id)
id |
Internal parameters for shiny. |
Title
mod_render_downloadabledataframe_server( id, tabular_data_object, basename, rownames = FALSE, colnames = TRUE, filter = "top", message_if_tabular_data_is_null = "Please select valid mutalisk files" )
mod_render_downloadabledataframe_server( id, tabular_data_object, basename, rownames = FALSE, colnames = TRUE, filter = "top", message_if_tabular_data_is_null = "Please select valid mutalisk files" )
id |
shiny paramater |
tabular_data_object |
tabular data object (usually data.frame or data.table) |
basename |
name of downloaded file (flag) |
rownames |
download with rownames (flag) |
colnames |
download with colnames (flag) |
filter |
Position of filter search box: one of 'top', 'bottom' or 'none' (string) |
message_if_tabular_data_is_null |
message if tabular data is null (string) |
wraps mod_select_dataset_from_maf_data_pool_pickerinput_server. Instead of simply returning a unique_name, this function will:
mod_select_maf_dataset_wrapper_server(id, maf_data_pool, label = "Dataset")
mod_select_maf_dataset_wrapper_server(id, maf_data_pool, label = "Dataset")
id |
Internal parameters for shiny. |
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
label |
label (string)
|
maf_dataset_wrapper.
MAF object: | maf_dataset_wrapper()$loaded_data |
|
unique name: | maf_dataset_wrapper()$unique_name |
|
short name: | maf_dataset_wrapper()$short_name |
|
full name: | maf_dataset_wrapper()$display_name |
|
source: | maf_dataset_wrapper()$name_of_data_source |
|
See ?new_maf_dataset_wrapper for the full list of properties
shinyfile_import Server Functions
mod_shinyfile_import_server(id)
mod_shinyfile_import_server(id)
id |
Internal parameters for shiny. |
chosen filepath (string) (reactive). If multiple = TRUE, it returns a character vector instead of a string. When no file is selected, returns character(0)
Adds a shinyFilesButton
mod_shinyfile_import_ui( id, title, label, multiple = FALSE, tooltip_text = "", tooltip_placement = "right", trigger = "hover" )
mod_shinyfile_import_ui( id, title, label, multiple = FALSE, tooltip_text = "", tooltip_placement = "right", trigger = "hover" )
id |
Internal parameters for shiny. |
title |
The content of the tooltip. |
label |
Display label for the control, or |
multiple |
Whether the user should be allowed to select and upload multiple files at once. Does not work on older browsers, including Internet Explorer 9 and earlier. |
tooltip_text |
The content of the tooltip (string / HTML) |
tooltip_placement |
Where the tooltip should appear relative to its target (top, bottom, left, or right). Defaults to "right" |
trigger |
What action should cause the tooltip to appear? (hover, focus, click, or manual). Defaults to "hover". |
Server code for getting path to clinical feature file using shinyfiles button. No QC done here. Make sure file is valid when creating MAF object from maf + clinical feature file
mod_shinyfiles_get_clinical_featurefile_path_server(id)
mod_shinyfiles_get_clinical_featurefile_path_server(id)
id |
Internal parameters for shiny. |
chosen filepath (string) (reactive). If multiple = TRUE, it returns a character vector instead of a string. When no file is selected, returns character(0)
A shiny Module.
mod_shinyfiles_get_clinical_featurefile_path_ui(id)
mod_shinyfiles_get_clinical_featurefile_path_ui(id)
id |
Internal parameters for shiny. |
shinyfiles_get_maf_path Server Functions
mod_shinyfiles_get_maf_path_server(id)
mod_shinyfiles_get_maf_path_server(id)
id |
Internal parameters for shiny. |
chosen filepath (string) (reactive). If multiple = TRUE, it returns a character vector instead of a string. When no file is selected, returns character(0)
wrapper for running multiple mod_single_cohort_summary_tables_server modules
mod_single_cohort_summary_tables_and_plots_server(id, maf, cohortName)
mod_single_cohort_summary_tables_and_plots_server(id, maf, cohortName)
id |
Internal parameters for shiny. |
maf |
maf object (reactive) |
cohortName |
cohort Name (string, reactive) |
wrapper for running multiple mod_single_cohort_summary_tables_ui modules
mod_single_cohort_summary_tables_and_plots_ui(id)
mod_single_cohort_summary_tables_and_plots_ui(id)
id |
Internal parameters for shiny. |
Saves Plots as SVG.
moduleDownloadPlotServer( id, session_parent, plotOutputId, plotting_function, default_filename = "download" )
moduleDownloadPlotServer( id, session_parent, plotOutputId, plotting_function, default_filename = "download" )
id |
Module ID. Must be identical to moduleDownloadPlotUI |
session_parent |
Session object of the calling module (used to extract plot details) |
plotOutputId |
"ID of the rendered plot" |
plotting_function |
"function that when run with no arguments will create the plot. Can make by wrapping the plot call in its own function. e.g. for plot(mtcars) you could do: plotting_function <- reactive ( function() plot(mtcars) ) then pass 'plotting_function()'" |
default_filename |
default basename of downloaded file (string; non-reactive) |
Creates a shinyWidgets::downloadbttn
moduleDownloadPlotUI( id, circle = FALSE, label = "Download", style = "unite", color = "default", size = "default", status = "default", icon = NULL, tooltip_placement = "right", tooltip_text = "", right = FALSE, up = FALSE, width = "200px", margin = "10px", inline = FALSE, ... )
moduleDownloadPlotUI( id, circle = FALSE, label = "Download", style = "unite", color = "default", size = "default", status = "default", icon = NULL, tooltip_placement = "right", tooltip_text = "", right = FALSE, up = FALSE, width = "200px", margin = "10px", inline = FALSE, ... )
id |
Module ID |
circle |
Logical. Use a circle button |
label |
The label that should appear on the button. |
style |
Style of the button, to choose between simple, bordered, minimal, stretch, jelly, gradient, fill, material-circle, material-flat, pill, float, unite. |
color |
Color of the button : default, primary, warning, danger, success, royal. |
size |
Size of the button : xs,sm, md, lg. |
status |
Add a class to the buttons, you can use Bootstrap status like 'info', 'primary', 'danger', 'warning' or 'success'.
Or use an arbitrary strings to add a custom class, e.g. : with |
icon |
An icon to appear on the button. |
tooltip_placement |
Where the tooltip should appear relative to its target (top, bottom, left, or right). Defaults to "right" (string) |
tooltip_text |
Tooltip text (string) |
right |
Logical. The dropdown menu starts on the right. |
up |
Logical. Display the dropdown menu above. |
width |
Width of the dropdown menu content. |
margin |
Value of the dropdown margin-right and margin-left menu content. |
inline |
use an inline ( |
... |
List of tag to be displayed into the dropdown menu. |
Nothing. Function run for its side effects
Read MAF server function
moduleReadMafServer(id)
moduleReadMafServer(id)
id |
Internal parameters for shiny. |
named list containing 'maf' (type maf), 'cohortName' (type string), 'clinicalData' (type df), 'clinicalDataSupplied' (bool),
Read MAF UI function
moduleReadMafUI( id, panel_name, cohort_name, label_cohort_name = "name", label_maf = "maf", label_clinical_data = "clinical features" )
moduleReadMafUI( id, panel_name, cohort_name, label_cohort_name = "name", label_maf = "maf", label_clinical_data = "clinical features" )
id |
links ui and server components of module |
panel_name |
"panel name (required)" |
cohort_name |
"panel name (required)" |
label_cohort_name |
"name of the cohort (required)" |
label_maf |
label of maf input field ["maf"] |
label_clinical_data |
label of clinicalData input field ["clinical data"] |
moduleSubsetByClinicalFeaturesServer
moduleSubsetByClinicalFeaturesServer(id, maf, clinicalData)
moduleSubsetByClinicalFeaturesServer(id, maf, clinicalData)
id |
Internal parameters for shiny. |
maf |
reactive maf object |
clinicalData |
clinical data object (reactive) |
named list: 'maf1' (type maf), 'maf2' (type string),
The maf_data_pool class is simply a list of maf_dataset_wrapper objects.
new_maf_data_pool()
new_maf_data_pool()
object of class maf_data_pool (maf_data_pool)
maf_data_pool <- CRUX:::new_maf_data_pool()
maf_data_pool <- CRUX:::new_maf_data_pool()
maf_dataset_wrapper objects store the details of each dataset including the functions to download/load the data and its current status
new_maf_dataset_wrapper( maf_data_pool, display_name, short_name, unique_name, start_status, data_description, is_dataset_downloadable, function_to_download_data = function() { return(NA) }, is_dataset_loadable = TRUE, function_to_load_data, name_of_data_source = "unknown", local_path_to_data = "", clinical_data = NA, datatype_of_stored_object = "", derived_from = NA, loaded_data = NA, rnaseq_filepath = NA, number_of_samples = NA )
new_maf_dataset_wrapper( maf_data_pool, display_name, short_name, unique_name, start_status, data_description, is_dataset_downloadable, function_to_download_data = function() { return(NA) }, is_dataset_loadable = TRUE, function_to_load_data, name_of_data_source = "unknown", local_path_to_data = "", clinical_data = NA, datatype_of_stored_object = "", derived_from = NA, loaded_data = NA, rnaseq_filepath = NA, number_of_samples = NA )
maf_data_pool |
A maf_data_pool object. Used to check supplied 'unique_name' is actually going to be unique. If not, characaters are appended to make it truly unique in the context of the supplied dataframe. (maf_data_pool) |
display_name |
Name that the end-user will see (string) |
short_name |
Abbreviated dataset name (string) |
unique_name |
Some unique identifier. (string) |
start_status |
one of: "not_downloaded","not_loaded", "ready" (string) |
data_description |
a description of the dataset (string) |
is_dataset_downloadable |
is the dataset downloadable? The alternative is if its packaged in a compressed form with the tool. |
function_to_download_data |
a function that when run will download the required data return the path to which it was downloaded if successful. Will return NA if it failed (function that returns string or NA). If is_dataset_downloadable is false, this is ignored (just use default) |
is_dataset_loadable |
is dataset loadable (flag) |
function_to_load_data |
a function that takes 'local_path_to_data' as its argument and returns the loaded maf object when complete. The function needs to take a single argument, but it doesn't actually have to use it. For example, when loading tcga data using the TCGAmutations package, this function could be function(filepath)maftools::tcgaLoad(). This function completely ignores the filepath argument but you NEED to include it anyway (function) |
name_of_data_source |
name of the data source. For Example "USER" or "TCGA" or "PCAWG" (string) |
local_path_to_data |
a path to data which will be configured based on function_to_download_data. If this option is configured ahead of time (string) |
clinical_data |
the clinical data of the object |
datatype_of_stored_object |
type of stored data object. Not used for anything right now, just interesting metadata. examples are \*.Rds or \*.mafs (string) |
derived_from |
the maf_dataset_wrapper_object from which the new object was derived. If the dataset was obtained directly from an online source, leave as NA (maf_dataset_wrapper or NA) |
loaded_data |
the loaded R object (MAF or NA) |
rnaseq_filepath |
the path to the rnaseq data (string) |
number_of_samples |
the number of samples in the cohort (integer) |
an object of type maf_dataset_wrapper (maf_dataset_wrapper)
display_name
short_name
unique_name
status
data_description
download_data
load_data
name_of_data_source
local_path_to_data
datatype_of_stored_object
loaded_data
derived_from
rnaseq_filepath
number_of_samples
A function that parses numbers from strings
parse_number(x)
parse_number(x)
x |
character vector you want to parse numbers from |
Add PCAWG dataset to a data pool
pcawg_dataset_to_data_pool(maf_data_pool, pcawg_study_abbreviation)
pcawg_dataset_to_data_pool(maf_data_pool, pcawg_study_abbreviation)
maf_data_pool |
the datapool to add pcawg study too (maf_data_pool) |
pcawg_study_abbreviation |
Name of PCAWG study. Use pcawg_available to see options (string) |
returns the data pool with the specified dataset added (maf_data_pool)
CRUX:::pcawg_dataset_to_data_pool(CRUX:::new_maf_data_pool(), "Bone-Cart")
CRUX:::pcawg_dataset_to_data_pool(CRUX:::new_maf_data_pool(), "Bone-Cart")
Create dataset wrapper from pcawg dataset
pcawg_dataset_to_maf_dataset_wrapper(maf_data_pool, pcawg_study_abbreviation)
pcawg_dataset_to_maf_dataset_wrapper(maf_data_pool, pcawg_study_abbreviation)
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
pcawg_study_abbreviation |
Name of PCAWG study. Use pcawg_available to see options (string) |
maf_dataset_wrapper object
CRUX:::pcawg_dataset_to_maf_dataset_wrapper(CRUX:::new_maf_data_pool(), "Bone-Cart")
CRUX:::pcawg_dataset_to_maf_dataset_wrapper(CRUX:::new_maf_data_pool(), "Bone-Cart")
Add all PCAWG datasets to a data pool
pcawg_datasets_to_data_pool(maf_data_pool)
pcawg_datasets_to_data_pool(maf_data_pool)
maf_data_pool |
the datapool to add pcawg study too (maf_data_pool) |
data pool with all pcawg datasets added as maf_dataset_wrappers (maf_data_pool)
CRUX:::pcawg_dataset_to_data_pool(CRUX:::new_maf_data_pool(), "Bone-Cart")
CRUX:::pcawg_dataset_to_data_pool(CRUX:::new_maf_data_pool(), "Bone-Cart")
plotforest: Wraps around maftools::forestPlot to more explicitly handle pval VS fdr option and allow both to be passed while onl using the value set by bool 'threshold_on_fdr'
plotforest( mafCompareRes, pVal = 0.05, fdr = 0.05, threshold_on_fdr, color = NULL, geneFontSize = 1.2, lineWidth = 2.2, titleSize = 1.2 )
plotforest( mafCompareRes, pVal = 0.05, fdr = 0.05, threshold_on_fdr, color = NULL, geneFontSize = 1.2, lineWidth = 2.2, titleSize = 1.2 )
mafCompareRes |
results from |
pVal |
p-value threshold. Default 0.05. |
fdr |
fdr threshold. Default NULL. If provided uses adjusted pvalues (fdr). |
threshold_on_fdr |
should we threshold on FDR (TRUE) or on pValue (false) (flag) |
color |
vector of two colors for the lines. Default 'maroon' and 'royalblue' |
geneFontSize |
Font size for gene symbols. Default 0.8 |
lineWidth |
line width for CI bars. Default 1 |
titleSize |
font size for titles. Default 1.2 |
Automatically detects filetype from
read_maf_flexible( path_mutations, refBuild = NULL, path_clindata = NULL, filetype = c("AUTO", "ANNOVAR", "MAF") )
read_maf_flexible( path_mutations, refBuild = NULL, path_clindata = NULL, filetype = c("AUTO", "ANNOVAR", "MAF") )
path_mutations |
path to mutation file (string) |
refBuild |
which reference version is being used |
path_clindata |
path to clinical annotation file (string) |
filetype |
what type of filetype do we expect (string). If "AUTO" will automatically guess the filetype using [guess_genomic_mutation_filetype()] |
one of MAF, ANNOVAR, VCF, OTHER
Read RNAseq file
read_rnaseq_file(rnaseq_file)
read_rnaseq_file(rnaseq_file)
rnaseq_file |
(string) |
Dataframe containing at least three columns, named "Tumor_Sample_Barcode", "Hugo_Symbol" and "TPM". May optionally include columns named "Fold_Change" and "Transcript" (dataframe)
Run the Shiny Application
run_app(options = list(launch.browser = TRUE), ...)
run_app(options = list(launch.browser = TRUE), ...)
options |
A list of options to be passed to shinyApp. Common options include launch.browser & port. You must always set ALL options you care about in one go. E.g. if you use options=list(port=3838) we cannot guarantee the launch.browser option will remain true. If multiple options are important to you, force-set them all, e.g. options(list(launch.browser=TRUE, port = 3838)) |
... |
A series of options to be used inside the app. |
Programmatically create a Shiny input
shinyInput(FUN, n, id, label, ...)
shinyInput(FUN, n, id, label, ...)
FUN |
function to create the input |
n |
number of inputs to be created |
id |
ID prefix for each input |
label |
label of shiny object (string) |
... |
additaional arguments passed to FUN |
Takes a TCGA study abbreviation, creates a tcga_dataset_to_maf_dataset_wrapper object for the relevant dataset and adds the wrapper to the maf_data_pool
tcga_dataset_to_data_pool( tcga_study_abbreviation, maf_data_pool, source = "Firehose" )
tcga_dataset_to_data_pool( tcga_study_abbreviation, maf_data_pool, source = "Firehose" )
tcga_study_abbreviation |
a TCGA cohort abbreviation (see maftools::tcgaAvailable()) (string) |
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
source |
'MC3' or 'Firehose'. Source of TCGA data to use. See ?maftools::tcgaLoad for details (string) |
returns a data pool object with extra dataset added (maf_data_pool)
Other DataToWrapper:
tcga_dataset_to_maf_dataset_wrapper()
,
tcga_datasets_to_data_pool()
,
user_data_filepath_to_class_maf_dataset_wrapper()
,
user_to_dataset_to_data_pool()
CRUX:::tcga_dataset_to_data_pool("ACC", CRUX:::new_maf_data_pool())
CRUX:::tcga_dataset_to_data_pool("ACC", CRUX:::new_maf_data_pool())
Takes a TCGA cohort abbreviation
tcga_dataset_to_maf_dataset_wrapper( maf_data_pool, tcga_study_abbreviation, source = "Firehose" )
tcga_dataset_to_maf_dataset_wrapper( maf_data_pool, tcga_study_abbreviation, source = "Firehose" )
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
tcga_study_abbreviation |
a TCGA cohort abbreviation (see maftools::tcgaAvailable()) (string) |
source |
'MC3' or 'Firehose'. Source of TCGA data to use. See ?maftools::tcgaLoad for details (string) |
functions and values associated with specified TCGA cohort (maf_dataset_wrapper)
Other DataToWrapper:
tcga_dataset_to_data_pool()
,
tcga_datasets_to_data_pool()
,
user_data_filepath_to_class_maf_dataset_wrapper()
,
user_to_dataset_to_data_pool()
ACC_maf_dataset_wrapper <- CRUX:::tcga_dataset_to_maf_dataset_wrapper( CRUX:::new_maf_data_pool(), "ACC" )
ACC_maf_dataset_wrapper <- CRUX:::tcga_dataset_to_maf_dataset_wrapper( CRUX:::new_maf_data_pool(), "ACC" )
Takes a maf_data_poolobject and adds maf_dataset_wrappers for all tcga datasets available
tcga_datasets_to_data_pool(maf_data_pool, source = "Firehose")
tcga_datasets_to_data_pool(maf_data_pool, source = "Firehose")
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
source |
'MC3' or 'Firehose'. Source of TCGA data to use. See ?maftools::tcgaLoad for details (string) |
returns a data pool object with extra dataset added (maf_data_pool)
Other DataToWrapper:
tcga_dataset_to_data_pool()
,
tcga_dataset_to_maf_dataset_wrapper()
,
user_data_filepath_to_class_maf_dataset_wrapper()
,
user_to_dataset_to_data_pool()
CRUX:::tcga_datasets_to_data_pool(CRUX:::new_maf_data_pool(), source = "Firehose")
CRUX:::tcga_datasets_to_data_pool(CRUX:::new_maf_data_pool(), source = "Firehose")
Load TCGA data with correctly typed clinical data. By default, maftools::tcgaLoad makes all Firehose dataset clinical features character vectors
TCGAmutations_load_with_typed_metadata(study, source = "Firehose")
TCGAmutations_load_with_typed_metadata(study, source = "Firehose")
study |
Study names to load. Use |
source |
Source for MAF files. Can be |
MAF object with correctly typed clinical.data dataframe (MAF)
must be in server
text_is_non_zero_string(text, test_custom_function = NULL)
text_is_non_zero_string(text, test_custom_function = NULL)
text |
input text to assert is a string (string) |
test_custom_function |
a function which takes the value of the textInput and returns TRUE/FALSE depending on whether it meets expectations. If supplied, textInput value must be a non-emptystring AND pass the custom function's test(function) |
True if valid text is found in. FALSE if it is not (flag)
Title
user_data_filepath_to_class_maf_dataset_wrapper( filepath, clinicalData = NA, maf_data_pool, display_name, short_name, description = "User specified file", data_source = "USER", loaded_data = NA )
user_data_filepath_to_class_maf_dataset_wrapper( filepath, clinicalData = NA, maf_data_pool, display_name, short_name, description = "User specified file", data_source = "USER", loaded_data = NA )
filepath |
tab delimited MAF file. File can also be gz compressed. Required. Alternatively, you can also provide already read MAF file as a dataframe. |
clinicalData |
Clinical data associated with each sample/Tumor_Sample_Barcode in MAF. Could be a text file or a data.frame. Default NULL. |
maf_data_pool |
A maf_data_pool object. Used to check supplied 'unique_name' is actually going to be unique. If not, characaters are appended to make it truly unique in the context of the supplied dataframe. (maf_data_pool) |
display_name |
Name that the end-user will see (string) |
short_name |
Abbreviated dataset name (string) |
description |
description (string) |
data_source |
data source (string) |
loaded_data |
the loaded R object (MAF or NA) |
maf_dataset_wrapper
Other DataToWrapper:
tcga_dataset_to_data_pool()
,
tcga_dataset_to_maf_dataset_wrapper()
,
tcga_datasets_to_data_pool()
,
user_to_dataset_to_data_pool()
Takes a filepath to user dataset + some medata and creates a maf_dataset_wrapper object, then adds the wrapper to the maf_data_pool
user_to_dataset_to_data_pool( maf_data_pool, filepath, clinicalData = NA, display_name, short_name, description = "User specified file", data_source = "USER", loaded_data = NA )
user_to_dataset_to_data_pool( maf_data_pool, filepath, clinicalData = NA, display_name, short_name, description = "User specified file", data_source = "USER", loaded_data = NA )
maf_data_pool |
the data pool to add the dataset wrapper to (maf_data_pool) |
filepath |
path to maf file |
clinicalData |
Clinical data associated with each sample/Tumor_Sample_Barcode in MAF. Could be a text file or a data.frame. Default NULL. |
display_name |
Name that the end-user will see (string) |
short_name |
Abbreviated dataset name (string) |
description |
dataset description |
data_source |
data source |
loaded_data |
the loaded R object (MAF or NA) |
returns a data pool object with extra dataset added (maf_data_pool)
Other DataToWrapper:
tcga_dataset_to_data_pool()
,
tcga_dataset_to_maf_dataset_wrapper()
,
tcga_datasets_to_data_pool()
,
user_data_filepath_to_class_maf_dataset_wrapper()