Hotspots & Phenotypes Module
hotspot.RmdDeveloper’s Guide to the
qtl2shiny Package
Overview
The Hotspots & Phenotypes panel is the entry
point for data exploration in the qtl2shiny application. It
allows researchers to load experimental datasets, view precomputed QTL
peak densities (genomic hotspots), and explore the statistical
distributions of raw and normalized phenotype variables.
It coordinates two primary sub-panel structures:
- Hotspot Analysis Sub-Panel: Deals with peaks filtering, chromosomal density computations, and coordinate window selections.
- Phenotypes Sub-Panel: Handles the loading, filtering, normalization, and graphical plotting of phenotype records.
Module Hierarchy & Entrypoints
-
Top-Level Container:
- Standalone Application:
hotspotApp() - Server Module:
hotspotServer(id, project_df, main_par) - UI Input:
hotspotInput(id) - UI Output:
hotspotOutput(id)
- Standalone Application:
-
Hotspot Sub-Modules:
-
Hotspot Data (
hotspotDataApp): Computes peak count densities. Server:hotspotDataServer. -
Hotspot Table (
hotspotTableApp): Searchable peaks/hotspots datatable. Server:hotspotTableServer. -
Hotspot Plot (
hotspotPlotApp): Density plots of QTL peaks. Server:hotspotPlotServer. -
Peaks Filter (
peakApp/peakReadApp): Handles reading/filtering of precomputed peak files. Server:peakServer/peakReadServer.
-
Hotspot Data (
-
Phenotype Sub-Modules:
-
Phenotypes Container (
phenoApp): Server:phenoServer. -
Pheno Reader (
phenoReadApp): Reads raw database matrix. Server:phenoReadServer. -
Pheno Names Selector (
phenoNamesApp): Filter inputs. Server:phenoNamesServer. -
Pheno Data Normalizer (
phenoDataApp): Runs transformations (e.g.,rankZ()). Server:phenoDataServer. -
Pheno Table (
phenoTableApp): Renders data tables. Server:phenoTableServer. -
Pheno Plot (
phenoPlotApp): Renders boxplots/scatterplots. Server:phenoPlotServer.
-
Phenotypes Container (
1. Top-Level Container (hotspotApp)
Server Logic & Reactive Flow (hotspotServer)
The master server integrates study parameters (set_par),
physical maps (pmap_obj), and handles active-tab downroute
downloads:
-
Parameter Initializers:
- Spawns
setParServerand loadspmap_objusingread_project().
- Spawns
-
Analysis Pipelines:
- Calls
hotspotDataServer()to compute active QTL hotspots. - Passes hotspot coordinates to
winParServerto register the active chromosomal window (win_par). - Passes coordinates to
phenoServer()to query associated phenotypes in the window.
- Calls
-
Dynamic Downloads:
- Directs plot/table downloads to
downr::downloadServerby tracking the active sub-tab:-
Hotspotstab: Routes plots/tables fromhotspotPlotServerandhotspotTableServer. -
Phenotypestab: Routes plots/tables fromphenoPlotServerandphenoTableServer.
-
- Directs plot/table downloads to
graph TD
Project[project_df] --> hotspotServer
hotspotServer --> SetPar[setParServer]
SetPar --> PeakRead[peakReadServer]
PeakRead --> HotData[hotspotDataServer]
HotData --> HotPlot[hotspotPlotServer]
HotData --> HotTable[hotspotTableServer]
HotTable --> WinPar[winParServer]
WinPar --> PhenoPanel[phenoServer]
2. Hotspot Density Scans (hotspotDataApp &
Sub-modules)
Data Used
-
peaks.rds: A precomputed dataframe listing LOD scores, marker names, and Mbp positions of QTL peaks. -
pmap.rds: The physical map of markers and Mbp locations.
Logic and Code Workflow
-
Hotspot Densities Calculation:
-
hotspotDataServerscans precomputed peaks across the genome. It determines the number of peaks exceeding a lod threshold within moving chromosomal windows.
-
-
Visualizing Hotspots
(
hotspotPlotServer):- Generates genome-wide peak count or LOD density charts.
-
Coordinates Selection (
winParServer):- Evaluates user clicks or selections on the hotspots data table/plots
to update the active chromosomal range (
chr_id,start_Mbp,end_Mbp).
- Evaluates user clicks or selections on the hotspots data table/plots
to update the active chromosomal range (
3. Phenotype Distributions (phenoApp &
Sub-modules)
Data Used
-
pheno_data.rds: A matrix storing raw measurements (rows = individuals, columns = phenotypes). -
covar.rds: Covariates data frame (e.g. sex, age, batch) for adjusting phenotype averages.
Logic and Code Workflow
-
Filtering & Loading:
-
phenoReadServerreads thepheno_data.rdsfile relative to the selected project. -
phenoNamesServerlists available phenotype parameters.
-
-
Normalizations (
phenoDataServer):- Normalizes selected phenotype distributions on-the-fly (e.g., using
rank-based normal transformations via
rankZ()).
- Normalizes selected phenotype distributions on-the-fly (e.g., using
rank-based normal transformations via
-
Plotting (
phenoPlotServer):- Renders individual density curves, boxplots grouped by cohort parameters, or multi-phenotype scatterplot grids.