# apl_coords: Calculate Association Plot coordinates In elagralinska/APLpackage: Association Plots

## Description

Calculates the association plot coordinates for either the rows, columns or both (default).

## Usage

 1 apl_coords(caobj, group, calc_rows = TRUE, calc_cols = TRUE) 

## Arguments

 caobj A "cacomp" object with principal row coordinates and standard column coordinates calculated. group Numeric/Character. Vector of indices or column names of the columns to calculate centroid/x-axis direction. calc_rows TRUE/FALSE. Whether apl row coordinates should be calculated. Default TRUE. calc_cols TRUE/FALSE. Whether apl column coordinates should be calculated. Default TRUE.

## Details

Coordinates (x,y) of row vector \vec{r} are defined as

x(\vec{r}) := ≤ft|\vec{r}\right|\cos(φ(\vec{r}))

y(\vec{r}) := ≤ft|\vec{r}\right|\sin(φ(\vec{r}))

The x-direction is determined by calculating the centroid of the columns selected with the indices in "group".

## Value

Returns input "cacomp" object and adds components "apl_rows" and/or "apl_cols" for row and column coordinates. In "group" the indices of the columns used to calculate the centroid are saved.

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 set.seed(1234) # Simulate scRNAseq data. cnts <- data.frame(cell_1 = rpois(10, 5), cell_2 = rpois(10, 10), cell_3 = rpois(10, 20), cell_4 = rpois(10, 20)) rownames(cnts) <- paste0("gene_", 1:10) cnts <- as.matrix(cnts) # Run correspondence analysis. ca <- cacomp(obj = cnts, princ_coords = 3) # Calculate APL coordinates: ca <- apl_coords(ca, group = 3:4) 

elagralinska/APLpackage documentation built on Dec. 20, 2021, 4:15 a.m.