% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/compartment_score.R
\name{compartment_score}
\alias{compartment_score}
\title{Compartment score}
\usage{
compartment_score(explist, ev = 1, bed = NULL, bedgraph = NULL, ref = 1)
}
\arguments{
\item{explist}{Either a single GENOVA \code{contacts} object or list of
GENOVA \code{contacts}.}

\item{ev}{An \code{integer} of length one, indicating which eigenvector to
retrieve. Useful in case the first eigenvector does not resemble the
compartmentalisation.}

\item{bed}{A \code{data.frame} with 3 columns in BED format, containing peaks
of active chromatin marks. Mutually exclusive with the '\code{bedgraph}'
argument.}

\item{bedgraph}{A \code{data.frame} with 4 columns in bedGraph format,
containing scores correlated with active chromatin. Mutually exclusive with
the '\code{bed}' argument.}

\item{ref}{An \code{integer} of length 1 giving a sample index that can be
used as a reference. Set to \code{NULL} to sign every sample individually.}
}
\value{
A \code{CS_discovery} object with 1 element.

\itemize{\item\strong{\code{compart_scores}}, a \code{data.frame} 
with the following columns:
\describe{
\item{\code{chrom}}{A \code{character} with chromosome names.}
\item{\code{start}}{An \code{integer} with start positions in the 
chromosome.}
\item{\code{end}}{An \code{integer} with end positions in the chromosome.}
\item{\code{bin}}{An \code{integer} giving the index of the genomic 
position.}
\item{\emph{samplename_1}}{A \code{numeric}, the calculated compartment score 
for the first '\code{explist}' entry. Column name is eponymous with entries 
in '\code{explist}'.}
\item{\emph{samplename_n} (Optional)}{A \code{numeric}, the calculated 
compartment scores for subsequent '\code{explist}' entries.}
}
}
}
\description{
\code{compartment_score} calculates a compartment score per chromosome arm.
}
\details{
The produre is based on the algorithm of G. Fudenberg, which
  performs an eigenvector decomposition of the observed / expected matrix
  minus one. Centromeres will be skipped.
}
\note{
When the '\code{bed}' or '\code{bedgraph}' arguments are both
  \code{NULL}, the function returns an unsigned \code{CS_discovery} object
  with the attribute '\code{signed = FALSE}'. Signing the compartment scores
  is necessary to have positive values correspond to more active A
  compartments and negative values to more inactive B compartments.
}
\section{Resolution recommendation}{
 100kb-150kb. Data with <20kb resolution
 will return an error due to sparsity.
}

\examples{
\dontrun{
# Proper compartment scores
cs <- compartment_score(list(WT_100kb, KO_100kb), bed = H3K4me1_peaks)

# Doing the eigenvector decomposition only yields unsigned scores
cs <- compartment_score(list(WT_100kb, KO_100kb))

# Signing the scores
cs <- sign_compartmentscore(cs, bed = H3K4me1_peaks)
}
}
\seealso{
\code{\link[GENOVA]{sign_compartmentscore}} for getting signed
  compartment scores and appropriate '\code{bed}'. and '\code{bedgraph}'
  arguments.
}
