% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/calc_hotspots.R
\name{calc_hotspots}
\alias{calc_hotspots}
\title{Calculate QTL hotspots}
\usage{
calc_hotspots(peaks, map, window = 1, cores = 1, quiet = TRUE)
}
\arguments{
\item{peaks}{Data frame of QTL results, as output by \code{\link[=find_peaks]{find_peaks()}}
Should contain columns \code{chr} and \code{pos}.}

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

\item{window}{Window size for counting QTL.}

\item{cores}{Number of CPU cores to use, for parallel calculations.
(If \code{0}, use \code{\link[parallel:detectCores]{parallel::detectCores()}}.)
Alternatively, this can be links to a set of cluster sockets, as
produced by \code{\link[parallel:makeCluster]{parallel::makeCluster()}}.}

\item{quiet}{If TRUE, don't print any messages.}
}
\value{
An object of class \code{"scan1"}: a matrix with a single
column, of counts, with rownames being the marker names in
\code{map}. The column name is \code{"num_qtl"}.
}
\description{
For a set of QTL locations, calculate a running count in a sliding
window across the genome.
}
\examples{
\dontrun{
# 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)
}
}
\seealso{
\code{\link[=find_peaks]{find_peaks()}}, \code{\link[=plot_lodpeaks]{plot_lodpeaks()}}, \code{\link[=plot_cistrans]{plot_cistrans()}}
}
