corCladeProj: Estimating correlations between clades and projections of...

View source: R/func__corCladeProj.R

corCladeProjR Documentation

Estimating correlations between clades and projections of samples

Description

This function estimates point-biserial correlation coefficients between each clade and projections of samples on each axis defined by eigenvectors of positive eigenvalues. The output links projections (based on singular-value decomposition of the cgSNP matrix) to population structure. This function ignores the "root clade", which is the clade based on the root when the tree is rooted, because it does not show any variation in the presence/absence status of samples (all samples must be present in this super clade). P-values do not apply in this scenario because we are only describing the correlation between observations but not going to make any predictions.

Usage

corCladeProj(
  clades = NULL,
  projections = NULL,
  clade.sizes = NULL,
  n.cores = -1
)

Arguments

clades

A presence/absence matrix of samples in every clade. It can be generated with the function tree2Clades.

projections

A matrix of projections of samples on eigenvectors of positive eigenvalues. Rows are sample names and columns are axes. It can be obtained from the element C in the output of the function projectSamples.

clade.sizes

(Optional) A vector of named integers for sizes of every clade in C. It can be obtained from the element "sizes" in the output of the function tree2Clades. Providing this argument makes the function to run faster, although the function calculates clade sizes when this vector is absent. It is recommended to have the order of clade names in this vector identical to column names of the clades matrix, although the function makes a correction for the order when it mismatches.

n.cores

An integer determining the number of cores used for parallel computing. Valid values are the same as those for the findPhysLink function.

Dependency: parallel, data.table

Author(s)

Yu Wan (wanyuac@126.com)

Examples

C <- projectSamples(...)
clades <- tree2Clades(...)
r <- corCladeProj(clades = clades[["pam"]], projections = C[["C"]], clade.sizes = clades[["sizes"]], n.cores = 8)


wanyuac/GeneMates documentation built on Aug. 12, 2022, 7:37 a.m.