getABSignal: Calculate Pearson correlations of smoothed eigenvectors

Description Usage Arguments Value Examples

View source: R/getABSignal.R

Description

This function is used to generate a list x to be passed to getABSignal

Usage

1
getABSignal(x, k = 5, iter = 2, squeeze = FALSE)

Arguments

x

A list object from getCorMatrix

k

Value of k for smoothing (default = 2)

iter

Number of iterations for moving average smoothing (default = 2)

squeeze

Whether squeezing was used (implies Fisher's Z transformation)

Value

A list x to pass to getABSignal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
library(GenomicRanges)
library(Homo.sapiens)
library(mixOmics)

#Generate random genomic intervals of 1-1000 bp on chr1-22
#Modified from https://www.biostars.org/p/225520/
random_genomic_int <- data.frame(chr = rep("chr14", 100))
random_genomic_int$start <- apply(random_genomic_int, 1, function(x) { round(runif(1, 0, seqlengths(Homo.sapiens)[x][[1]]), 0) })
random_genomic_int$end <- random_genomic_int$start + runif(1, 1, 1000)
random_genomic_int$strand <- "*"

#Generate random counts
counts <- rnbinom(1000, 1.2, 0.4)

#Build random counts for 10 samples
count.mat <- matrix(sample(counts, nrow(random_genomic_int) * 10, replace = FALSE), ncol = 10)
colnames(count.mat) <- paste0("sample_", seq(1:10))

#Bin counts
bin.counts <- getBinMatrix(count.mat, makeGRangesFromDataFrame(random_genomic_int), chr = "chr14", genome = "hg19")

#Calculate correlations
bin.cor.counts <- getCorMatrix(bin.counts)

#Get A/B signal
absignal <- getABSignal(bin.cor.counts)

compartmap documentation built on Nov. 8, 2020, 5:34 p.m.