diff --git a/.github/workflows/build_check.yaml b/.github/workflows/build_check.yaml new file mode 100644 index 0000000..c6f4395 --- /dev/null +++ b/.github/workflows/build_check.yaml @@ -0,0 +1,49 @@ +name: GAMBLR.helpers build check + +on: + pull_request: + branches: [master] + + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -el {0} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Conda + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Create conda environment + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: r + channels: conda-forge,defaults + python-version: 3.11 + auto-activate-base: false + environment-file: envs/r.yaml + + - name: Build package + run: + Rscript -e "devtools::install()" + + - name: Check package + run: + Rscript -e "devtools::check(vignettes = FALSE, args = '--no-examples')" + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@main + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: check diff --git a/DESCRIPTION b/DESCRIPTION index 83cbf9b..c69cdad 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,7 +17,6 @@ Imports: ggthemes, philentropy, readr, - reshape2, stringr, tibble, tidyr, diff --git a/NAMESPACE b/NAMESPACE index 4b83105..8f7afde 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -24,7 +24,6 @@ export(maf_header) export(normalize_expression_data) export(rainfall_conv) export(required_cols) -export(review_hotspots) export(sanity_check_metadata) export(socketWrite) export(standardize_chr_prefix) @@ -44,7 +43,6 @@ import(workflowr) importFrom(dplyr,left_join) importFrom(ggthemes,theme_foundation) importFrom(philentropy,KL) -importFrom(reshape2,melt) importFrom(stats,end) importFrom(stats,quantile) importFrom(stats,start) diff --git a/R/GAMBLR.helpers-package.R b/R/GAMBLR.helpers-package.R index c756738..0af4d14 100644 --- a/R/GAMBLR.helpers-package.R +++ b/R/GAMBLR.helpers-package.R @@ -4,7 +4,6 @@ ## usethis namespace: start #' @importFrom dplyr left_join #' @importFrom philentropy KL -#' @importFrom reshape2 melt #' @importFrom stats end #' @importFrom stats quantile #' @importFrom stats start diff --git a/R/bins_to_bedgraph.R b/R/bins_to_bedgraph.R index 9520742..7a520e3 100644 --- a/R/bins_to_bedgraph.R +++ b/R/bins_to_bedgraph.R @@ -1,3 +1,13 @@ +#' @title Bins to bed graph. +#' +#' @description This function will generate bed file. +#' +#' @param bin_df Data frame with bins. +#' @param min_value Minimum value to retain the bin. +#' @param filename Path to a local file on drive to save the resulting file. +#' +#' @return full path to the file that was written +#' #' @export bins_to_bedgraph = function(bin_df,min_value = 3,filename = "test.bed"){ bed_cols = dplyr::select(bin_df,1,2,3,smoothed_ratio) @@ -7,8 +17,8 @@ bins_to_bedgraph = function(bin_df,min_value = 3,filename = "test.bed"){ bed_cols = mutate(bed_cols,chr = paste0("chr",chr)) } bed_cols = dplyr::filter(bed_cols,value > min_value) - this = dplyr::filter(chr1p,bin_start==27985000) + this = dplyr::filter(chr1p,bin_start==27985000) bed_cols = mutate(bed_cols,end=format(end, scientific=F),start=format(start, scientific=F)) write.table(bed_cols,row.names=F,col.names=F,quote=F,sep="\t",file=filename) - + return(filename) } diff --git a/R/cache_output.R b/R/cache_output.R index 2d9373b..64bc573 100644 --- a/R/cache_output.R +++ b/R/cache_output.R @@ -1,3 +1,16 @@ +#' @title Cache output. +#' +#' @description TODO. +#' +#' @param result_df TODO. +#' @param function_name TODO. +#' @param clobber_mode TODO. +#' @param get_existing TODO. +#' @param function_params TODO. +#' @param additional_details TODO. +#' +#' @return full path to the file that was written +#' #' @export cache_output = function(result_df, function_name, @@ -31,4 +44,5 @@ cache_output = function(result_df, message(paste("creating/overwriting",cache_file_name)) write_tsv(result_df,file=cache_file_name) + return(cache_file_name) } diff --git a/R/calculate_tmb.R b/R/calculate_tmb.R index ab23549..ebda2ed 100644 --- a/R/calculate_tmb.R +++ b/R/calculate_tmb.R @@ -1,4 +1,4 @@ -#' @title Return TMB counts. +#' @title Calculate tumour mutation burden. #' #' @description This function implements tumor mutation burden calculation. #' TODO: add more details. @@ -31,7 +31,7 @@ #' maf1, #' regions_bed = grch37_ashm_regions #' ) -#' #' calculate_tmb( +#' calculate_tmb( #' maf1, #' regions_bed = grch37_ashm_regions, #' subset_to_nonSyn = FALSE diff --git a/R/check_config_value.R b/R/check_config_value.R index d6e7d78..76026a0 100644 --- a/R/check_config_value.R +++ b/R/check_config_value.R @@ -3,14 +3,14 @@ #' @description Check the existence of a specific config key. #' The function will notify the user and end the program if no such key exists. #' -#' @details INTERNAL FUNCTION for checking the existence of a config value, not meant for out-of-package usage. +#' @details INTERNAL FUNCTION for checking the existence of a config value, +#' not meant for out-of-package usage. #' #' @param config_key key from config, prefixed with config::get() #' -#' @return A string with the path to a file specified in the config or nothing (if config key is NULL). +#' @return A string with the path to a file specified in the config or nothing +#' (if config key is NULL). #' -#' @noRd -#' #' @examples #' check_config_value(config::get("resources")$blacklist$template) #' diff --git a/R/check_file_details.R b/R/check_file_details.R index c80801c..1f2ca83 100644 --- a/R/check_file_details.R +++ b/R/check_file_details.R @@ -1,3 +1,13 @@ +#' @title Check file details +#' +#' @description When relative path to a file is given, this function will +#' automatically generate it's full path using the project_base config value +#' and check for existence of the file at the full path. Can operate on vector +#' of several relative paths. +#' +#' @param relative_paths Vector of relative paths. +#' @return Boolean +#' #' @export check_file_details = function(relative_paths){ not_found = c() diff --git a/R/compare_coding_mutation_pattern.R b/R/compare_coding_mutation_pattern.R index 5e8d5bd..281f090 100644 --- a/R/compare_coding_mutation_pattern.R +++ b/R/compare_coding_mutation_pattern.R @@ -1,3 +1,13 @@ +#' @title Compare pattern of coding mutations. +#' +#' @description TODO. +#' +#' @param maf_df1 TODO. +#' @param maf_df2 TODO. +#' @param gene TODO. +#' +#' @return list +#' #' @export compare_coding_mutation_pattern = function(maf_df1,maf_df2,gene){ if(missing(maf_df1) | missing(maf_df2)){ diff --git a/R/copy_no_clobber.R b/R/copy_no_clobber.R index fbb9e97..8750b83 100644 --- a/R/copy_no_clobber.R +++ b/R/copy_no_clobber.R @@ -1,3 +1,13 @@ +#' @title Copy not clobber. +#' +#' @description TODO. +#' +#' @param from_file TODO. +#' @param to_file TODO. +#' @param force TODO. +#' +#' @return full path to the file that was written +#' #' @export copy_no_clobber = function(from_file, to_file, @@ -9,4 +19,5 @@ copy_no_clobber = function(from_file, if(force){ file.copy(from_file,to_file) } + return(to_file) } diff --git a/R/gene_mutation_tally.R b/R/gene_mutation_tally.R index 700657a..10f0964 100644 --- a/R/gene_mutation_tally.R +++ b/R/gene_mutation_tally.R @@ -1,3 +1,22 @@ +#' @title Tally coding mutations load. +#' +#' @description Calculate the number of coding mutations per grouping. Silent +#' variants are excluded from this calculation. The incoming maf may contain +#' non-coding variants, which will be excluded from tallying. +#' +#' @param maf_df Data frame of simple somatic mutations in maf format. Required +#' parameter. +#' @param these_samples_metadata Data frame with metadata. Must contain sample +#' identifiers in the `sample_id` column and column that will be used +#' to calulate the mutation load. All other columns are ignored. Required +#' parameter. +#' @param these_genes Vector of hugo symbols for genes to be considered for the +#' tallying of mutations. Required parameter. +#' @param grouping_variable Column in the metadata that will be used as grouping +#' variable. By default, the `cohort` is used. +#' +#' @return data frame +#' #' @export gene_mutation_tally = function(maf_df,these_samples_metadata,these_genes,grouping_variable="cohort"){ meta = dplyr::select(these_samples_metadata,sample_id,{{grouping_variable}}) diff --git a/R/get_template_wildcards.R b/R/get_template_wildcards.R index 90e2524..f50d6fd 100644 --- a/R/get_template_wildcards.R +++ b/R/get_template_wildcards.R @@ -1,3 +1,12 @@ +#' @title Get template wildcards. +#' +#' @description TODO. +#' +#' @param parent_key TODO. +#' @param template_key TODO. +#' +#' @return list +#' #' @export get_template_wildcards = function(parent_key, template_key){ diff --git a/R/get_unmatched_normals.R b/R/get_unmatched_normals.R index e4c7469..a08e8fc 100644 --- a/R/get_unmatched_normals.R +++ b/R/get_unmatched_normals.R @@ -1,9 +1,33 @@ -#helper function to get the unmatched normals from the main config +#' @title Get unmatched normals. +#' +#' @description Helper function to get the unmatched normals from the main +#' config. +#' +#' @param seq_type_filter Seq type key from config for which to return the +#' unmatched normals for. +#' +#' @return data frame +#' +#' @import dplyr tidyr tibble #' @export get_unmatched_normals = function(seq_type_filter){ - a = check_config_value(config::get("unmatched_normal_ids")) - df = melt(a,value.name="normal_sample_id") %>% - rename(c("genome_build"="L3","seq_type"="L2","unix_group"="L1")) %>% - dplyr::filter(seq_type == seq_type_filter) - return(df) + a <- check_config_value(config::get("unmatched_normal_ids")) + df <- a %>% + as.data.frame( + check.names = FALSE + ) %>% + t %>% + as.data.frame() %>% + tibble::rownames_to_column("rownames") %>% + tidyr::separate( + rownames, + into = c("unix_group", "seq_type", "genome_build"), + sep = "\\." + ) %>% + dplyr::select( + "normal_sample_id" = "V1", + genome_build, seq_type, unix_group + ) %>% + dplyr::filter(seq_type == seq_type_filter) + return(df) } diff --git a/R/grob_wildcards.R b/R/grob_wildcards.R index 68905a6..ab77166 100644 --- a/R/grob_wildcards.R +++ b/R/grob_wildcards.R @@ -1,4 +1,11 @@ -#Helper functions not for export +#' @title Glob wildcards. +#' +#' @description Helper function to extract wildcard values from a string. +#' +#' @param wildcarded_string String containing wildcards inside the {} notations. +#' +#' @return vector +#' #' @export grob_wildcards = function(wildcarded_string){ wildcards = unlist(stringr::str_extract_all(wildcarded_string,"\\{[^\\{]+\\}")) diff --git a/R/handle_metadata.R b/R/handle_metadata.R index 2a5b3de..3823507 100644 --- a/R/handle_metadata.R +++ b/R/handle_metadata.R @@ -12,8 +12,6 @@ #' #' @import GAMBLR.data dplyr #' -#' @noRd -#' #' @export handle_metadata = function(this_seq_type = "genome") { if ("GAMBLR.data" %in% installed.packages()) { diff --git a/R/helpers-vars.R b/R/helpers-vars.R index 4a2162a..98ff04c 100644 --- a/R/helpers-vars.R +++ b/R/helpers-vars.R @@ -1,3 +1,6 @@ +#' @title Coding variants classification. +#' +#' @description Vector of variant classification values considered as coding. #' @export coding_vc = c( "Frame_Shift_Del", "Frame_Shift_Ins", "In_Frame_Del", "In_Frame_Ins", @@ -5,6 +8,10 @@ coding_vc = c( "Splice_Region", "Splice_Site", "Targeted_Region", "Translation_Start_Site" ) +#' @title Non-synonymous variants classification. +#' +#' @description Vector of variant classification values considered as +#' non-synonymous. #' @export vc_nonSynonymous <- c( "Frame_Shift_Del", "Frame_Shift_Ins", @@ -14,27 +21,113 @@ vc_nonSynonymous <- c( "Missense_Mutation" ) -#Global variable specifying what metadata columns are absolutely required +#' @title Required columns in metadata. +#' +#' @description Global variable specifying what metadata columns are absolutely +#' required. #' @export -required_cols = c("sample_id","patient_id","pathology","seq_type","genome_build","pairing_status","Tumor_Sample_Barcode") +required_cols = c( + "sample_id", "patient_id", "pathology", "seq_type", "genome_build", + "pairing_status", "Tumor_Sample_Barcode" +) +#' @title Required columns in bedpe. +#' +#' @description Global variable specifying what bedpe columns are absolutely +#' required. #' @export -cnames = c("CHROM_A", "START_A", "END_A", "CHROM_B", "START_B", "END_B", "NAME", "SOMATIC_SCORE", "STRAND_A", "STRAND_B", "TYPE", "FILTER", "VAF_tumour", "VAF_normal", "DP_tumour", "DP_normal", "tumour_sample_id", "normal_sample_id", "pair_status") +cnames = c( + "CHROM_A", "START_A", "END_A", "CHROM_B", "START_B", "END_B", + "NAME", "SOMATIC_SCORE", "STRAND_A", "STRAND_B", "TYPE", "FILTER", + "VAF_tumour", "VAF_normal", "DP_tumour", "DP_normal", + "tumour_sample_id", "normal_sample_id", "pair_status" +) +#' @title Coding+Silent variants classification. +#' +#' @description Same as coding_vc, but includes Silent variants to consider +#' them as coding. #' @export -coding_class = c("Frame_Shift_Del", "Frame_Shift_Ins", "In_Frame_Del", "In_Frame_Ins", "Missense_Mutation", "Nonsense_Mutation", "Nonstop_Mutation", "Silent", "Splice_Region", "Splice_Site", "Targeted_Region", "Translation_Start_Site") +coding_class = c( + "Frame_Shift_Del", "Frame_Shift_Ins", "In_Frame_Del", "In_Frame_Ins", + "Missense_Mutation", "Nonsense_Mutation", "Nonstop_Mutation", "Silent", + "Splice_Region", "Splice_Site", "Targeted_Region", "Translation_Start_Site" +) +#' @title Column names in maf. +#' +#' @description A vector of column names and their order in standard maf file. #' @export -maf_header = c("Hugo_Symbol"=1,"Entrez_Gene_Id"=2,"Center"=3,"NCBI_Build"=4,"Chromosome"=5,"Start_Position"=6,"End_Position"=7,"Strand"=8,"Variant_Classification"=9,"Variant_Type"=10,"Reference_Allele"=11,"Tumor_Seq_Allele1"=12,"Tumor_Seq_Allele2"=13,"dbSNP_RS"=14,"dbSNP_Val_Status"=15,"Tumor_Sample_Barcode"=16,"Matched_Norm_Sample_Barcode"=17,"Match_Norm_Seq_Allele1"=18,"Match_Norm_Seq_Allele2"=19,"Tumor_Validation_Allele1"=20,"Tumor_Validation_Allele2"=21,"Match_Norm_Validation_Allele1"=22,"Match_Norm_Validation_Allele2"=23,"Verification_Status"=24,"Validation_Status"=25,"Mutation_Status"=26,"Sequencing_Phase"=27,"Sequence_Source"=28,"Validation_Method"=29,"Score"=30,"BAM_File"=31,"Sequencer"=32,"Tumor_Sample_UUID"=33,"Matched_Norm_Sample_UUID"=34,"HGVSc"=35,"HGVSp"=36,"HGVSp_Short"=37,"Transcript_ID"=38,"Exon_Number"=39,"t_depth"=40,"t_ref_count"=41,"t_alt_count"=42,"n_depth"=43,"n_ref_count"=44,"n_alt_count"=45,"all_effects"=46,"Allele"=47,"Gene"=48,"Feature"=49,"Feature_type"=50,"Consequence"=51,"cDNA_position"=52,"CDS_position"=53,"Protein_position"=54,"Amino_acids"=55,"Codons"=56,"Existing_variation"=57,"ALLELE_NUM"=58,"DISTANCE"=59,"STRAND_VEP"=60,"SYMBOL"=61,"SYMBOL_SOURCE"=62,"HGNC_ID"=63,"BIOTYPE"=64,"CANONICAL"=65,"CCDS"=66,"ENSP"=67,"SWISSPROT"=68,"TREMBL"=69,"UNIPARC"=70,"RefSeq"=71,"SIFT"=72,"PolyPhen"=73,"EXON"=74,"INTRON"=75,"DOMAINS"=76,"AF"=77,"AFR_AF"=78,"AMR_AF"=79,"ASN_AF"=80,"EAS_AF"=81,"EUR_AF"=82,"SAS_AF"=83,"AA_AF"=84,"EA_AF"=85,"CLIN_SIG"=86,"SOMATIC"=87,"PUBMED"=88,"MOTIF_NAME"=89,"MOTIF_POS"=90,"HIGH_INF_POS"=91,"MOTIF_SCORE_CHANGE"=92,"IMPACT"=93,"PICK"=94,"VARIANT_CLASS"=95,"TSL"=96,"HGVS_OFFSET"=97,"PHENO"=98,"MINIMISED"=99,"GENE_PHENO"=100,"FILTER"=101,"flanking_bps"=102,"vcf_id"=103,"vcf_qual"=104,"gnomAD_AF"=105,"gnomAD_AFR_AF"=106,"gnomAD_AMR_AF"=107,"gnomAD_ASJ_AF"=108,"gnomAD_EAS_AF"=109,"gnomAD_FIN_AF"=110,"gnomAD_NFE_AF"=111,"gnomAD_OTH_AF"=112,"gnomAD_SAS_AF"=113,"vcf_pos"=114,"gnomADg_AF"=115,"blacklist_count"=116) +maf_header = c( + "Hugo_Symbol"=1, "Entrez_Gene_Id"=2, "Center"=3, "NCBI_Build"=4, + "Chromosome"=5, "Start_Position"=6, "End_Position"=7, "Strand"=8, + "Variant_Classification"=9, "Variant_Type"=10, "Reference_Allele"=11, + "Tumor_Seq_Allele1"=12, "Tumor_Seq_Allele2"=13, "dbSNP_RS"=14, + "dbSNP_Val_Status"=15, "Tumor_Sample_Barcode"=16, + "Matched_Norm_Sample_Barcode"=17, "Match_Norm_Seq_Allele1"=18, + "Match_Norm_Seq_Allele2"=19, "Tumor_Validation_Allele1"=20, + "Tumor_Validation_Allele2"=21, "Match_Norm_Validation_Allele1"=22, + "Match_Norm_Validation_Allele2"=23, "Verification_Status"=24, + "Validation_Status"=25, "Mutation_Status"=26, "Sequencing_Phase"=27, + "Sequence_Source"=28, "Validation_Method"=29, "Score"=30, "BAM_File"=31, + "Sequencer"=32, "Tumor_Sample_UUID"=33, "Matched_Norm_Sample_UUID"=34, + "HGVSc"=35, "HGVSp"=36, "HGVSp_Short"=37, "Transcript_ID"=38, + "Exon_Number"=39, "t_depth"=40, "t_ref_count"=41, "t_alt_count"=42, + "n_depth"=43, "n_ref_count"=44, "n_alt_count"=45, "all_effects"=46, + "Allele"=47, "Gene"=48, "Feature"=49, "Feature_type"=50, "Consequence"=51, + "cDNA_position"=52, "CDS_position"=53, "Protein_position"=54, + "Amino_acids"=55, "Codons"=56, "Existing_variation"=57, "ALLELE_NUM"=58, + "DISTANCE"=59, "STRAND_VEP"=60, "SYMBOL"=61, "SYMBOL_SOURCE"=62, + "HGNC_ID"=63, "BIOTYPE"=64, "CANONICAL"=65, "CCDS"=66, "ENSP"=67, + "SWISSPROT"=68, "TREMBL"=69, "UNIPARC"=70, "RefSeq"=71, "SIFT"=72, + "PolyPhen"=73, "EXON"=74, "INTRON"=75, "DOMAINS"=76, "AF"=77, "AFR_AF"=78, + "AMR_AF"=79, "ASN_AF"=80, "EAS_AF"=81, "EUR_AF"=82, "SAS_AF"=83, "AA_AF"=84, + "EA_AF"=85, "CLIN_SIG"=86, "SOMATIC"=87, "PUBMED"=88, "MOTIF_NAME"=89, + "MOTIF_POS"=90, "HIGH_INF_POS"=91, "MOTIF_SCORE_CHANGE"=92, "IMPACT"=93, + "PICK"=94, "VARIANT_CLASS"=95, "TSL"=96, "HGVS_OFFSET"=97, "PHENO"=98, + "MINIMISED"=99, "GENE_PHENO"=100, "FILTER"=101, "flanking_bps"=102, + "vcf_id"=103, "vcf_qual"=104, "gnomAD_AF"=105, "gnomAD_AFR_AF"=106, + "gnomAD_AMR_AF"=107, "gnomAD_ASJ_AF"=108, "gnomAD_EAS_AF"=109, + "gnomAD_FIN_AF"=110, "gnomAD_NFE_AF"=111, "gnomAD_OTH_AF"=112, + "gnomAD_SAS_AF"=113, "vcf_pos"=114, "gnomADg_AF"=115, "blacklist_count"=116 +) +#' @title Color code aliases. +#' +#' @description A list of alias namings for color schemes. #' @export -colour_aliases = list("COO_consensus" = "coo", "COO" = "coo", "DHITsig_consensus" = "coo", - "pathology" = "pathology", "analysis_cohort" = "pathology", "group" = "pathology", - "FL_group" = "FL", "lymphgen" = "lymphgen", "lymphgen_with_cnv" = "lymphgen", - "bcl2_ba" = "pos_neg", "BCL2_status" = "pos_neg", "myc_ba" = "pos_neg", - "bcl6_ba" = "pos_neg", "EBV_status_inf"="EBV_status", - "manta_BCL2_sv" = "pos_neg", "manual_BCL2_sv" = "pos_neg", "manta_MYC_sv" = "pos_neg") +colour_aliases = list( + "COO_consensus" = "coo", + "COO" = "coo", + "DHITsig_consensus" = "coo", + "pathology" = "pathology", + "analysis_cohort" = "pathology", + "group" = "pathology", + "FL_group" = "FL", + "lymphgen" = "lymphgen", + "lymphgen_with_cnv" = "lymphgen", + "bcl2_ba" = "pos_neg", + "BCL2_status" = "pos_neg", + "myc_ba" = "pos_neg", + "bcl6_ba" = "pos_neg", + "EBV_status_inf" = "EBV_status", + "manta_BCL2_sv" = "pos_neg", + "manual_BCL2_sv" = "pos_neg", + "manta_MYC_sv" = "pos_neg" +) +#' @title Reverse mappings. +#' +#' @description A vector of substitutions mappings for the rainfall plots. +#' @export #' @export -rainfall_conv = c("T>C", "T>C", "C>T", "C>T", "T>A", "T>A", "T>G", "T>G", "C>A", "C>A", "C>G", "C>G", "InDel") -names(rainfall_conv) = c('A>G', 'T>C', 'C>T', 'G>A', 'A>T', 'T>A', 'A>C', 'T>G', 'C>A', 'G>T', 'C>G', 'G>C', 'InDel') +rainfall_conv = c( + "T>C", "T>C", "C>T", "C>T", "T>A", "T>A", + "T>G", "T>G", "C>A", "C>A", "C>G", "C>G", + "InDel" +) +names(rainfall_conv) = c( + 'A>G', 'T>C', 'C>T', 'G>A', 'A>T', 'T>A', + 'A>C', 'T>G', 'C>A', 'G>T', 'C>G', 'G>C', + 'InDel' +) diff --git a/R/review_hotspots.R b/R/review_hotspots.R deleted file mode 100644 index efe4750..0000000 --- a/R/review_hotspots.R +++ /dev/null @@ -1,103 +0,0 @@ -#' @title Review Hotspots. -#' -#' @description Annotate MAF-like data frome with a hot_spot column indicating recurrent mutations. -#' -#' @details This function takes an annotated MAF (with [GAMBLR.results::annotate_hotspots]) and adds a new column, "hot_spot", to the same data frame. -#' Genes for hotspot review are supplied with the `genes_of_interest` parameter. -#' Currently only a few sets of genes are supported, see parameter description for more information and limitations. -#' The desired genome build can be specified with `genome_build` parameter. Should be the same as the incoming MAF. -#' -#' @param annotated_maf A data frame in MAF format that has hotspots annotated using the function annotate_hotspots(). -#' @param genes_of_interest A vector of genes for hotspot review. Currently only FOXO1, MYD88, CREBBP, NOTCH1, NOTCH2, CD79B and EZH2 are supported. -#' @param genome_build Reference genome build for the coordinates in the MAF file. The default is grch37 genome build. -#' -#' @return The same data frame (as given to the `annotated_maf` parameter) with the reviewed column "hot_spot". -#' -#' @import dplyr GAMBLR.data -#' @export -#' -#' @examples -#' hot_ssms = review_hotspots(annotate_hotspots(get_coding_ssm(this_seq_type = "genome")), -#' genes_of_interest = c("CREBBP")) -#' -review_hotspots = function(annotated_maf, - genes_of_interest = c("FOXO1", "MYD88", "CREBBP", "NOTCH1", "NOTCH2", "CD79B", "EZH2"), - genome_build = "grch37"){ - - # define the list of genes currently supported for review - supported_genes = c("FOXO1", "MYD88", "CREBBP", "NOTCH1", "NOTCH2", "CD79B", "EZH2") - - # check genome build because CREBBP coordinates are hg19-based or hg38-based - - if (genome_build %in% c("hg19", "grch37", "hs37d5", "GRCh37")){ - coordinates = GAMBLR.data::hotspot_regions_grch37 - }else if(genome_build %in% c("hg38", "grch38", "GRCh38")){ - coordinates = GAMBLR.data::hotspot_regions_hg38 - }else{ - stop("The genome build specified is not currently supported. Please provide MAF file in one of the following cordinates: hg19, grch37, hs37d5, GRCh37, hg38, grch38, or GRCh38") - } - # check that at least one of the currently supported genes are present - if (length(intersect(supported_genes, genes_of_interest))==0){ - stop(paste0("Currently only ", paste(supported_genes, collapse=", "), " are supported. Please specify one of these genes.")) - } - # notify user that there is limited number of genes currently supported - if (length(setdiff(genes_of_interest, supported_genes))>0){ - message(strwrap(paste0("Currently only ", paste(supported_genes, collapse=", "), - " are supported. By default only these genes from the supplied list will be reviewed. Reviewing hotspots for genes ", - paste(intersect(supported_genes, genes_of_interest), collapse = ", "), ", it will take a second ..."))) - } - if("FOXO1" %in% genes_of_interest){ - annotated_maf = annotated_maf %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "FOXO1" & - HGVSp_Short == "p.M1?", - "TRUE", hot_spot)) - } - - if("CREBBP" %in% genes_of_interest){ - annotated_maf = annotated_maf %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "CREBBP" & - Start_Position > coordinates["CREBBP", "start"] & - End_Position < coordinates["CREBBP", "end"] & - Variant_Classification == "Missense_Mutation", - "TRUE", hot_spot)) - } - if("EZH2" %in% genes_of_interest){ - annotated_maf = annotated_maf %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "EZH2" & - Start_Position > coordinates["EZH2", "start"] & - End_Position < coordinates["EZH2", "end"], - "TRUE", hot_spot)) - } - if("MYD88" %in% genes_of_interest){ - annotated_maf = annotated_maf %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "MYD88" & - HGVSp_Short %in% c("p.L273P", "p.L265P"), - "TRUE", hot_spot)) - } - if("NOTCH1" %in% genes_of_interest){ - annotated_maf = annotated_maf %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "NOTCH1" & - Start_Position < coordinates["NOTCH1", "start"], - "TRUE", hot_spot)) - } - if("NOTCH2" %in% genes_of_interest){ - annotated_maf = annotated_maf %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "NOTCH2" & - Start_Position < coordinates["NOTCH2", "start"], - "TRUE", hot_spot)) - } - - if("CD79B" %in% genes_of_interest){ - truncating_variants = c("Frame_Shift_Del", "Frame_Shift_Ins", "Nonsense_Mutation", "Splice_Region", "Splice_Site") - annotated_maf = annotated_maf %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "CD79B" & - Start_Position < coordinates["CD79B_trunc", "start"] & - Variant_Classification %in% truncating_variants, - "TRUE", hot_spot)) %>% - dplyr::mutate(hot_spot = ifelse(Hugo_Symbol == "CD79B" & - Start_Position < coordinates["CD79B_NONtrunc", "start"] & - ! Variant_Classification %in% truncating_variants, - "TRUE", hot_spot)) - } - return(annotated_maf) -} diff --git a/R/sanity_check_metadata.R b/R/sanity_check_metadata.R index febb981..0faa1f4 100644 --- a/R/sanity_check_metadata.R +++ b/R/sanity_check_metadata.R @@ -8,7 +8,6 @@ #' #' @import tibble readr dplyr #' -#' @noRd #' #' @examples #' sane_meta_data = sanity_check_metadata() diff --git a/R/socketWrite.R b/R/socketWrite.R index c5ebd90..b8eba69 100644 --- a/R/socketWrite.R +++ b/R/socketWrite.R @@ -1,3 +1,12 @@ +#' @title Socket write. +#' +#' @description TODO. +#' +#' @param sock TODO. +#' @param string TODO. +#' +#' @return someting +#' #' @export socketWrite = function(sock, string){ print(string) diff --git a/R/standardize_chr_prefix.R b/R/standardize_chr_prefix.R index 1e74903..967e860 100644 --- a/R/standardize_chr_prefix.R +++ b/R/standardize_chr_prefix.R @@ -1,6 +1,7 @@ #' @title Standardize Chromosome Prefix. #' -#' @description Standardize the chr prefix in a vector of chromosome names based on projection. +#' @description Standardize the chr prefix in a vector of chromosome names based +#' on projection. #' #' @details INTERNAL FUNCTION, not meant for out-of-package use. #' @@ -9,7 +10,6 @@ #' #' @return A vector of chromosome names with prefix standardized to projection #' -#' @noRd #' #' @examples #' these_chrs = c(8, "13", "chr4", "chrY") @@ -24,7 +24,8 @@ standardize_chr_prefix = function(incoming_vector, if (projection %in% c("grch37", "grch38")) { output_vector = gsub("chr", "", incoming_vector) } else { - output_vector = gsub("chr", "", incoming_vector) # if there is a mix of prefixed and non-prefixed options + # if there is a mix of prefixed and non-prefixed options + output_vector = gsub("chr", "", incoming_vector) output_vector = paste0("chr", output_vector) } return(output_vector) diff --git a/R/subset_cnstates.R b/R/subset_cnstates.R index 10fcba1..363d072 100644 --- a/R/subset_cnstates.R +++ b/R/subset_cnstates.R @@ -10,8 +10,6 @@ #' #' @return Nothing. #' -#' @noRd -#' #' @examples #' cn_states = get_sample_cn_segments(these_sample_ids = c("02-13135T", #' "SU-DHL-4"), diff --git a/R/trim_scale_expression.R b/R/trim_scale_expression.R index d16bcf7..34f006c 100644 --- a/R/trim_scale_expression.R +++ b/R/trim_scale_expression.R @@ -1,15 +1,15 @@ #' @title Trim Scale Expressions. #' -#' @description INTERNAL HELPER FUNCTION called by prettyOncoplot, not meant for out-of-package usage. +#' @description INTERNAL HELPER FUNCTION called by prettyOncoplot, not meant for +#' out-of-package usage. #' -#' @details INTERNAL FUNCTION called by prettyOncoplot, not meant for out-of-package usage. +#' @details INTERNAL FUNCTION called by prettyOncoplot, not meant for +#' out-of-package usage. #' #' @param x Numeric value (of expression) to be trimmed. #' #' @return Numeric value. #' -#' @noRd -#' #' @examples #' trimmed = trim_scale_expression(2) #' diff --git a/R/web_initialize_gambl_site.R b/R/web_initialize_gambl_site.R index 3f1141d..a781ee4 100644 --- a/R/web_initialize_gambl_site.R +++ b/R/web_initialize_gambl_site.R @@ -9,8 +9,6 @@ #' #' @import workflowr #' -#' @noRd -#' #' @export web_initialize_gambl_site = function(site_base_name, base_directory = "/home/rmorin/", diff --git a/README.md b/README.md index 53e7865..841aa8b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ +![](https://github.com/morinlab/GAMBLR.helpers/actions/workflows/build_check.yaml/badge.svg) + # GAMBLR.helpers A collection of helper functions to support the functionality of GAMBLR-based packages diff --git a/envs/r.yaml b/envs/r.yaml new file mode 100644 index 0000000..fdceb73 --- /dev/null +++ b/envs/r.yaml @@ -0,0 +1,197 @@ +name: r +channels: + - conda-forge + - defaults +dependencies: + - _libgcc_mutex=0.1 + - _openmp_mutex=4.5 + - _r-mutex=1.0.1 + - _sysroot_linux-64_curr_repodata_hack=3 + - binutils_impl_linux-64=2.40 + - bwidget=1.9.14 + - bzip2=1.0.8 + - c-ares=1.27.0 + - ca-certificates=2024.2.2 + - cairo=1.18.0 + - curl=8.5.0 + - expat=2.6.2 + - font-ttf-dejavu-sans-mono=2.37 + - font-ttf-inconsolata=3.000 + - font-ttf-source-code-pro=2.038 + - font-ttf-ubuntu=0.83 + - fontconfig=2.14.2 + - fonts-anaconda=1 + - fonts-conda-ecosystem=1 + - fonts-conda-forge=1 + - freetype=2.12.1 + - fribidi=1.0.10 + - gcc_impl_linux-64=13.2.0 + - gettext=0.21.1 + - gfortran_impl_linux-64=13.2.0 + - graphite2=1.3.13 + - gxx_impl_linux-64=13.2.0 + - harfbuzz=8.3.0 + - icu=73.2 + - kernel-headers_linux-64=4.18.0 + - keyutils=1.6.1 + - krb5=1.21.2 + - ld_impl_linux-64=2.40 + - lerc=4.0.0 + - libblas=3.9.0 + - libcurl=8.5.0 + - libdeflate=1.19 + - libedit=3.1.20191231 + - libev=4.33 + - libexpat=2.6.2 + - libffi=3.4.2 + - libgcc-devel_linux-64=13.2.0 + - libgcc-ng=13.2.0 + - libgfortran-ng=13.2.0 + - libgfortran5=13.2.0 + - libgit2=1.7.2 + - libglib=2.80.0 + - libgomp=13.2.0 + - libiconv=1.17 + - libjpeg-turbo=3.0.0 + - liblapack=3.9.0 + - libnghttp2=1.58.0 + - libopenblas=0.3.26 + - libpng=1.6.43 + - libsanitizer=13.2.0 + - libssh2=1.11.0 + - libstdcxx-devel_linux-64=13.2.0 + - libstdcxx-ng=13.2.0 + - libtiff=4.6.0 + - libuuid=2.38.1 + - libwebp-base=1.3.2 + - libxcb=1.15 + - libxml2=2.12.5 + - libzlib=1.2.13 + - lz4-c=1.9.4 + - make=4.3 + - ncurses=6.4 + - openssl=3.2.1 + - pandoc=3.1.12.2 + - pango=1.52.1 + - pcre2=10.43 + - pixman=0.43.2 + - pthread-stubs=0.4 + - r-askpass=1.2.0 + - r-assertthat=0.2.1 + - r-base=4.2.3 + - r-base64enc=0.1_3 + - r-biocmanager=1.30.22 + - r-brew=1.0_10 + - r-brio=1.1.4 + - r-bslib=0.6.1 + - r-cachem=1.0.8 + - r-callr=3.7.5 + - r-cli=3.6.2 + - r-clipr=0.8.0 + - r-commonmark=1.9.1 + - r-cpp11=0.4.7 + - r-crayon=1.5.2 + - r-credentials=2.0.1 + - r-curl=5.1.0 + - r-desc=1.4.3 + - r-devtools=2.4.5 + - r-diffobj=0.3.5 + - r-digest=0.6.35 + - r-downlit=0.4.3 + - r-ellipsis=0.3.2 + - r-evaluate=0.23 + - r-fansi=1.0.6 + - r-fastmap=1.1.1 + - r-fontawesome=0.5.2 + - r-fs=1.6.3 + - r-gert=2.0.1 + - r-gh=1.4.0 + - r-gitcreds=0.1.2 + - r-glue=1.7.0 + - r-highr=0.10 + - r-htmltools=0.5.7 + - r-htmlwidgets=1.6.4 + - r-httpuv=1.6.14 + - r-httr=1.4.7 + - r-httr2=1.0.0 + - r-ini=0.3.1 + - r-jquerylib=0.1.4 + - r-jsonlite=1.8.8 + - r-knitr=1.45 + - r-later=1.3.2 + - r-lifecycle=1.0.4 + - r-magrittr=2.0.3 + - r-memoise=2.0.1 + - r-mime=0.12 + - r-miniui=0.1.1.1 + - r-openssl=2.1.1 + - r-pillar=1.9.0 + - r-pkgbuild=1.4.2 + - r-pkgconfig=2.0.3 + - r-pkgdown=2.0.7 + - r-pkgload=1.3.4 + - r-praise=1.0.0 + - r-prettyunits=1.2.0 + - r-processx=3.8.3 + - r-profvis=0.3.8 + - r-promises=1.2.1 + - r-ps=1.7.6 + - r-purrr=1.0.2 + - r-r6=2.5.1 + - r-ragg=1.3.0 + - r-rappdirs=0.3.3 + - r-rcmdcheck=1.4.0 + - r-rcpp=1.0.12 + - r-rematch2=2.1.2 + - r-remotes=2.4.2.1 + - r-rlang=1.1.3 + - r-rmarkdown=2.25 + - r-roxygen2=7.3.1 + - r-rprojroot=2.0.4 + - r-rstudioapi=0.15.0 + - r-rversions=2.1.2 + - r-sass=0.4.8 + - r-sessioninfo=1.2.2 + - r-shiny=1.8.0 + - r-sourcetools=0.1.7_1 + - r-stringi=1.8.3 + - r-stringr=1.5.1 + - r-sys=3.4.2 + - r-systemfonts=1.0.5 + - r-testthat=3.2.1 + - r-textshaping=0.3.7 + - r-tibble=3.2.1 + - r-tinytex=0.49 + - r-urlchecker=1.0.1 + - r-usethis=2.2.3 + - r-utf8=1.2.4 + - r-vctrs=0.6.5 + - r-waldo=0.5.2 + - r-whisker=0.4.1 + - r-withr=3.0.0 + - r-xfun=0.42 + - r-xml2=1.3.6 + - r-xopen=1.0.0 + - r-xtable=1.8_4 + - r-yaml=2.3.8 + - r-zip=2.3.1 + - readline=8.2 + - sed=4.8 + - sysroot_linux-64=2.28 + - tk=8.6.13 + - tktable=2.10 + - xorg-kbproto=1.0.7 + - xorg-libice=1.1.1 + - xorg-libsm=1.2.4 + - xorg-libx11=1.8.7 + - xorg-libxau=1.0.11 + - xorg-libxdmcp=1.1.3 + - xorg-libxext=1.3.4 + - xorg-libxrender=0.9.11 + - xorg-libxt=1.3.0 + - xorg-renderproto=0.11.1 + - xorg-xextproto=7.3.0 + - xorg-xproto=7.0.31 + - xz=5.2.6 + - zlib=1.2.13 + - zstd=1.5.5 diff --git a/man/bins_to_bedgraph.Rd b/man/bins_to_bedgraph.Rd new file mode 100644 index 0000000..97c05ce --- /dev/null +++ b/man/bins_to_bedgraph.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bins_to_bedgraph.R +\name{bins_to_bedgraph} +\alias{bins_to_bedgraph} +\title{Bins to bed graph.} +\usage{ +bins_to_bedgraph(bin_df, min_value = 3, filename = "test.bed") +} +\arguments{ +\item{bin_df}{Data frame with bins.} + +\item{min_value}{Minimum value to retain the bin.} + +\item{filename}{Path to a local file on drive to save the resulting file.} +} +\value{ +full path to the file that was written +} +\description{ +This function will generate bed file. +} diff --git a/man/cache_output.Rd b/man/cache_output.Rd new file mode 100644 index 0000000..c772f23 --- /dev/null +++ b/man/cache_output.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cache_output.R +\name{cache_output} +\alias{cache_output} +\title{Cache output.} +\usage{ +cache_output( + result_df, + function_name, + clobber_mode = F, + get_existing = F, + function_params = list(region = "chr3:98300000-198022430", bin_size = 2000, seq_type + = "genome"), + additional_details = list(foreground = "DLBCL_FL_BL", background = "CLL_MM_MCL") +) +} +\arguments{ +\item{result_df}{TODO.} + +\item{function_name}{TODO.} + +\item{clobber_mode}{TODO.} + +\item{get_existing}{TODO.} + +\item{function_params}{TODO.} + +\item{additional_details}{TODO.} +} +\value{ +full path to the file that was written +} +\description{ +TODO. +} diff --git a/man/calculate_tmb.Rd b/man/calculate_tmb.Rd index 886fd4f..9dca146 100644 --- a/man/calculate_tmb.Rd +++ b/man/calculate_tmb.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/calculate_tmb.R \name{calculate_tmb} \alias{calculate_tmb} -\title{Return TMB counts.} +\title{Calculate tumour mutation burden.} \usage{ calculate_tmb( maf_data, @@ -50,7 +50,7 @@ calculate_tmb( maf1, regions_bed = grch37_ashm_regions ) -#' calculate_tmb( +calculate_tmb( maf1, regions_bed = grch37_ashm_regions, subset_to_nonSyn = FALSE diff --git a/man/check_config_value.Rd b/man/check_config_value.Rd new file mode 100644 index 0000000..2e94e10 --- /dev/null +++ b/man/check_config_value.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/check_config_value.R +\name{check_config_value} +\alias{check_config_value} +\title{Check Config Value.} +\usage{ +check_config_value(config_key) +} +\arguments{ +\item{config_key}{key from config, prefixed with config::get()} +} +\value{ +A string with the path to a file specified in the config or nothing +(if config key is NULL). +} +\description{ +Check the existence of a specific config key. +The function will notify the user and end the program if no such key exists. +} +\details{ +INTERNAL FUNCTION for checking the existence of a config value, +not meant for out-of-package usage. +} +\examples{ +check_config_value(config::get("resources")$blacklist$template) + +} diff --git a/man/check_file_details.Rd b/man/check_file_details.Rd new file mode 100644 index 0000000..66b959d --- /dev/null +++ b/man/check_file_details.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/check_file_details.R +\name{check_file_details} +\alias{check_file_details} +\title{Check file details} +\usage{ +check_file_details(relative_paths) +} +\arguments{ +\item{relative_paths}{Vector of relative paths.} +} +\value{ +Boolean +} +\description{ +When relative path to a file is given, this function will +automatically generate it's full path using the project_base config value +and check for existence of the file at the full path. Can operate on vector +of several relative paths. +} diff --git a/man/cnames.Rd b/man/cnames.Rd new file mode 100644 index 0000000..22e3e58 --- /dev/null +++ b/man/cnames.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{cnames} +\alias{cnames} +\title{Required columns in bedpe.} +\format{ +An object of class \code{character} of length 19. +} +\usage{ +cnames +} +\description{ +Global variable specifying what bedpe columns are absolutely +required. +} +\keyword{datasets} diff --git a/man/coding_class.Rd b/man/coding_class.Rd new file mode 100644 index 0000000..3e447c3 --- /dev/null +++ b/man/coding_class.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{coding_class} +\alias{coding_class} +\title{Coding+Silent variants classification.} +\format{ +An object of class \code{character} of length 12. +} +\usage{ +coding_class +} +\description{ +Same as coding_vc, but includes Silent variants to consider +them as coding. +} +\keyword{datasets} diff --git a/man/coding_vc.Rd b/man/coding_vc.Rd new file mode 100644 index 0000000..8e21a2e --- /dev/null +++ b/man/coding_vc.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{coding_vc} +\alias{coding_vc} +\title{Coding variants classification.} +\format{ +An object of class \code{character} of length 11. +} +\usage{ +coding_vc +} +\description{ +Vector of variant classification values considered as coding. +} +\keyword{datasets} diff --git a/man/colour_aliases.Rd b/man/colour_aliases.Rd new file mode 100644 index 0000000..94f4780 --- /dev/null +++ b/man/colour_aliases.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{colour_aliases} +\alias{colour_aliases} +\title{Color code aliases.} +\format{ +An object of class \code{list} of length 17. +} +\usage{ +colour_aliases +} +\description{ +A list of alias namings for color schemes. +} +\keyword{datasets} diff --git a/man/compare_coding_mutation_pattern.Rd b/man/compare_coding_mutation_pattern.Rd new file mode 100644 index 0000000..8edfbab --- /dev/null +++ b/man/compare_coding_mutation_pattern.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compare_coding_mutation_pattern.R +\name{compare_coding_mutation_pattern} +\alias{compare_coding_mutation_pattern} +\title{Compare pattern of coding mutations.} +\usage{ +compare_coding_mutation_pattern(maf_df1, maf_df2, gene) +} +\arguments{ +\item{maf_df1}{TODO.} + +\item{maf_df2}{TODO.} + +\item{gene}{TODO.} +} +\value{ +list +} +\description{ +TODO. +} diff --git a/man/copy_no_clobber.Rd b/man/copy_no_clobber.Rd new file mode 100644 index 0000000..af22267 --- /dev/null +++ b/man/copy_no_clobber.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/copy_no_clobber.R +\name{copy_no_clobber} +\alias{copy_no_clobber} +\title{Copy not clobber.} +\usage{ +copy_no_clobber(from_file, to_file, force = FALSE) +} +\arguments{ +\item{from_file}{TODO.} + +\item{to_file}{TODO.} + +\item{force}{TODO.} +} +\value{ +full path to the file that was written +} +\description{ +TODO. +} diff --git a/man/gene_mutation_tally.Rd b/man/gene_mutation_tally.Rd new file mode 100644 index 0000000..8d77b88 --- /dev/null +++ b/man/gene_mutation_tally.Rd @@ -0,0 +1,36 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/gene_mutation_tally.R +\name{gene_mutation_tally} +\alias{gene_mutation_tally} +\title{Tally coding mutations load.} +\usage{ +gene_mutation_tally( + maf_df, + these_samples_metadata, + these_genes, + grouping_variable = "cohort" +) +} +\arguments{ +\item{maf_df}{Data frame of simple somatic mutations in maf format. Required +parameter.} + +\item{these_samples_metadata}{Data frame with metadata. Must contain sample +identifiers in the \code{sample_id} column and column that will be used +to calulate the mutation load. All other columns are ignored. Required +parameter.} + +\item{these_genes}{Vector of hugo symbols for genes to be considered for the +tallying of mutations. Required parameter.} + +\item{grouping_variable}{Column in the metadata that will be used as grouping +variable. By default, the \code{cohort} is used.} +} +\value{ +data frame +} +\description{ +Calculate the number of coding mutations per grouping. Silent +variants are excluded from this calculation. The incoming maf may contain +non-coding variants, which will be excluded from tallying. +} diff --git a/man/get_template_wildcards.Rd b/man/get_template_wildcards.Rd new file mode 100644 index 0000000..96137d2 --- /dev/null +++ b/man/get_template_wildcards.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_template_wildcards.R +\name{get_template_wildcards} +\alias{get_template_wildcards} +\title{Get template wildcards.} +\usage{ +get_template_wildcards(parent_key, template_key) +} +\arguments{ +\item{parent_key}{TODO.} + +\item{template_key}{TODO.} +} +\value{ +list +} +\description{ +TODO. +} diff --git a/man/get_unmatched_normals.Rd b/man/get_unmatched_normals.Rd new file mode 100644 index 0000000..014d37c --- /dev/null +++ b/man/get_unmatched_normals.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_unmatched_normals.R +\name{get_unmatched_normals} +\alias{get_unmatched_normals} +\title{Get unmatched normals.} +\usage{ +get_unmatched_normals(seq_type_filter) +} +\arguments{ +\item{seq_type_filter}{Seq type key from config for which to return the +unmatched normals for.} +} +\value{ +data frame +} +\description{ +Helper function to get the unmatched normals from the main +config. +} diff --git a/man/grob_wildcards.Rd b/man/grob_wildcards.Rd new file mode 100644 index 0000000..4b3832e --- /dev/null +++ b/man/grob_wildcards.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/grob_wildcards.R +\name{grob_wildcards} +\alias{grob_wildcards} +\title{Glob wildcards.} +\usage{ +grob_wildcards(wildcarded_string) +} +\arguments{ +\item{wildcarded_string}{String containing wildcards inside the {} notations.} +} +\value{ +vector +} +\description{ +Helper function to extract wildcard values from a string. +} diff --git a/man/handle_metadata.Rd b/man/handle_metadata.Rd new file mode 100644 index 0000000..c1a422b --- /dev/null +++ b/man/handle_metadata.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/handle_metadata.R +\name{handle_metadata} +\alias{handle_metadata} +\title{Handle metadata from bundled packages.} +\usage{ +handle_metadata(this_seq_type = "genome") +} +\arguments{ +\item{this_seq_type}{The seq type of the samples to return with metadata.} +} +\value{ +data frame +} +\description{ +Will return the metadata from the GAMBLR.data package when it is +installed. Otherwise, will instruct user to call +GAMBLR.results::get_gambl_metadata(). +} +\details{ +INTERNAL FUNCTION for handling the metadata. +} diff --git a/man/maf_header.Rd b/man/maf_header.Rd new file mode 100644 index 0000000..940988b --- /dev/null +++ b/man/maf_header.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{maf_header} +\alias{maf_header} +\title{Column names in maf.} +\format{ +An object of class \code{numeric} of length 116. +} +\usage{ +maf_header +} +\description{ +A vector of column names and their order in standard maf file. +} +\keyword{datasets} diff --git a/man/rainfall_conv.Rd b/man/rainfall_conv.Rd new file mode 100644 index 0000000..21dd6e9 --- /dev/null +++ b/man/rainfall_conv.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{rainfall_conv} +\alias{rainfall_conv} +\title{Reverse mappings.} +\format{ +An object of class \code{character} of length 13. +} +\usage{ +rainfall_conv +} +\description{ +A vector of substitutions mappings for the rainfall plots. +} +\keyword{datasets} diff --git a/man/required_cols.Rd b/man/required_cols.Rd new file mode 100644 index 0000000..99da3cd --- /dev/null +++ b/man/required_cols.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{required_cols} +\alias{required_cols} +\title{Required columns in metadata.} +\format{ +An object of class \code{character} of length 7. +} +\usage{ +required_cols +} +\description{ +Global variable specifying what metadata columns are absolutely +required. +} +\keyword{datasets} diff --git a/man/review_hotspots.Rd b/man/review_hotspots.Rd deleted file mode 100644 index 3f25be9..0000000 --- a/man/review_hotspots.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/review_hotspots.R -\name{review_hotspots} -\alias{review_hotspots} -\title{Review Hotspots.} -\usage{ -review_hotspots( - annotated_maf, - genes_of_interest = c("FOXO1", "MYD88", "CREBBP", "NOTCH1", "NOTCH2", "CD79B", - "EZH2"), - genome_build = "grch37" -) -} -\arguments{ -\item{annotated_maf}{A data frame in MAF format that has hotspots annotated using the function annotate_hotspots().} - -\item{genes_of_interest}{A vector of genes for hotspot review. Currently only FOXO1, MYD88, CREBBP, NOTCH1, NOTCH2, CD79B and EZH2 are supported.} - -\item{genome_build}{Reference genome build for the coordinates in the MAF file. The default is grch37 genome build.} -} -\value{ -The same data frame (as given to the \code{annotated_maf} parameter) with the reviewed column "hot_spot". -} -\description{ -Annotate MAF-like data frome with a hot_spot column indicating recurrent mutations. -} -\details{ -This function takes an annotated MAF (with \link[GAMBLR.results:annotate_hotspots]{GAMBLR.results::annotate_hotspots}) and adds a new column, "hot_spot", to the same data frame. -Genes for hotspot review are supplied with the \code{genes_of_interest} parameter. -Currently only a few sets of genes are supported, see parameter description for more information and limitations. -The desired genome build can be specified with \code{genome_build} parameter. Should be the same as the incoming MAF. -} -\examples{ -hot_ssms = review_hotspots(annotate_hotspots(get_coding_ssm(this_seq_type = "genome")), - genes_of_interest = c("CREBBP")) - -} diff --git a/man/sanity_check_metadata.Rd b/man/sanity_check_metadata.Rd new file mode 100644 index 0000000..f5de634 --- /dev/null +++ b/man/sanity_check_metadata.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sanity_check_metadata.R +\name{sanity_check_metadata} +\alias{sanity_check_metadata} +\title{Sanity Check Metadata.} +\usage{ +sanity_check_metadata() +} +\value{ +A table. +} +\description{ +Function that performs sanity checks on metadata. +} +\details{ +Helper function for sanity checking GAMBL metadata. +} +\examples{ +sane_meta_data = sanity_check_metadata() + +} diff --git a/man/socketWrite.Rd b/man/socketWrite.Rd new file mode 100644 index 0000000..917302d --- /dev/null +++ b/man/socketWrite.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/socketWrite.R +\name{socketWrite} +\alias{socketWrite} +\title{Socket write.} +\usage{ +socketWrite(sock, string) +} +\arguments{ +\item{sock}{TODO.} + +\item{string}{TODO.} +} +\value{ +someting +} +\description{ +TODO. +} diff --git a/man/standardize_chr_prefix.Rd b/man/standardize_chr_prefix.Rd new file mode 100644 index 0000000..f461fb1 --- /dev/null +++ b/man/standardize_chr_prefix.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/standardize_chr_prefix.R +\name{standardize_chr_prefix} +\alias{standardize_chr_prefix} +\title{Standardize Chromosome Prefix.} +\usage{ +standardize_chr_prefix(incoming_vector, projection) +} +\arguments{ +\item{incoming_vector}{Input vector of any length with chromosome names.} + +\item{projection}{Projection to which chr prefix should be standardized.} +} +\value{ +A vector of chromosome names with prefix standardized to projection +} +\description{ +Standardize the chr prefix in a vector of chromosome names based +on projection. +} +\details{ +INTERNAL FUNCTION, not meant for out-of-package use. +} +\examples{ +these_chrs = c(8, "13", "chr4", "chrY") + +standardize_chr_prefix(incoming_vector = these_chrs, + projection = "hg38") + +} diff --git a/man/subset_cnstates.Rd b/man/subset_cnstates.Rd new file mode 100644 index 0000000..323e1eb --- /dev/null +++ b/man/subset_cnstates.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/subset_cnstates.R +\name{subset_cnstates} +\alias{subset_cnstates} +\title{Subset CN States.} +\usage{ +subset_cnstates(cn_segments, include_2 = FALSE, samplen) +} +\arguments{ +\item{cn_segments}{DF with copy number segments, usually retrieved from get_sample_cn_segments.} + +\item{include_2}{Optional parameter for including or omit CN state == 2. Default is FALSE.} + +\item{samplen}{Numeric value that annotates the sample order.} +} +\value{ +Nothing. +} +\description{ +Get the available CN states in the incoming data frame. +} +\details{ +For sub-setting copy number information based on segments available in cn data +} +\examples{ +cn_states = get_sample_cn_segments(these_sample_ids = c("02-13135T", + "SU-DHL-4"), + streamlined = FALSE) + +subset_cnstates(cn_segments = cn_states, + samplen = 1) + +} diff --git a/man/trim_scale_expression.Rd b/man/trim_scale_expression.Rd new file mode 100644 index 0000000..3590619 --- /dev/null +++ b/man/trim_scale_expression.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/trim_scale_expression.R +\name{trim_scale_expression} +\alias{trim_scale_expression} +\title{Trim Scale Expressions.} +\usage{ +trim_scale_expression(x) +} +\arguments{ +\item{x}{Numeric value (of expression) to be trimmed.} +} +\value{ +Numeric value. +} +\description{ +INTERNAL HELPER FUNCTION called by prettyOncoplot, not meant for +out-of-package usage. +} +\details{ +INTERNAL FUNCTION called by prettyOncoplot, not meant for +out-of-package usage. +} +\examples{ +trimmed = trim_scale_expression(2) + +} diff --git a/man/vc_nonSynonymous.Rd b/man/vc_nonSynonymous.Rd new file mode 100644 index 0000000..884f4fe --- /dev/null +++ b/man/vc_nonSynonymous.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers-vars.R +\docType{data} +\name{vc_nonSynonymous} +\alias{vc_nonSynonymous} +\title{Non-synonymous variants classification.} +\format{ +An object of class \code{character} of length 9. +} +\usage{ +vc_nonSynonymous +} +\description{ +Vector of variant classification values considered as +non-synonymous. +} +\keyword{datasets} diff --git a/man/web_initialize_gambl_site.Rd b/man/web_initialize_gambl_site.Rd new file mode 100644 index 0000000..66a8b9b --- /dev/null +++ b/man/web_initialize_gambl_site.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/web_initialize_gambl_site.R +\name{web_initialize_gambl_site} +\alias{web_initialize_gambl_site} +\title{Web Initialize GAMBL Site.} +\usage{ +web_initialize_gambl_site( + site_base_name, + base_directory = "/home/rmorin/", + my_name = "Ryan Morin", + my_gitlab_email = "rdmorin@sfu.ca" +) +} +\arguments{ +\item{site_base_name}{Base name for site.} + +\item{base_directory}{Path to base directory.} + +\item{my_name}{My name.} + +\item{my_gitlab_email}{The email used for gitlab.} +} +\description{ +Set up a fresh instance of a website to host on gitlab. +}