Interactive IGV visualisation (Shiny + igvShiny) of differential regions
Source:R/browse_igv_regions.R
browse_igv_regions.RdLaunches a Shiny app with an embedded IGV browser and an interactive table listing differentially-bound regions (from `differential_binding()` or `differential_accessibility()` results). Clicking on a region in the table will pan IGV to that locus. Sample coverage and region tracks are loaded as quantitative/annotation tracks. A dedicated "Save as SVG" button is provided to export the current IGV view.
Usage
browse_igv_regions(
diff_results,
samples = NULL,
use_unique_ids = TRUE,
colour_cond1 = "#ff6600",
colour_cond2 = "#2288dd",
use_genome = NULL,
padding_width = 20000,
trackHeight = 65,
peakColour = "darkgreen",
trackColour = "#6666ff",
host = "localhost",
port = NULL
)Arguments
- diff_results
A `DamIDResults` object, as returned by `differential_binding()` or `differential_accessibility()`.
- samples
Optional character vector of sample names to display (default: all in dataset).
- use_unique_ids
Logical. When `TRUE` (default), simplified unique sample names will be displayed. Set as `FALSE` to use the full sample file names from loading.
- colour_cond1, colour_cond2
Colours for differentially-enriched region tracks.
- use_genome
IGV genome name (inferred from peak annotations if not provided).
- padding_width
Width to pad browser viewbox on either side of the peak (Default: 20000)
- trackHeight
Height of bedGraph tracks (Default: 65)
- peakColour
Colour for significant peaks track (Default: "darkgreen")
- trackColour
Colour for bedGraph tracks (Default: "#6666ff")
- host
Hostname for the server location (Default: "localhost").
- port
Port for connection (if NULL (default) the port is assigned by Shiny).
Examples
if (FALSE) { # \dontrun{
if (isTRUE(curl::has_internet()) && interactive()) {
# This example launches an interactive Shiny app in a web browser
.generate_example_results <- function() {
mock_genes_gr <- GenomicRanges::GRanges(
seqnames = S4Vectors::Rle("2L", 7),
ranges = IRanges::IRanges(
start = c(1000, 2000, 3000, 5000, 6000, 7000, 8000),
end = c(1500, 2500, 3500, 5500, 6500, 7500, 20000000)
),
gene_id = c("FBgn001", "FBgn002", "FBgn003", "FBgn004", "FBgn005", "FBgn006", "FBgn007"),
gene_name = c("geneA", "geneB", "geneC", "geneD", "geneE", "geneF", "LargeTestGene")
)
data_dir <- system.file("extdata", package = "damidBind")
loaded_data <- load_data_peaks(
binding_profiles_path = data_dir,
peaks_path = data_dir,
ensdb_genes = mock_genes_gr,
quantile_norm = TRUE
)
diff_results <- differential_binding(
loaded_data,
cond = c("L4 Neurons" = "L4",
"L5 Neurons" = "L5")
)
return(diff_results)
}
diff_results <- .generate_example_results()
# Launch the interactive browser
browse_igv_regions(diff_results)
}
} # }