% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_cistrans.R
\name{plot_cistrans}
\alias{plot_cistrans}
\title{cis-trans plot for eQTL results}
\usage{
plot_cistrans(
  peaks,
  map,
  pheno_pos,
  gap = 0,
  cis_window = 1,
  pch = 21,
  col = "slateblue",
  bg = "slateblue",
  cex = 0.8,
  pch_cis = 21,
  col_cis = "violetred",
  bg_cis = "violetred",
  cex_cis = 0.8,
  pty = "s",
  bgcolor = "gray90",
  altbgcolor = "gray80",
  ...
)
}
\arguments{
\item{peaks}{Data frame of QTL results, as output by \code{\link[=find_peaks]{find_peaks()}}
Should contain columns \code{lodcolumn}, \code{chr}, and \code{pos}.}

\item{map}{Marker map, as a list of chromosomes, each being a
vector of positions; used to get chromosome names and start/end}

\item{pheno_pos}{Data frame with chromosome, position, and name of
the phenotypes in \code{peaks}. Should contain columns \code{pheno},
\code{chr}, and \code{pos}.}

\item{gap}{Gap between chromosomes in the plot}

\item{cis_window}{Window size that defines cis-QTL (on same
chromosome, and position of gene within this distance of QTL
position)}

\item{pch}{Point type for "trans" points}

\item{col}{Point color for "trans" points}

\item{bg}{Background color for "trans" points}

\item{cex}{Character expansion size for "trans" points}

\item{pch_cis}{Point type for "cis" points}

\item{col_cis}{Point color for "cis" points}

\item{bg_cis}{Background color for "cis" points}

\item{cex_cis}{Character expansion size for "cis" points}

\item{pty}{Plot type; the default "s" forces a square plot; use "m"
to use the maximal plotting region.}

\item{bgcolor}{Background color for chromosome rectangles}

\item{altbgcolor}{Alternate background color for chromosome rectangles}

\item{...}{Additional graphics arguments passed to \code{\link[graphics:points]{graphics::points()}}}
}
\value{
Invisibly returns a data frame with \code{peaks} merged with
\code{pheno_pos}, with an additional column \code{cis} that indicates
which QTL appear to be cis (vs trans).
}
\description{
Scatterplot of gene location vs QTL location to display eQTL/pQTL results
}
\examples{
\dontrun{
# download example pQTL results (from Keele et al. 2026, https://doi.org/10.1016/j.xgen.2025.101069)
# contains qtl, map, 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)

plot_cistrans(qtl, map, pheno_pos, cis_window=5)
}
}
\seealso{
\code{\link[=plot_scan1]{plot_scan1()}}, \code{\link[=find_peaks]{find_peaks()}}, \code{\link[=plot_lodpeaks]{plot_lodpeaks()}}
}
