A developmental R environment for a suite of GenomicRanges utilities
devgru provides tools for cancer genomics analysis within the GenomicRanges universe: format-aware file readers, conversions between data.table, GRanges, GRangesList and GInteractions, seqinfo harmonization, chromosome-parallel workflows, copy number, structural variant, and RNA-seq analysis helpers, QC diagnostics, and plotting. By default everything is anchored to the autosomes and sex chromosomes of hg38 (see gUtils::hg_seqlengths()).
Full documentation and the function reference are available at https://pblaney.github.io/devgru/.
Installation
You can install the current development version of devgru with:
devtools::install_github("pblaney/devgru")Several dependencies are only available on GitHub (mskilab-org/gUtils, mskilab-org/fishHook, caravagnalab/easypar, caravagn/pio, showteeth/ggpie, and pblaney/gGnome); these are declared as Remotes and resolved automatically by devtools/remotes. Packages listed under Suggests (e.g. DESeq2, fgsea, DNAcopy, InteractionSet) are only needed for the specific workflows that use them.
Suite of Packages
The current suite of utilities for devgru can be quickly installed, if needed, and loaded with:
library(devgru)
kit_loadout()
# Install/upgrade any missing or outdated packages in the kit first
kit_loadout(update_kit = TRUE)Function Overview
See the reference page for full details on each function.
Quick Start
Read genomic files straight into harmonized GRanges (or a data.table with output_type = "dt"):
library(devgru)
peaks_gr <- read_bed_file("peaks.bed.gz")
vcf_gr <- read_vcf_file("sample.vcf.gz", cpus = 4)
sv_dt <- read_bedpe_file("sample.bedpe")
# Collect and combine all MAFs in a directory into a single data.table
cohort_maf <- aggregate_these(path_to_files = "mafs/",
pattern_to_grab = "\\.maf$",
add_uniq_id = TRUE)Harmonize seqinfo across objects, e.g. after lifting over from hg19 to hg38:
GenomeInfoDb::seqinfo(example_dnase_hg38)
GenomeInfoDb::seqinfo(gr_refactor_seqs(example_dnase_hg38))Add flanks to a region without crossing a boundary such as the centromere:
notch2 <- gUtils::parse.gr("chr1:119911553-120069662")
chr1_p_arm <- gUtils::`%Q%`(chromosome_arms_hg38, seqnames == "chr1" & arm == "p")
gr_flank(input_gr = notch2,
start_flank = 3e6,
end_flank = 3e6,
start_flank_boundary = GenomicRanges::start(chr1_p_arm),
end_flank_boundary = GenomicRanges::end(chr1_p_arm))Run larger workflows, such as CBS segmentation of a fragCounter read depth profile parallelized by chromosome:
fragcounter_seg <- get_fragcounter_segmentation(
path_to_fragcounter_profile = "sample.fragcounter.rds",
cpus = 4)Bundled Data
devgru ships with hg38 reference annotations used internally by its workflows, as well as small demo datasets for examples:
-
Reference genomic feature annotations:
chromosome_arms_hg38,exclusion_regions_hg38,gene_body_hg38(Ensembl v108), -
Myeloma-specific genomic features:
myeloma_translocation_ig_loci_hg38,myeloma_translocation_partner_loci_hg38 -
Demo data: DNase I hypersensitivity sites (
example_dnase_hg38,braf_dnase_demo_dt_hg19/hg38,kras_dnase_demo_gr_hg19/hg38), a fragCounter read depth profile (read_depth_demo_hg38), and an RNA-seq counts matrix with condition labels (hmcl_counts_demo_dt_hg38,hmcl_conditions_demo_dt_hg38)
The raw files these were built from are in inst/extdata/.
Contributing
Bug reports and feature requests are welcome on the issue tracker.
