\HeaderA{cScale}{A function for mapping chromosome length to a number of points.}{cScale}
\keyword{utilities}{cScale}
\begin{Description}\relax
Given a number of points (generally representing the number of points
on a plot's axis), and a vector of chromosome lengths - will generate
a vector of the same length as the one passed in containing scaling
factors for each chromosome.
\end{Description}
\begin{Usage}
\begin{verbatim}
cScale(points, cLengths, method=c("max", "relative"), chrom)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{points}] The number of points to scale the chromosome length to.
\item[\code{cLengths}] A vector of chromosome lengths. 
\item[\code{method}] Determines whether to use relative or absolute scaling.
Default is "max" (absolute).
\item[\code{chrom}] Which chrom to determine the scale for
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The scale factor is calculated in a manner based on the \code{method}
argument.  If method is \code{max}, the factor is derived by dividing the
points argument by each chromosome's length (in base pairs).  If the
method chosen is \code{relative}, then the scale is determined by dividing
the points argument by the maximum chromsome length, and applying that
value to each chromosome.
\end{Details}
\begin{Author}\relax
Jeff Gentry
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{cPlot}{cPlot}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

   ## A bit of a hack to not have a package dependency on hgu95av2
   ## but need to fiddle w/ the warn level to not fail the example anyways.
   curWarn <- options(warn=0)
   on.exit(options(warn=curWarn), add=TRUE)
   if (require(hgu95av2)) {
      z <- buildChromLocation("hgu95av2")

     for (sc in c("max","relative"))
       scale <- cScale(1000, chromLengths(z),sc,"Y")
   } else print("This example needs the hgu95av2 data package")
\end{ExampleCode}
\end{Examples}

