-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of bundled data through designated separate repo #150
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
a55b8a9
cleanup: drop bundled ashm regions
Kdreval d086a1b
new feature: introduce config key for data version tracking
Kdreval 7315f5c
new feature: auto load bundled data of particular version
Kdreval 1c3c141
bug fix: refer to the most recent version
Kdreval 72ca772
cleanup: add documentation
Kdreval 2e23d10
cleanup: update documentation for the new function
Kdreval 7fc02da
cleanup: add examples for new function
Kdreval 1b28d15
merge master and resolve conflicts
Kdreval 2769b34
cleanup: remove dependance on internet to check for latest version of…
Kdreval 62e6d10
cleanup: updating NAMESPACE
Kdreval 62cb770
Merge branch 'master' into kdreval-data_helper
Kdreval 342ebd6
cleanup: merge master and resolve conflicts
Kdreval ff52877
new functionality: switching lymphoma genes to GAMBLR.data helper
Kdreval 173fbc4
add fix from Ryan for prettyOncopot
Kdreval acd8df5
cleanup: update documentation
Kdreval 4a90f28
cleanup: add GAMBLR.data as dependency
Kdreval 57e28c6
cleanup: standardize the config key check
Kdreval 81f8a06
review comments
Kdreval ed74f3c
get rid of data.table dependency when calculating PGA
Kdreval f21503d
init collating PGA results
Kdreval c976122
add PGA collating to main function
Kdreval 50866a8
bug fix: mistake in calculate_pga
Kdreval 46a6aec
new functionality: add capture support to
Kdreval 76a48fa
new functionality: add capture support to get_cn_segments
Kdreval 16fb2e1
new functionality: add capture support to get_cn_states
Kdreval 9586403
new functionality: add capture support throughout CNV functions
Kdreval 7672e8d
new functionality: remove capture stop in collate_pga
Kdreval f566779
cleanup: update documentation
Kdreval e4b60b4
cleanup: merge master and resolve conflicts
Kdreval 76ec542
bugfix: remove newline in export statement messing up with NAMESPACE
Kdreval 9ac4959
cleanupadd capture support to plotting functions
Kdreval 3f5eb75
cleanup: add more capture support
Kdreval 02aea8b
cleanup: add more documentation
Kdreval db2e632
cleabug fix: correct deliminators in corrupted bed file
Kdreval File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Helper functions not for export | ||
|
||
#' @title Check the version of the data to load. | ||
#' | ||
#' @description Helper function to determine whether the user is requesting the latest version | ||
#' of the bundled data or wants to access one of the earlier veresions. | ||
#' | ||
#' @param mode Determines which data to handle. Defaults to somatic_hypermutation_locations. Will grow with more options as more data is version tracked. | ||
#' @param this_genome_build The genome build of the data if coordinate-based. Accepts grch37 (default) or hg38. | ||
#' | ||
#' @noRd | ||
#' | ||
#' @return data frame | ||
#' @import config dplyr readr GAMBLR.data | ||
#' | ||
#' @examples | ||
#' determine_version() | ||
#' determine_version(this_genome_build = "hg38") | ||
#' | ||
determine_version <- function( | ||
mode = "somatic_hypermutation_locations", | ||
this_genome_build = "grch37" | ||
){ | ||
# Determine the latest version of the data | ||
# Get absolute paths to bundled files in GAMBLR.data | ||
all_files <- system.file( | ||
"extdata", | ||
package = "GAMBLR.data" | ||
) %>% | ||
list.files( | ||
recursive = TRUE, | ||
full.names = TRUE | ||
) | ||
|
||
# Extract version from the path | ||
all_files <- gsub( | ||
".*extdata/", | ||
"", | ||
all_files | ||
) | ||
all_files <- all_files[grepl(mode, all_files)] | ||
|
||
# Determine the highst version | ||
versions <- gsub(".*[/]([^/]+)[/].*", "\\1", all_files) | ||
versions <- versions[grep('[0-9]+', versions)] | ||
versions <- sort( | ||
numeric_version( | ||
versions | ||
) | ||
) | ||
|
||
latest_version <- max(versions) | ||
|
||
# Which version did the user requested in config? | ||
requested_version <- check_config_value( | ||
config::get("bundled_data_versions")[[mode]] | ||
) | ||
# Convert to numeric value if it is a string | ||
if(requested_version == "_latest"){ | ||
requested_version = latest_version | ||
} | ||
|
||
# UCSC-ize the genome build format of GAMBLR | ||
if(this_genome_build == "grch37"){ | ||
this_genome_build = "GRCh37" | ||
}else{ | ||
this_genome_build = "GRCh38" | ||
} | ||
|
||
# Load the user-specified version of the data | ||
this_object <- paste0( | ||
mode, | ||
"_", | ||
this_genome_build, | ||
"_v", | ||
requested_version | ||
) | ||
|
||
this_data <- eval( | ||
parse( | ||
text = paste0( | ||
"GAMBLR.data::", | ||
this_object) | ||
) | ||
) | ||
|
||
return(this_data) | ||
|
||
} | ||
|
||
|
||
grch37_ashm_regions <- determine_version( | ||
mode = "somatic_hypermutation_locations", | ||
this_genome_build = "grch37" | ||
) | ||
|
||
hg38_ashm_regions <- determine_version( | ||
mode = "somatic_hypermutation_locations", | ||
this_genome_build = "hg38" | ||
) | ||
|
||
lymphoma_genes <- GAMBLR.data::get_genes( | ||
entities = c("BL", "MCL", "DLBCL"), | ||
version = check_config_value( | ||
config::get("bundled_data_versions")[["lymphoma_genes"]] | ||
), | ||
gene_format = "data.frame" | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have gone over all the GAMBLR helper functions on my branch. This was done as a step in preparing the documentation for building a site from the source code with
build_site
frompkgdown
. This function takes all.Rd
files that live in the man folder and generates function-specific HTML files. This is not something we want for helper functions (since they are not exported in NAMESPACE).The fix for this is to add
@noRd
in the documentation for such functions. This prevents the.Rd
file from being generated.I think you should also specify this for this function to keep things consistent. Let me know if this doesn't make sense, or if you need me to further clarify.
Thanks,