Computes eigen vectors for each chromosome using cis contacts and extract chromosome compartments.

getCompartments(
  x,
  resolution = NULL,
  genome = NULL,
  chromosomes = NULL,
  neigens = 3,
  sort_eigens = FALSE,
  BPPARAM = BiocParallel::bpparam()
)

Arguments

x

A HiCExperiment object over a full genome

resolution

Which resolution to use to compute eigen vectors

genome

a BSgenome of DNAStringSet object associated with the Hi-C contact matrix.

chromosomes

character or integer vector indicating which

neigens

Numver of eigen vectors to extract

sort_eigens

Can be FALSE or one of c('Spearman', 'Pearson')

BPPARAM

BiocParallel parallelization settings

Value

A HiCExperiment object with additional eigens metadata containing the normalized eigenvectors and a new "compartments" topologicalFeatures storing A and B compartments as a GRanges object.

Examples

library(HiContacts)
full_contacts_yeast <- contacts_yeast(full = TRUE)
#> see ?HiContactsData and browseVignettes('HiContactsData') for documentation
#> loading from cache
comps <- getCompartments(full_contacts_yeast)
#> Going through preflight checklist...
#> Parsing intra-chromosomal contacts for each chromosome...
#> Computing eigenvectors for each chromosome...
metadata(comps)$eigens
#> GRanges object with 763 ranges and 8 metadata columns:
#>                         seqnames        ranges strand |    bin_id     weight
#>                            <Rle>     <IRanges>  <Rle> | <numeric>  <numeric>
#>             I.I_1_16000        I       1-16000      * |         0  0.0196442
#>         I.I_16001_32000        I   16001-32000      * |         1  0.0220746
#>         I.I_32001_48000        I   32001-48000      * |         2  0.0188701
#>         I.I_48001_64000        I   48001-64000      * |         3  0.0136679
#>         I.I_64001_80000        I   64001-80000      * |         4  0.0134860
#>                     ...      ...           ...    ... .       ...        ...
#>   XVI.XVI_880001_896000      XVI 880001-896000      * |       758 0.00910873
#>   XVI.XVI_896001_912000      XVI 896001-912000      * |       759 0.01421350
#>   XVI.XVI_912001_928000      XVI 912001-928000      * |       760 0.02439992
#>   XVI.XVI_928001_944000      XVI 928001-944000      * |       761 0.01993237
#>   XVI.XVI_944001_948066      XVI 944001-948066      * |       762        NaN
#>                           chr    center           E1        E2          E3
#>                         <Rle> <integer>    <numeric> <numeric>   <numeric>
#>             I.I_1_16000     I      8000  0.047017577 -0.373610   0.0785339
#>         I.I_16001_32000     I     24000  1.294231824  0.334522  -1.2889302
#>         I.I_32001_48000     I     40000  0.111866073 -0.215149  -0.1284306
#>         I.I_48001_64000     I     56000 -0.000378168 -0.324072  -0.0859466
#>         I.I_64001_80000     I     72000  0.389569315 -0.480918  -0.3674692
#>                     ...   ...       ...          ...       ...         ...
#>   XVI.XVI_880001_896000   XVI    888000  -0.00143584 0.3904828  0.09137383
#>   XVI.XVI_896001_912000   XVI    904000   0.35018650 0.1384289  0.00781169
#>   XVI.XVI_912001_928000   XVI    920000   0.99967206 0.1838062 -0.04602689
#>   XVI.XVI_928001_944000   XVI    936000   0.83302465 0.0143616 -0.11450504
#>   XVI.XVI_944001_948066   XVI    946033   0.00000000 0.0000000  0.00000000
#>                                eigen
#>                            <numeric>
#>             I.I_1_16000  0.047017577
#>         I.I_16001_32000  1.294231824
#>         I.I_32001_48000  0.111866073
#>         I.I_48001_64000 -0.000378168
#>         I.I_64001_80000  0.389569315
#>                     ...          ...
#>   XVI.XVI_880001_896000  -0.00143584
#>   XVI.XVI_896001_912000   0.35018650
#>   XVI.XVI_912001_928000   0.99967206
#>   XVI.XVI_928001_944000   0.83302465
#>   XVI.XVI_944001_948066   0.00000000
#>   -------
#>   seqinfo: 16 sequences from an unspecified genome