\name{xmapcore.range}
\alias{xmapcore.range}
\alias{domains.in.range}
\alias{est_exons.in.range}
\alias{est_genes.in.range}
\alias{est_transcripts.in.range}
\alias{exons.in.range}
\alias{genes.in.range}
\alias{prediction_transcripts.in.range}
\alias{probesets.in.range}
\alias{probes.in.range}
\alias{proteins.in.range}
\alias{transcripts.in.range}
\alias{xmap.range.apply}
\title{
  xmapcore \'range\' functions
}
\description{
  Get the features within the specified genome coordinates.
}
\usage{
  domains.in.range( chr, start, end, strand, as.vector=TRUE )
  est_exons.in.range( chr, start, end, strand, as.vector=TRUE )
  est_genes.in.range( chr, start, end, strand, as.vector=TRUE )
  est_transcripts.in.range( chr, start, end, strand, as.vector=TRUE )
  exons.in.range( chr, start, end, strand, as.vector=TRUE )
  genes.in.range( chr, start, end, strand, as.vector=TRUE )
  prediction_transcripts.in.range( chr, start, end, strand, as.vector=TRUE )
  probesets.in.range( chr, start, end, strand, as.vector=TRUE )
  probes.in.range( chr, start, end, strand, as.vector=TRUE )
  proteins.in.range( chr, start, end, strand, as.vector=TRUE )
  transcripts.in.range( chr, start, end, strand, as.vector=TRUE )
  xmap.range.apply( x, f, filter=c( chr="space", start="start", end="end", strand="strand" ), coerce=c( as.character, as.numeric, as.numeric, as.numeric ), ... )
}
\arguments{
  \item{as.vector}{ If \code{TRUE} returns a vector of database identifiers. If \code{FALSE} returns a \code{\link{RangedData}} object containing detailed annotation. }
  \item{chr}{ The chromosome name (as a character) }
  \item{start}{ Start of the region }
  \item{end}{ End of the region }
  \item{strand}{ 1 == top stand, -1 == bottom strand }
  \item{x}{A \code{\link{RangedData}} object}
  \item{f}{A function to apply to each \'row\' of the \code{\link{RangedData}} object}
  \item{filter}{Which \'columns\' of the \code{\link{RangedData}} object does the function need, and what parameters in the function do they map on to?. For example, by default, the field \'space\' gets mapped to the parameter \'chr\'.}
  \item{coerce}{What is the type of each parameter in \'f\'?}
  \item{...}{additional parameters to \'f\'}
}
\details{
  Find all the specified features within a given region of the genome. For all functions except \code{probes.in.range}, features that fall on the boundaries of the region (i.e. are partially overlapping) are returned too. For \code{probes.in.range} probes that span the start of the range are NOT returned (but those spanning the end of the range are).

  The function \code{xmap.range.apply} makes it possible to map any of these functions down the rows of a \code{\link{RangedData}} object. The defaults are set up so that it will handle the output of one of the \code{.in.range} methods here. This makes it easy to nest functions, for example, to find all genes in a given region of the the genome, and then find the exon array probes that map to those genes (see below). 
}
\value{
 Returns an \code{\link{RangedData}} object, one \'row\' per feature, containing detailed annotations, or a \code{vector} of identifiers, depending on the value of \code{as.vector}.
}
\seealso{
  \code{\link{xmapcore.to}}\cr
  \code{\link{xmapcore.details}}\cr
  \code{\link{xmapcore.all}}\cr
  \code{\link{xmapcore.utils}}\cr
  \code{\link{xmapcore.filters}}\cr
  \code{\link{RangedData}}
}
\author{
  Tim Yates
}
\examples{
  if(interactive()) {
    xmap.connect()
    r <- genes.in.range( '17', 7510000, 7550000, 1 )
    genes.in.range( '17', 7510000, 7550000, -1 )
    xmap.range.apply(symbol.to.gene("TP53",as.vector=FALSE),probes.in.range)
  }
}