get_pairwise_rank_matrices: Calculate feature pair scores

Description Usage Arguments Value Examples

View source: R/get_pairwise_rank_matrices.R

Description

This function compares the magnitude of the features in pairwise fashion (e.g Xi vs Xj). This is done across all (non-restricted) gene pairs per sample, and generates a list of num_samples matrices, where each matrix is an num_rows x num_rows matrix with either a) an indicator variable (1 if Xi > Xj) or b) a rank difference between features (rank(Xi) - rank(Xj))

Usage

1
get_pairwise_rank_matrices(X, restrict = FALSE, use_diff_rank = TRUE)

Arguments

X

a feature matrix with samples as cols and features as rows (NOTE: this is a transpose of how a feature matrix is frequently thought of)

restrict

Defaults to FALSE. Otherwise, must be a vector of feature names to restrict analysis to. If provided, the output matrices will only contain pairwise feature scores for comparisons that always include at least one of the features from the restrict vector.In other words, the rows of the output matrices will be restricted to the features in restrict although the cols will still include all features This way, all restrict features are compared to all other features, which allows for the inclusion of non-restrict features in pairs, which may reflect important feature relationships. Otherwise, if restrict == false, all features will be considered.

use_diff_rank

a logical. If FALSE, pairwise feature scores are indicators of whether Xi > Xj. If TRUE, pairwise feature scores are differences in rank

Value

a list of matrices, with each matrix containing a score reflecting a pairwise comparison between features, per sample (i.e. each matrix reflects pairwise feature scores per sample)

Examples

1
2
3
4
C <- 100  # represents samples
R <- 200 # represents features
X <- matrix(rbeta(R*C, 2, 3), nrow = R)  # simulate data matrix
Is <- get_pairwise_rank_matrices(X)

mdkessler/kTSCR documentation built on Feb. 25, 2021, 10:31 p.m.