Learn R Programming

qtl2 (version 0.42)

calc_hotspots: 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)

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".

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.

See Also

find_peaks(), plot_lodpeaks(), plot_cistrans()

Examples

Run this code
if (FALSE) {
# 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)
}

Run the code above in your browser using DataLab