generate_permutations: Random permutation matrix generator

View source: R/cadra_functions.R

generate_permutationsR Documentation

Random permutation matrix generator

Description

Produces a random permutation score matrix given a vector of sample-specific scores representing a phenotypic readout of interest such as protein expression, pathway activity, etc.

Usage

generate_permutations(input_score, n_perm)

Arguments

input_score

a vector of continuous scores of a molecular phenotype of interest such as protein expression, pathway activity, etc. NOTE: The input_score object must have names or labels to track samples by.

n_perm

a number of permutations to generate. This determines the number of rows in the permutation matrix.

Value

a matrix of values where each row contains scores of a single permuted input_score.

Examples


# Load pre-simulated scores
data(sim_Scores)

# Set seed for permutation
set.seed(123)

# Define number of permutations
n_perm = 1000

# Generate permuted scores
perm_matrix <- generate_permutations(
  input_score = sim_Scores,
  n_perm = n_perm
)


montilab/CaDrA documentation built on Aug. 22, 2024, 11:55 p.m.