calculate_cvm_gene: Calculate CVM score for a single gene

Description Usage Arguments Details Value See Also Examples

View source: R/CVM.R

Description

Calculate CVM score for a single gene

Usage

1
calculate_cvm_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, the hist function is used to generate histograms for the two groups. The densities are then retrieved and passed to CramerVonMisesTwoSamples to compute the pairwise CVM score. The total CVM score for the given data is the average of the pairwise CVM scores.

Value

The cvm score is returned.

See Also

CramerVonMisesTwoSamples

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 100 genes, 100 samples
dat <- matrix(rnorm(10000), nrow=100, ncol=100)
rownames(dat) <- paste("gene", 1:100, sep="")
colnames(dat) <- paste("sample", 1:100, sep="")

# "A": first 50 samples; "B": next 30 samples; "C": final 20 samples
outcomes <- c(rep("A",50), rep("B",30), rep("C",20))
names(outcomes) <- colnames(dat)

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

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