calculate_ks_gene {EMDomics} | R Documentation |
Calculate KS score for a single gene
calculate_ks_gene(vec, outcomes, sample_names)
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 |
sample_names |
A character vector with the names of the samples in |
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.
The KS score is returned.
# 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))