% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tornado_insulation.R
\name{tornado_insulation}
\alias{tornado_insulation}
\title{Plot a heatmap or profile of insulation scores}
\usage{
tornado_insulation(
  IS_discovery,
  bed,
  bed_pos = "end",
  region_width = 1e+06,
  sort_bins = 11,
  sort_on = 1,
  mode = c("both", "heatmap", "profile"),
  colour_lim = c(-1, 1),
  colours = NULL,
  profile_fun = mean,
  custom_fill_scale = NULL,
  profile_ylim = NULL,
  title = NULL
)
}
\arguments{
\item{IS_discovery}{A GENOVA \code{IS_discovery} object as created by
\code{insulation_score()}.}

\item{bed}{A \code{data.frame} with 3 columns in BED format, containing
genomic locations for which the insulation score is taken. Alternatively,
a \code{list} of such \code{data.frame}.}

\item{bed_pos}{A \code{character} vector of length 1 containing either
\code{"start"}, \code{"end"} or \code{"center"} indicating what position of
the '\code{bed}' argument to center insulation scores around.}

\item{region_width}{A \code{numeric} vector of length 1 for the size in
basepairs around the feature to retrieve insulation scores for.}

\item{sort_bins}{A \code{integer} of length 1 indicating how many central
bins should be used to sort the heatmap.}

\item{sort_on}{A \code{integer} of length 1 noting an experiment on which to
sort the heatmap.}

\item{mode}{A \code{character} of length 1 containing either
\code{"heatmap"}, \code{"profile"} or \code{"both"} for how the data should
be plotted.}

\item{colour_lim}{A \code{numeric} vector of length 2 indicating the limits
of the heatmap colour scale in insulation scores.}

\item{colours}{A vector of valid colours for the heatmap gradient. Internally
defaults to a blue-white-red gradient.}

\item{profile_fun}{A \code{function} with which to calculate the profile.
Should return 1 value per call.}

\item{custom_fill_scale}{A call to one of ggplot2's \code{scale_fill_*}
family of functions to use as the heatmap's scale. If this argument is not
\code{NULL}, it overrides the '\code{colour_lim}' and '\code{colour}'
arguments.}

\item{profile_ylim}{A \code{numeric} of length 2 indicating limits for the
y-axis in the profile part.}

\item{title}{A \code{character} or \code{expression} of length 1 to use as
text for the plot title.}
}
\value{
A \code{ggplot} object.
}
\description{
Takes pre-calculated insulation scores around a set of genomic locations and
plots these in a heatmap and/or profile.
}
\details{
The profile colours are automatically assumed from the colours given
  to the \code{contacts} object during the \code{load_contacts} operation.
  Entries in the '\code{bed}' argument that contain > 1 percent missing data
  are dropped.
}
\examples{
\dontrun{
# Calculating insulation scores
ins <- tornado_insulation(list(WT_20kb, KO_20kb), window = 25)

# Calling TADs from the insulation score
tadlist <- call_TAD_insulation(ins)

# Plotting a heatmap
tornado_insulation(ins, tadlist$WT_20kb)
}
}
\seealso{
\code{\link[GENOVA]{insulation_score}} for calculating insulation
  scores. \code{\link[GENOVA]{call_TAD_insulation}} for calling TADs on the
  insulation score.
}
