calc_hotspots: Calculate QTL hotspots

View source: R/calc_hotspots.R

calc_hotspotsR Documentation

Calculate QTL hotspots

Description

For a set of QTL locations, calculate a running count in a sliding window across the genome.

Usage

calc_hotspots(peaks, map, window = 1, cores = 1, quiet = TRUE)

Arguments

peaks

Data frame of QTL results, as output by find_peaks() Should contain columns chr and pos.

map

Marker map, as a list of chromosomes, each being a vector of positions. Hotspot counts will be calculated at these positions.

window

Window size for counting QTL.

cores

Number of CPU cores to use, for parallel calculations. (If 0, use parallel::detectCores().) Alternatively, this can be links to a set of cluster sockets, as produced by parallel::makeCluster().

quiet

If TRUE, don't print any messages.

Value

An object of class "scan1": a matrix with a single column, of counts, with rownames being the marker names in map. The column name is "num_qtl".

See Also

find_peaks(), plot_lodpeaks(), plot_cistrans()

Examples

## Not run: 
# download example pQTL results (from Keele et al. 2026, https://doi.org/10.1016/j.xgen.2025.101069)
# contains qtl, map_endpoints, and pheno_pos
url <- "https://kbroman.org/qtl2/assets/sampledata/pqtl_data.RData"
tempfile <- file.path(tempdir(), basename(url))
download.file(url, tempfile)
load(tempfile)
unlink(tempfile)

hotspots <- calc_hotspots(qtl, map, window=2)
plot(hotspots, map, ylab="No. QTL")
find_peaks(hotspots, map, threshold=20)

## End(Not run)

qtl2 documentation built on July 6, 2026, 5:11 p.m.