Learn R Programming

CloneSeeker (version 1.0.13)

Simplices: Simplices and Clonal Fractions

Description

Utility functions for working with vectors of clonal fractions.

Usage

sampleSimplex(n, d = 5)
generateSimplex(k, d, reps = 1)

Value

Both functions return a matrix with d columns. Each row contains nonzeo real numbers that sum to 1. The generateSimplex

function ensures that (a) each row is unique and (b) the entries in each row appear in decreasing order.

Arguments

d

an integer, the dimension of the simplex, or the number of clones.

n

an integer, the number of vectors to sample randomly.

k

an integer, the number of equally spaced points to select along each side of the simplex while constructing a lattice.

reps

an integer, the number of times to repeat the lattice.

Author

Kevin R. Coombes krc@silicovore.com, Mark Zucker zucker.64@buckeyemail.osu.edu

Details

When studying the clonal subpopulations of a tumor sample, we frequently need access to vectors that contain the fraction of cells belonging to each clone. These vectors are characterized by the fact that each entry is nonzero and they must add up to 1. The set of such vectors/points in d-dimensional space defines the "d-simplex". The functions defined here allow us to work with d-simplices, either by randomly sampling vectors (sampleSimplex) or by systematically filling the space with a regular lattice (generateSimplex).

Examples

Run this code
sampleSimplex(5, 3)
generateSimplex(5, 3)

Run the code above in your browser using DataLab