% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coverage_helpers.R
\name{scaledWindowPositions}
\alias{scaledWindowPositions}
\title{Scale windows to a meta window of size}
\usage{
scaledWindowPositions(grl, reads, scaleTo = 100, scoring = "meanPos")
}
\arguments{
\item{grl}{GRangesList or GRanges of your ranges}

\item{reads}{GRanges object of your reads.}

\item{scaleTo}{an integer (100), if windows have different size,
a meta window can not directly be created, since a meta window must
have equal size for all windows. Rescale all windows to scaleTo.
i.e c(1,2,3) -> size 2 -> c(1, mean(2,3)) etc. Can also be a vector,
1 number per grl group.}

\item{scoring}{a character, one of (meanPos, sumPos)}
}
\value{
A data.table with scored counts (counts) of
reads mapped to positions (position) specified in windows along with
frame (frame).
}
\description{
For example scale a coverage plot of a all human CDS to width 100
}
\details{
Nice for making metaplots, the score will be mean of merged positions.
}
\examples{
library(GenomicRanges)
windows <- GRangesList(GRanges("chr1", IRanges(1, 200), "-"))
x <- GenomicRanges::GRanges(
  seqnames = "chr1",
  ranges =  IRanges::IRanges(c(1, 100, 199), c(2, 101, 200)),
  strand = "-")
scaledWindowPositions(windows, x, scaleTo = 100)

}
\seealso{
Other coverage: \code{\link{coverageScorings}},
  \code{\link{metaWindow}},
  \code{\link{windowPerReadLength}}
}
\concept{coverage}
