correlations_to_densities: Transform the correlation table to density distributions of...

Description Usage Arguments Value Examples

View source: R/correlations_to_densities.R

Description

Takes the output of correlate_windows and computes density curves of correlation coefficient for each window comparison.

Usage

1
correlations_to_densities(df, n = 64, absolute_cc = TRUE)

Arguments

df

A data frame, usually the output of correlate_windows.

n

Resolution of the correlation density curve. Default to 64.

absolute_cc

Should the function use the absolute value of correlation coefficients? Default to TRUE to simplify plots and avoid annoying, non-symmetrical, near 0, shifts of distributions.

Value

A tibble with columns bin, window, cor_coef and density.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(magrittr)
expMat <- matrix(
    c(1, 1, 5,
      1, 2, 3,
      0, 1, 4,
      0, 0, 2),
    ncol = 3, byrow = TRUE, dimnames = list(paste("gene", 1:4), paste("cell", 1:3))
)

calculate_cvs(expMat) %>%
    define_top_genes(window_size = 2) %>%
    bin_scdata(window_number = 1) %>%
    correlate_windows %>%
    correlations_to_densities

scFeatureFilter documentation built on Nov. 8, 2020, 7:49 p.m.