% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ranges_helpers.R
\name{extendLeaders}
\alias{extendLeaders}
\title{Extend the leaders transcription start sites.}
\usage{
extendLeaders(grl, extension = 1000L, cds = NULL)
}
\arguments{
\item{grl}{usually a \code{\link{GRangesList}} of 5' utrs or transcripts.
Can be used for any extension of groups.}

\item{extension}{an integer, how much to extend the leaders.
Or a GRangesList where start / stops by strand are the positions
to use as new starts.}

\item{cds}{If you want to extend 5' leaders downstream, to catch
upstream ORFs going into cds, include it. It will add first
cds exon to grl matched by names.
Do not add for transcripts, as they are already included.}
}
\value{
an extended GRangeslist
}
\description{
Will extend the leaders or transcripts upstream by extension.
Remember the extension is general not relative, that means splicing
will not be taken into account.
Requires the \code{grl} to be sorted beforehand,
use \code{\link{sortPerGroup}} to get sorted grl.
}
\examples{
library(GenomicFeatures)
samplefile <- system.file("extdata", "hg19_knownGene_sample.sqlite",
                          package = "GenomicFeatures")
txdb <- loadDb(samplefile)
fiveUTRs <- fiveUTRsByTranscript(txdb) # <- extract only 5' leaders
tx <- exonsBy(txdb, by = "tx", use.names = TRUE)
cds <- cdsBy(txdb,"tx",use.names = TRUE)
## now try(extend upstream 1000, downstream 1st cds exons):
extendLeaders(fiveUTRs, extension = 1000, cds)

## when extending transcripts, don't include cds' of course,
## since they are already there
extendLeaders(tx, extension = 1000)

}
