Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugging features #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export(sv_to_bedpe_file)
export(sv_to_custom_track)
export(tidy_lymphgen)
export(view_mutation_igv)
import(GAMBLR.data)
import(GAMBLR.helpers)
import(GenomicRanges, except = c("start", "end", "merge", "shift", "union", "intersect", "setdiff", "reduce", "trim"))
import(S4Vectors, except = c("merge", "second", "first", "union", "intersect", "setdiff", "setequal", "rename", "expand", "head", "tail", "end", "start"))
Expand Down
30 changes: 25 additions & 5 deletions R/build_browser_hub.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#'
#' @return Nothing.
#'
#' @import dplyr GAMBLR.helpers
#' @import dplyr
#' @export
#'
#' @examples
Expand Down Expand Up @@ -113,7 +113,8 @@ build_browser_hub = function(maf_data,
contact_email,
visibility = "squish",
bigDataUrl_base = "https://github.com/morinlab/LLMPP/blob/main",
bedToBigBed_path){
bedToBigBed_path,
verbose=FALSE){

# check some provided parameter
stopifnot("`these_seq_types` must be one or more of \"genome\" or \"capture\"." =
Expand All @@ -134,6 +135,10 @@ build_browser_hub = function(maf_data,
}
)
}else{
if(dir.exists(bedToBigBed_path)){
#directory was provided, add expected binary name
bedToBigBed_path = paste0(bedToBigBed_path,"/bedToBigBed")
}
stopifnot("`bedToBigBed_path` points to a non-existent file." =
file.exists(bedToBigBed_path))
}
Expand All @@ -147,7 +152,10 @@ build_browser_hub = function(maf_data,
this_seq_type = these_seq_types_i)
}) %>%
suppressMessages

if(verbose){
group_by(these_samples_metadata$genome,seq_type,pathology) %>% tally() %>% print()
group_by(these_samples_metadata$capture,seq_type,pathology) %>% tally() %>% print()
}
# check provided splitColumnName parameter
stopifnot("`splitColumnName` must be a column name contained in the metadata." =
splitColumnName %in% names(these_samples_metadata[[1]]))
Expand Down Expand Up @@ -188,6 +196,9 @@ build_browser_hub = function(maf_data,
regions_bed = dplyr::select(regions_bed, 1,2,3) %>%
arrange( .[[1]], .[[2]] )
temp_bed = tempfile(pattern = "regionsBed_", fileext = ".bed")
if(verbose){
print(paste("writing temporary file:",temp_bed))
}
write.table(regions_bed, temp_bed, quote = FALSE, sep = "\t", row.names = FALSE,
col.names = FALSE)
if(projection == "grch37"){
Expand All @@ -213,13 +224,22 @@ build_browser_hub = function(maf_data,
# get maf data from the specified regions and metadata/samples (for each seq type)
if(missing(maf_data)){
maf_data = mapply(function(these_seq_types_i, these_samples_metadata_i){
get_ssm_by_regions(regions_bed = regions_bed,
if(verbose){
get_ssm_by_regions(regions_bed = regions_bed,
this_seq_type = these_seq_types_i,
these_samples_metadata = these_samples_metadata_i,
projection = projection,
streamlined = FALSE,
basic_columns = TRUE)
}else{
get_ssm_by_regions(regions_bed = regions_bed,
this_seq_type = these_seq_types_i,
these_samples_metadata = these_samples_metadata_i,
projection = projection,
streamlined = FALSE,
basic_columns = TRUE) %>%
suppressMessages
suppressMessages
}
}, these_seq_types, these_samples_metadata, SIMPLIFY = FALSE)
}else{
maf_data = mapply(function(these_seq_types_i, these_samples_metadata_i){
Expand Down
5 changes: 3 additions & 2 deletions R/gene_to_region.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ gene_to_region = function(gene_symbol,
ensembl_id,
projection = "grch37",
return_as = "region",
sort_regions = TRUE){
sort_regions = TRUE,
pad_length = 0){

stopifnot('`projection` parameter must be "grch37" or "hg38"' = projection %in% c("grch37", "hg38"))
stopifnot('`return_as` parameter must be "region", "bed" or "df"' = return_as %in% c("region", "bed", "df"))
Expand Down Expand Up @@ -64,7 +65,7 @@ gene_to_region = function(gene_symbol,
region = dplyr::select(gene_coordinates, chromosome, start, end, gene_name, hugo_symbol, ensembl_gene_id) %>%
as.data.frame() %>%
dplyr::filter(chromosome %in% chr_select)

region = mutate(region, start = start - pad_length, end = end + pad_length)
if(sort_regions){
if(projection == "grch37"){
chrm_num = region$chromosome
Expand Down
2 changes: 1 addition & 1 deletion R/liftover.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#' @rawNamespace import(S4Vectors, except = c("merge", "second", "first", "union", "intersect", "setdiff", "setequal", "rename", "expand", "head", "tail", "end", "start"))
#' @rawNamespace import(GenomicRanges, except = c("start", "end", "merge", "shift", "union", "intersect", "setdiff", "reduce", "trim"))
#' @rawNamespace import(rtracklayer, except = c("start", "end"))
#' @import dplyr tidyr readr GAMBLR.data
#' @import dplyr tidyr readr
#' @export
#'
#' @examples
Expand Down
8 changes: 4 additions & 4 deletions man/annotate_sv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/build_browser_hub.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/gene_to_region.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/make_igv_snapshot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/view_mutation_igv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading