man/getTopRegions.Rd
c96219ec
 % Generated by roxygen2: do not edit by hand
 % Please edit documentation in R/COCOA.R
 \name{getTopRegions}
 \alias{getTopRegions}
3b9967ec
 \title{Get regions that are most associated with target variable}
c96219ec
 \usage{
05b6d14c
 getTopRegions(
   signal,
   signalCoord,
   regionSet,
   signalCol = c("PC1", "PC2"),
   cutoff = 0.8,
   returnQuantile = TRUE
 )
c96219ec
 }
 \arguments{
3b9967ec
 \item{signal}{Matrix of feature contribution scores (the contribution of 
 each epigenetic feature to each target variable). One named column for each 
 target variable.
 One row for each original epigenetic feature (should be same order 
 as original data/signalCoord). For (an unsupervised) example, if PCA was
 done on epigenetic data and the
 goal was to find region sets associated with the principal components, you 
 could use the x$rotation output of prcomp(epigenetic data) as the
 feature contribution scores/`signal` parameter.}
c96219ec
 
3b9967ec
 \item{signalCoord}{A GRanges object or data frame with coordinates 
 for the genomic signal/original epigenetic data. 
68095580
 Coordinates should be in the 
3b9967ec
 same order as the original data and the feature contribution scores 
c96219ec
 (each item/row in signalCoord
68095580
 corresponds to a row in signal). If a data.frame, 
3b9967ec
 must have chr and start columns (optionally can have end column, 
 depending on the epigenetic data type).}
c96219ec
 
68095580
 \item{regionSet}{A genomic ranges (GRanges) object with regions corresponding
10746525
 to the same biological annotation.}
c96219ec
 
8b1ada6e
 \item{signalCol}{A character vector with the names of the sample variables
 of interest/target variables (e.g. PCs or sample phenotypes).}
10746525
 
8b1ada6e
 \item{cutoff}{Numeric. Only regions with at least this value will be 
 returned (either above this average `signal` value or above this quantile
 if returnQuantile=TRUE).}
10746525
 
8b1ada6e
 \item{returnQuantile}{Logical. If FALSE, return region averages. If TRUE,
c96219ec
 for each region, return the quantile of that region's average value
3b9967ec
 based on the distribution of individual feature values in `signal` for
8b1ada6e
 that `signalCol`.}
c96219ec
 }
 \value{
8b1ada6e
 A GRanges object with region coordinates for regions with
3b9967ec
 scores/quantiles above "cutoff" for any target variable in signalCol. 
 The scores/quantiles
c96219ec
 for signalCol are given as metadata in the GRanges.
 }
 \description{
3b9967ec
 Get a GRanges with top regions from the region set based on 
 average feature contribution scores
 for the regions or the quantile of the region's average
 feature contribution score based on the 
 distribution of all feature contribution scores for the target variable.
 Returns average feature contribution score or quantile as GRanges metadata.
c96219ec
 }
 \examples{
c763444a
 data("brcaATACCoord1")
 data("brcaATACData1")
c96219ec
 data("esr1_chr1")
c763444a
 featureContributionScores <- prcomp(t(brcaATACData1))$rotation
 topRegions <- getTopRegions(signal=featureContributionScores,
                             signalCoord=brcaATACCoord1,
                             regionSet=esr1_chr1,
                             returnQuantile = TRUE)
c96219ec
 }