Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4c37723
transitioning to sqlite instead of Rda
rdmorin Jul 11, 2026
da83baf
improvements and efficiencies
rdmorin Jul 11, 2026
dc3c3e9
Document gambl_reference.db / gambl_mutations.db table schemas
rdmorin Jul 11, 2026
60243d3
Use get_ssm_by_regions + tabix -R for gene-restricted SSM pulls
rdmorin Jul 11, 2026
826eefc
Scope published-study SV bundling to local sample_data$meta
rdmorin Jul 11, 2026
ca04099
Add compare_bedpe.R diagnostic for bedpe row-count drift
rdmorin Jul 11, 2026
57acefb
Generalize bedpe comparison to snv/cnv/sv event-level diffing
rdmorin Jul 12, 2026
6f879d0
Add lost-event example logs to compare_bundle_changes.R
rdmorin Jul 12, 2026
b9c7756
Disable min_corrected_cov QC filter for bundle assembly
rdmorin Jul 12, 2026
f0886b9
Restore Hugo_Symbol filter + pad gene regions for tabix -R SSM pulls
rdmorin Jul 12, 2026
33b563b
Widen gene-region padding to 10kb; add n_retained to bundle diagnostic
rdmorin Jul 12, 2026
80b9ee9
remove pointless code
rdmorin Jul 12, 2026
fbb235a
Expand all_lymphoma_genes to include known gene aliases
rdmorin Jul 13, 2026
c43c1a2
compare_bundle_changes.R: tag SNV rows with their source table
rdmorin Jul 13, 2026
2866fe4
Drop idx_maf_gene: no query path filters maf by Hugo_Symbol
rdmorin Jul 13, 2026
1a8cfb6
Replace inline Study tagging with a sample_study join table; dedup SL…
rdmorin Jul 13, 2026
017d3db
Fix type mismatch in sample_study bind_rows (study_id chr vs dbl)
rdmorin Jul 13, 2026
6df5bd9
Add PR verification notes for the sample_study refactor
rdmorin Jul 13, 2026
1647e5a
Fix sample_study.study_id: use sample_id not patient_id (Thomas/Dreva…
rdmorin Jul 13, 2026
d3f5591
Record Reddy this_seq_type functional-check finding in verification n…
rdmorin Jul 13, 2026
efbe48a
Fix Arthur cohort: Case ID join type-safety, drop tumor-suffix exclusion
rdmorin Jul 13, 2026
fd2f56f
Add relabel_to_sample_id(): fix Publication-pipeline Tumor_Sample_Bar…
rdmorin Jul 13, 2026
b693b1d
compare_bundle_changes.R: exclude old Arthur strelka rows from SNV diff
rdmorin Jul 13, 2026
ab70619
Restore separate genome-wide SNV pull for cell lines
rdmorin Jul 13, 2026
69b51cc
Record cell-line fix confirmation and another bonus coverage gain
rdmorin Jul 14, 2026
c88be13
Fix Phase 4/5: never pass sample_data$meta directly to GAMBLR.results…
rdmorin Jul 14, 2026
45afd43
Record convergence: sample_data$meta fix confirmed, refactor stable
rdmorin Jul 14, 2026
9b71e2d
fix: proteinpainter-compat block filtered stale sample_data on cohort…
rdmorin Jul 14, 2026
18f42a9
add real-time diagnostics to assemble_bundled_data.R checkpoints
rdmorin Jul 14, 2026
4f849cd
fix: diag_summary_maf rename collided with existing Tumor_Sample_Barc…
rdmorin Jul 14, 2026
841716d
add variant_pipeline join table; fix silent SLMS-3->Publication relab…
rdmorin Jul 14, 2026
1b3988a
capture GAMBLR.data:::coding_class once at script start, not per pull…
rdmorin Jul 14, 2026
17a167b
normalize Pipeline to lowercase at write time; add variant-key indexes
rdmorin Jul 14, 2026
fea2fdf
consolidate get_ssm_from_db() region queries into a single query
rdmorin Jul 14, 2026
ede521b
add missing bedpe indexes for genome_build and breakpoint positions
rdmorin Jul 14, 2026
fde31b6
replace variant_pipeline's 5-column natural key with a surrogate muta…
rdmorin Jul 14, 2026
cb3d57a
document performance investigation and fixes in PR notes
rdmorin Jul 15, 2026
86d787b
correct assign_cn_to_ssm performance characterization in PR notes
rdmorin Jul 15, 2026
bd89fea
proteinpainter-compat block: use local sample_data\$meta, not installed
rdmorin Jul 15, 2026
2dc5f11
add automatic GitHub-release-based download for gambl_mutations.db
rdmorin Jul 15, 2026
075812e
release_mutations_db.R: refuse to run with an uncommitted version bump
rdmorin Jul 15, 2026
5871b8e
add data-raw/RELEASING.md: maintainer-only gambl_mutations.db release…
rdmorin Jul 15, 2026
e5df74c
missing docs
rdmorin Jul 16, 2026
4ef469f
Merge branch 'rmorin-dev' of github.com:morinlab/GAMBLR.data into rmo…
rdmorin Jul 16, 2026
0b4ecdd
Bump version to 1.4 for variant_pipeline/mutation_id schema and auto-…
rdmorin Jul 16, 2026
e69f340
Retry pb_upload() after pb_new_release() to handle GitHub API lag
rdmorin Jul 16, 2026
22ba4fd
CI: pin r-rsqlite via conda to avoid broken from-source compile
rdmorin Jul 16, 2026
3479aad
CI: pin r-rsqlite to 2.4.1, not 2.4.3 (requires libgcc>=14)
rdmorin Jul 16, 2026
bc21b22
CI: pin r-rsqlite to exact build 2.3.7=r43h0d4f4ea_0
rdmorin Jul 16, 2026
162c644
Merge branch 'rmorin-dev' of github.com:morinlab/GAMBLR.data into rmo…
rdmorin Jul 27, 2026
767fe8f
Widen assemble_bundled_data.R's live metadata rejoin; retire sample_m…
rdmorin Jul 27, 2026
47dee08
Restrict public sample_meta to an explicit column whitelist
rdmorin Jul 27, 2026
4e35361
Add temporary diagnostic checkpoints to trace sample_meta column count
rdmorin Jul 27, 2026
1885052
Remove temporary [DIAG-COLS] diagnostic checkpoints
rdmorin Jul 28, 2026
bef89c0
Carry maf_seq_type through the build pipeline into gambl_mutations.db
rdmorin Jul 28, 2026
7736205
Fix: selected_columns shouldn't inherit maf_seq_type from maf_columns…
rdmorin Jul 28, 2026
ee39c9a
get_ssm_from_db(): dedup maf+ashm when include_ashm=TRUE
rdmorin Jul 29, 2026
be621eb
Merge maf/ashm into one table; remove get_ssm_from_db()'s include_ashm
rdmorin Jul 29, 2026
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: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
^\.Rproj\.user$
^LICENSE\.md$
^data-raw$
^gambl_mutations\.db$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.Rproj.user
gambl_mutations.db
9 changes: 7 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GAMBLR.data
Title: Collection of Curated Data for Genomic Analysis of Mature B-cell Lymphomas in R
Version: 1.3
Version: 1.5
Authors@R:
c(
person(given = "Ryan",
Expand All @@ -25,15 +25,20 @@ Description: The package contains manually curated data for the genomic Analysis
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
Depends:
R (>= 3.5)
LazyData: true
Imports:
DBI,
dbplyr,
dplyr,
ggplot2,
rlang,
RSQLite,
tidyr
LazyDataCompression: xz
Suggests:
piggyback,
testthat (>= 3.0.0)
Config/testthat/edition: 3
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Generated by roxygen2: do not edit by hand

export(download_gambl_mutations_db)
export(gambl_mutations_db)
export(gambl_reference_db)
export(get_cn_segments_from_db)
export(get_genes)
export(get_ssm_from_db)
export(get_sv_from_db)
import(dplyr)
import(ggplot2)
import(tidyr)
13 changes: 7 additions & 6 deletions R/data-vars.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ if (getRversion() >= "2.15.1") {
"SCORE", "START_A", "START_B", "Start_Position", "Start_Position.x",
"Tumor_Sample_Barcode", "VAF_tumour", "Variant_Classification",
"bin", "category", "chrom", "cohort", "colour", "curated", "end",
"ensembl_gene_id", "gambl_metadata", "gene", "genome_build",
"ensembl_gene_id", "gene", "genome_build",
"grch37_ashm_regions", "group", "head", "hg38_ashm_regions",
"hot_spot", "hotspot_regions_grch37", "hotspot_regions_hg38",
"is_alias", "log.ratio", "mutated", "mutation_count", "n_mut",
"name", "pair_status", "pathology", "patient_id", "region",
"row_id", "sample_id", "seq_type", "start", "t_alt_count",
"tumour_sample_id", "window_end", "window_start"
"hot_spot", "hotspot_regions_grch37", "hotspot_regions_hg38",
"is_alias", "log.ratio", "maf_seq_type", "mutated", "mutation_count", "n_mut",
"name", "pair_status", "pathology", "patient_id", "region",
"row_id", "sample_id", "seq_type", "start", "t_alt_count",
"tumour_sample_id", "window_end", "window_start",
"study", "Pipeline", "elem"
))
}
39 changes: 0 additions & 39 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -933,45 +933,6 @@
"somatic_hypermutation_locations_GRCh38_v_latest"


#' GAMBL Metadata
#'
#' A data frame with metadata for a collection of GAMBL samples.
#'
#' @format ## `gambl_metadata`
#' A data frame with 4785 rows and 27 columns
#' \describe{
#' \item{sample_id}{Sample identifier.}
#' \item{patient_id}{Patient identifier.}
#' \item{pathology}{Pathology.}
#' \item{seq_type}{Sample sequencing type.}
#' \item{genome_build}{Genome build the sample coordinates are in reference to.}
#' \item{pairing_status}{Matched or unmatched.}
#' \item{Tumor_Sample_Barcode}{Sample ID in another column, needed for certain functions.}
#' \item{age_group}{Sample age group.}
#' \item{compression}{The compression available for a particular sample.}
#' \item{bam_available}{Boolean.}
#' \item{pathology_rank}{Pathology rank.}
#' \item{cohort}{Sample cohort}
#' \item{COO_consensus}{COO consensus.}
#' \item{DHITsig_consensus}{DHIT signature consensus.}
#' \item{EBV_status_inf}{EBV status.}
#' \item{ffpe_or_frozen}{FFPE or frozen.}
#' \item{fl_grade}{FL grade.}
#' \item{hiv_status}{Sample HIV status.}
#' \item{lymphgen}{Lymphgen.}
#' \item{lymphgen_cnv_noA53}{Lymphgen with CNV no A53.}
#' \item{lymphgen_no_cnv}{Lymphgen no CNV.}
#' \item{lymphgen_with_cnv}{Lymphgen with CNV}
#' \item{lymphgen_wright}{Lymphgen Wright.}
#' \item{molecular_BL}{Molecualr BL.}
#' \item{normal_sample_id}{Normal sample ID}
#' \item{sex}{Female or Male}
#' \item{time_point}{Smaple timepoint.}
#' }
#' @keywords internal
"gambl_metadata"


#' Mirage Metrics
#'
#' A data frame with Quality Control metrics for a collection of GAMBL samples.
Expand Down
225 changes: 76 additions & 149 deletions R/data_comp.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,197 +3,124 @@
#'
#' @description Retrieve gene names from bundled lymphoma gene lists.
#'
#' @details Complete lists of genes described as significantly mutated in large
#' lymphoma studies have been curated and provided with this package.
#' @details Gene lists are read from the bundled normalized reference database
#' (`inst/extdata/gambl_reference.db`), which is built from the LLMPP curated
#' lists. Confidence tier and data version are columns in that database, so the
#' previous per-entity, per-version `.rda` objects are no longer required.
#'
#' @param entities Optional vector specifying one or more lymphoma entities
#' e.g. MCL, DLBCL, BL.
#' @param curated_only Specify FALSE to retrieve all genes or leave default
#' for the curated subset.
#' @param curated_only When TRUE (default) return the curated set (Tier 1 and
#' Tier 2) and drop retired Tier 3 genes. Set FALSE to include all tiers.
#' Ignored when `tier` is supplied.
#' @param tier Optional integer vector of confidence tiers to keep, e.g.
#' `tier = 1` for high-confidence genes only, or `tier = c(1, 2)`. When
#' supplied it takes precedence over `curated_only`.
#' @param gene_format Specify what to return as output. Can be one of:
#' * "symbol" (the default): list of gene symbols
#' * "ensembl": list of ENSEMBLE IDs
#' * "data.frame": data frame with column Gene and per-entity gene status
#' @param version Specify which version to return. Currently supported versions
#' are 0.0 (legacy version from original GAMBLR), 0.1, and _latest. The
#' latter will always point to the highest numeric version of the genes.
#' * "ensembl": list of Ensembl IDs
#' * "data.frame": one row per gene with a `<ENTITY>_Tier` column per
#' requested entity (the gene's tier there, or NA if absent). Filter
#' these columns to focus on tiers, e.g.
#' `dplyr::filter(df, DLBCL_Tier == 1, FL_Tier == 1) |> dplyr::pull(Gene)`.
#' @param version Data version to return. Defaults to "_latest", the current
#' LLMPP-sourced version in the reference database. Legacy numeric versions
#' (0.0, 0.1) are no longer bundled.
#'
#' @return A character vector of gene symbol or Ensembl IDs or a data frame.
#' @return A character vector of gene symbols or Ensembl IDs, or a data frame.
#'
#' @import dplyr tidyr
#'
#' @export
#'
#' @examples
#' all_dlbcl_genes <- get_genes(entities = "DLBCL", curated_only = FALSE)
#' # high-confidence (Tier 1) DLBCL genes
#' dlbcl_tier1 <- get_genes(entities = "DLBCL", tier = 1)
#'
#' # genes that are Tier 1 in DLBCL, FL and BL simultaneously
#' gene_df <- get_genes(entities = c("DLBCL", "FL", "BL"), gene_format = "data.frame")
#' shared_tier1 <- dplyr::filter(gene_df, DLBCL_Tier == 1, FL_Tier == 1, BL_Tier == 1)
#'
#' all_curated_genes <- get_genes()

get_genes <- function(
entities = c("DLBCL", "MCL", "BL"),
curated_only = TRUE,
tier = NULL,
gene_format = "symbol",
version = "_latest"
) {

# We need to handle the legacy version (0.0) separately
# because it was not pathology-specific
if (version == "0.0") {
# Gene lists are sourced from the normalized reference database (built from
# the LLMPP curated lists) rather than per-entity, per-version .rda objects.
# "version" and "tier" are columns, so lymphoma_genes_*_v0.1/v0.2/v_latest
# are no longer needed.
if (!version %in% c("_latest", "latest")) {
message(
paste(
"You have requested the legacy version of the lymphoma genes.",
"It is only provided here for backwards compatibility.",
"We recommend you use the most recent version by keeping the",
"default value of the argument version. Use at your own risk."
"Legacy per-version gene lists (e.g. 0.0, 0.1) are no longer",
"bundled. Data is now sourced from the LLMPP curated lists;",
"returning the current version."
)
)

legacy_lymphoma_genes <- eval(
parse(
text = paste0(
"GAMBLR.data::",
"lymphoma_genes_lymphoma_genes_v0.0")
)
)

legacy_lymphoma_genes <- legacy_lymphoma_genes %>%
dplyr::select(
Gene, ensembl_gene_id,
intersect(
colnames(.),
entities
)
)
if (curated_only) {
# drop any row where all pathologies have FALSE
legacy_lymphoma_genes <- legacy_lymphoma_genes %>%
dplyr::filter(
! if_all(3:ncol(.), ~ . == "FALSE")
)
}

if (gene_format == "symbol") {
return(legacy_lymphoma_genes$Gene)
} else if (gene_format == "ensembl") {
return(legacy_lymphoma_genes$ensembl_gene_id)
} else if (gene_format == "data.frame") {
return(legacy_lymphoma_genes)
} else {
stop(
"You requested output format that is not supported."
)
}
}

#construct file name using entity
entities <- tolower(entities)

r_objects <- entities %>%
paste0(
"lymphoma_genes_",
.,
"_v",
version
)

# check for unsupported gene sets
all_files <- system.file(
"extdata",
package = "GAMBLR.data"
) %>%
list.files(
recursive = TRUE,
full.names = TRUE
)

all_files <- gsub(
".*extdata/",
"",
all_files
)

all_files <- all_files[grepl("lymphoma_genes", all_files)]

all_files <- all_files[grepl(version, all_files)]

available_entities <- gsub("(.*/\\s*(.*$))", "\\2", all_files)
# `tier`, when supplied, selects exactly those confidence tiers (e.g.
# tier = 1 for high-confidence genes only) and takes precedence over
# `curated_only`. Otherwise curated_only == TRUE keeps the curated set
# (Tier 1 + Tier 2) and drops retired Tier 3 genes; FALSE returns all tiers.
keep_tiers <- if (!is.null(tier)) {
as.integer(tier)
} else if (curated_only) {
c(1L, 2L)
} else {
c(1L, 2L, 3L)
}

available_entities <- gsub(".tsv", "", available_entities)
con <- gambl_reference_db()
entities_u <- toupper(entities)

missing_sets <- setdiff(
entities,
available_entities
)
available <- dplyr::tbl(con, "gene_entity") %>%
dplyr::distinct(entity) %>%
dplyr::pull(entity)

missing_sets <- setdiff(entities_u, available)
if (length(missing_sets) > 0) {
warning(
paste(
"The gene set for the entity",
missing_sets,
paste(missing_sets, collapse = ", "),
"is not available and will not be returned."
)
)
r_objects <- r_objects[
grepl(
paste(
available_entities,
collapse="|"
),
r_objects
)
]
entities <- entities[entities %in% available_entities]
entities_u <- intersect(entities_u, available)
}

# Combine all lists into one df
# Do it in a way that when GAMBLR.data is ot imported, the data objects
# are still available
all_entities_data <- list()

for (i in seq_along(r_objects)) {
all_entities_data[[i]] <- eval(
parse(
text = paste0(
"GAMBLR.data::",
r_objects[i]
)
)
)
}

all_entities_data <- all_entities_data %>%
# only select necessary columns
lapply(
.,
`[`,
,
c("ensembl_gene_id", "Gene", "curated")
)

names(all_entities_data) <- toupper(entities)

all_entities_data <- all_entities_data %>%
bind_rows(.id = "entity")

if (curated_only) {
# drop any row where curated is FALSE
all_entities_data <- all_entities_data %>%
dplyr::filter(
curated == "TRUE"
)
}
dat <- dplyr::tbl(con, "gene_entity") %>%
dplyr::filter(entity %in% entities_u, tier %in% keep_tiers) %>%
dplyr::select(entity, ensembl_gene_id, Gene = gene, tier) %>%
dplyr::collect()

if (gene_format == "symbol") {
return(all_entities_data$Gene %>% unique %>% sort)
return(dat$Gene %>% unique %>% sort)
} else if (gene_format == "ensembl") {
return(all_entities_data$ensembl_gene_id %>% unique %>% sort)
return(dat$ensembl_gene_id %>% unique %>% sort)
} else if (gene_format == "data.frame") {
# one row per gene; one <ENTITY>_Tier column per requested entity
# holding the gene's tier there (NA if absent), so callers can do
# filter(df, DLBCL_Tier == 1, FL_Tier == 1, ...) %>% pull(Gene)
return(
all_entities_data %>%
select(-curated) %>%
mutate(is_gene = "TRUE") %>%
tidyr::pivot_wider(
names_from = "entity",
values_from = "is_gene"
) %>%
replace(is.na(.), "FALSE")
dat %>%
dplyr::distinct(Gene, ensembl_gene_id, entity, tier) %>%
tidyr::pivot_wider(
id_cols = c(Gene, ensembl_gene_id),
names_from = "entity",
values_from = "tier",
names_glue = "{entity}_Tier"
) %>%
dplyr::select(Gene, ensembl_gene_id,
dplyr::any_of(paste0(entities_u, "_Tier"))) %>%
dplyr::arrange(Gene)
)
} else {
stop(
Expand Down
Loading
Loading