calculate_ks_gene: Calculate KS score for a single gene

Description Usage Arguments Details Value See Also Examples

View source: R/KS.R

Description

Calculate KS score for a single gene

Usage

1
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.

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.

Value

The KS score is returned.

See Also

ks.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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))

EMDomics documentation built on Nov. 8, 2020, 5:30 p.m.