diff --git a/NAMESPACE b/NAMESPACE index 0d35c9c..1d1694d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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")) diff --git a/R/build_browser_hub.R b/R/build_browser_hub.R index 51c7fef..78221e7 100644 --- a/R/build_browser_hub.R +++ b/R/build_browser_hub.R @@ -71,7 +71,7 @@ #' #' @return Nothing. #' -#' @import dplyr GAMBLR.helpers +#' @import dplyr #' @export #' #' @examples @@ -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\"." = @@ -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)) } @@ -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]])) @@ -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"){ @@ -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){ diff --git a/R/gene_to_region.R b/R/gene_to_region.R index 72c06b5..45cb28a 100644 --- a/R/gene_to_region.R +++ b/R/gene_to_region.R @@ -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")) @@ -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 diff --git a/R/liftover.R b/R/liftover.R index 77c3bac..95455bd 100644 --- a/R/liftover.R +++ b/R/liftover.R @@ -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 diff --git a/man/annotate_sv.Rd b/man/annotate_sv.Rd index 3c6adc3..7f58b09 100644 --- a/man/annotate_sv.Rd +++ b/man/annotate_sv.Rd @@ -10,10 +10,10 @@ annotate_sv( with_chr_prefix = FALSE, collapse_redundant = FALSE, return_as = "bedpe", - blacklist = c(60565248, 30303126, 187728894, 101357565, 101359747, 161734970, - 69400840, 65217851, 187728889, 187728888, 187728892, 187728893, 188305164, 72551424, - 72551425, 72551554, 72551555, 72551558, 72551559, 72551562, 189255425, 189255426, - 189255461, 189255462), + blacklist = c(60565248, 30303126, 187728894, 101357565, 101359747, 161734970, 69400840, + 65217851, 187728889, 187728888, 187728892, 187728893, 188305164, 72551424, 72551425, + 72551554, 72551555, 72551558, 72551559, 72551562, 189255425, 189255426, 189255461, + 189255462), genome_build = "grch37", priority_to_be_oncogene = c("MYC", "BCL6") ) diff --git a/man/build_browser_hub.Rd b/man/build_browser_hub.Rd index eb72d20..557fa50 100644 --- a/man/build_browser_hub.Rd +++ b/man/build_browser_hub.Rd @@ -20,7 +20,8 @@ build_browser_hub( contact_email, visibility = "squish", bigDataUrl_base = "https://github.com/morinlab/LLMPP/blob/main", - bedToBigBed_path + bedToBigBed_path, + verbose = FALSE ) } \arguments{ diff --git a/man/gene_to_region.Rd b/man/gene_to_region.Rd index 69600b2..47daf71 100644 --- a/man/gene_to_region.Rd +++ b/man/gene_to_region.Rd @@ -9,7 +9,8 @@ gene_to_region( ensembl_id, projection = "grch37", return_as = "region", - sort_regions = TRUE + sort_regions = TRUE, + pad_length = 0 ) } \arguments{ diff --git a/man/make_igv_snapshot.Rd b/man/make_igv_snapshot.Rd index 9822e9d..d84a059 100644 --- a/man/make_igv_snapshot.Rd +++ b/man/make_igv_snapshot.Rd @@ -78,11 +78,15 @@ or the user can directly supply the chromosome, start and end coordinates with t For more information and examples, refer to the function examples and parameter descriptions. IMPORTANT: you must be running IGV on the host that is running R and you need to have it listening on a port. The simplest scenario is to run this command on a terminal (if using a Mac), -assuming you are using R on gphost10 and you have a ssh config that routes gp10 to that host\preformatted{ssh -X gp10 -} +assuming you are using R on gphost10 and you have a ssh config that routes gp10 to that host -then launch IGV (e.e. from a conda installation):\preformatted{conda activate igv; igv & -} +\if{html}{\out{
}}\preformatted{ssh -X gp10 +}\if{html}{\out{
}} + +then launch IGV (e.e. from a conda installation): + +\if{html}{\out{
}}\preformatted{conda activate igv; igv & +}\if{html}{\out{
}} } \examples{ \dontrun{ diff --git a/man/view_mutation_igv.Rd b/man/view_mutation_igv.Rd index 5ef7055..e5690d2 100644 --- a/man/view_mutation_igv.Rd +++ b/man/view_mutation_igv.Rd @@ -42,11 +42,15 @@ Load bam(s) and view the context around a mutation Load bam(s) and view the context around a mutation. IMPORTANT: you must be running IGV on the host that is running R and you need to have it listening on a port. The simplest scenario is to run this command on a terminal (if using a Mac), -assuming you are using R on gphost10 and you have a ssh config that routes gp10 to that host\preformatted{ssh -X gp10 -} +assuming you are using R on gphost10 and you have a ssh config that routes gp10 to that host -then launch IGV (e.e. from a conda installation):\preformatted{conda activate igv; igv & -} +\if{html}{\out{
}}\preformatted{ssh -X gp10 +}\if{html}{\out{
}} + +then launch IGV (e.e. from a conda installation): + +\if{html}{\out{
}}\preformatted{conda activate igv; igv & +}\if{html}{\out{
}} Then obtain a socket and run this function as per the example. }