Skip to contents

Extract matrices in the HiC maps list around genomic features.

Usage

ExtractSubmatrix(
  genomicFeature = NULL,
  hicLst = NULL,
  referencePoint = "pf",
  hicResolution = NULL,
  matriceDim = 21,
  shift = 1,
  remove_duplicates = TRUE,
  cores = 1,
  verbose = FALSE
)

Arguments

genomicFeature

<GRanges or PairsGRanges or GInteractions>: The genomic coordinates on which compute the extraction of HiC submatrix.

hicLst

<ListContactMatrix>: The HiC maps list.

referencePoint

: Type of extracted submatrices. "rf" for "region feature" to extract triangle-shaped matrices around regions or "pf" for "point feature" to extract square-shaped matrices around points. (Default "rf")

hicResolution

: The resolution used in hicLst. If NULL, automatically find in resolution attributes of hicLst. (Default NULL)

matriceDim

: The size of matrices in output. (Default 21).

shift

: Only when "referencePoint" is "rf". Factor defining how much of the distance between anchor and bait is extracted before and after the region (Default 1). Ex: for shift=2, extracted matrices will be: 2*regionSize+regionSize+2*regionSize.

remove_duplicates

: remove duplicated submatrices ? This avoids duplicated submatrices when both anchor and bait bins are from the same feature. ex. BEAF32-BEAF32, same submatrix twice with opposite orientations(Default TRUE)

cores

: An integer to specify the number of cores. (Default 1)

verbose

: If TRUE, show the progression in console. (Default FALSE)

Value

A matrices list.

Details

ExtractSubmatrix

Examples

# Data
data(Beaf32_Peaks.gnr)
data(HiC_Ctrl.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)
Beaf_Beaf.gni <- Beaf_Beaf.gni[seq_len(2000)] # subset 2000 first for exemple

# Matrices extractions of regions defined between
# Beaf32 <-> Beaf32 interactions
interactions_RF.mtx_lst <- ExtractSubmatrix(
    genomicFeature = Beaf_Beaf.gni,
    hicLst = HiC_Ctrl.cmx_lst,
    referencePoint = "rf"
)
#> Warning: GRanges object contains 1885 out-of-bound ranges located on sequence
#>   2L. Note that ranges located on a sequence whose length is unknown (NA)
#>   or on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 3770 out-of-bound ranges located on sequence
#>   2L. Note that ranges located on a sequence whose length is unknown (NA)
#>   or on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.

# Matrices extractions center on Beaf32 <-> Beaf32 pointinteraction
interactions_PF.mtx_lst <- ExtractSubmatrix(
    genomicFeature = Beaf_Beaf.gni,
    hicLst = HiC_Ctrl.cmx_lst,
    referencePoint = "pf"
)