Skip to contents

Aggregates all the matrices of a list (or two lists in case of differential aggregation) into a single matrix. This function allows to apply different aggregation (average, sum, ...), and differential (subtraction, ratio, ...) functions.

Usage

Aggregation(
  ctrlMatrices = NULL,
  matrices = NULL,
  aggFun = "mean",
  diffFun = "substraction",
  scaleCorrection = FALSE,
  correctionArea = NULL,
  statCompare = FALSE
)

Arguments

ctrlMatrices

<listmatrix>: The matrices list to aggregate as control.

matrices

<listmatrix>: The matrices list to aggregate.

aggFun

: The function used to aggregate each pixel in matrix. If the parameter is a character so:

  • "50%" or "median" apply the median

  • "+" or "sum" apply the sum

  • other (Default) apply the mean

diffFun

: The function used to compute differential. If the parameter is character so:

  • "-", "substract" or "substraction" apply a substraction (Default)

  • "/" or "ratio" apply a ratio

  • "log2","log2-","log2/" or "log2ratio" apply a log2 on ratio

  • other apply a log2 on 1+ratio

scaleCorrection

: Whether a correction should be done on the median value take in ane noising area. (Default TRUE)

correctionArea

: Nested list of indice that define a noising area fore correction. List must contain in first an element "i" (row indices) then an element called "j" (columns indices). If NULL automatically take in upper left part of aggregated matrices. (Default NULL)

statCompare

: Whether a t.test must be apply to each pixel of the differential aggregated matrix.

Value

A matrix

Details

Aggregation

Examples

# Data
data(Beaf32_Peaks.gnr)
data(HiC_Ctrl.cmx_lst)
data(HiC_HS.cmx_lst)

# Index Beaf32
Beaf32_Index.gnr <- IndexFeatures(
    gRangeList = list(Beaf = Beaf32_Peaks.gnr),
    chromSizes = data.frame(seqnames = c("2L", "2R"), 
        seqlengths = c(23513712, 25286936)),
    binSize = 100000
)

# Beaf32 <-> Beaf32 Pairing
Beaf_Beaf.gni <- SearchPairs(indexAnchor = Beaf32_Index.gnr)
# subset 2000 first for exemple
Beaf_Beaf.gni <- Beaf_Beaf.gni[seq_len(2000)]

# Matrices extractions center on Beaf32 <-> Beaf32 point interaction
interactions_Ctrl.mtx_lst <- ExtractSubmatrix(
    genomicFeature = Beaf_Beaf.gni,
    hicLst = HiC_Ctrl.cmx_lst,
    referencePoint = "pf"
)
interactions_HS.mtx_lst <- ExtractSubmatrix(
    genomicFeature = Beaf_Beaf.gni,
    hicLst = HiC_HS.cmx_lst,
    referencePoint = "pf"
)
interactions_Ctrl.mtx_lst <- PrepareMtxList(
    matrices = interactions_Ctrl.mtx_lst
)

# Aggregate matrices in one matrix
aggreg.mtx <- Aggregation(interactions_Ctrl.mtx_lst)


interactions_HS.mtx_lst <- PrepareMtxList(
    matrices = interactions_HS.mtx_lst
)

# Differential Aggregation
aggregDiff.mtx <- Aggregation(
    ctrlMatrices = interactions_Ctrl.mtx_lst,
    matrices = interactions_HS.mtx_lst
)