Learn R Programming

EMDomics (version 2.2.2)

calculate_ks_gene: Calculate KS score for a single gene

Description

Calculate KS score for a single gene

Usage

calculate_ks_gene(vec, outcomes, sample_names)

Arguments

vec
A named vector containing data (e.g. expression data) for a single gene.
outcomes
A vector of group labels for the samples. The names must correspond to the names of vec.
sample_names
A character vector with the names of the samples in vec.

Value

The KS score is returned.

Details

All possible combinations of the classes are used as pairwise comparisons. The data in vec is divided based on class labels based on the outcomes identifiers given. For each pairwise computation, ks.test is used to compute the pairwise KS scores. The total KS score for the given data is the average of the pairwise KS scores.

See Also

ks.test

Examples

Run this code
# 100 genes, 100 samples
dat <- matrix(rnorm(100000), nrow=100, ncol=1000)
rownames(dat) <- paste("gene", 1:100, sep="")
colnames(dat) <- paste("sample", 1:1000, sep="")

# assign outcomes
outcomes <- c(rep(1,500), rep(2,300), rep(3,200))
names(outcomes) <- colnames(dat)

calculate_ks_gene(dat[1,], outcomes, colnames(dat))

Run the code above in your browser using DataLab