calculate_emd_gene: Calculate EMD score for a single gene

Description Usage Arguments Details Value See Also Examples

Description

Calculate EMD score for a single gene

Usage

1
calculate_emd_gene(vec, samplesA, samplesB, binSize = 0.2)

Arguments

vec

A named vector containing data (e.g. expression data) for a single gene.

samplesA

A vector of sample names identifying samples in vec that belong to "group A".

samplesB

A vector of sample names identifying samples in vec that belong to "group B".

binSize

The bin size to be used when generating histograms for "group A" and "group B".

Details

The data in vec is divided into "group A" and "group B" by the identifiers given in samplesA and samplesB. The hist function is used to generate histograms for the two resulting groups, and the densities are retrieved and passed to emd2d to compute the EMD score.

Value

The emd score is returned.

See Also

emd2d

Examples

1
2
3
4
5
6
7
8
9
# 100 samples
vec <- rnorm(100)
names(vec) <- paste("sample", 1:100, sep="")

# "group A" = first 50, "group B" = second 50
groupA <- names(vec)[1:50]
groupB <- names(vec)[51:100]

calculate_emd_gene(vec, groupA, groupB)

schmolze/emd documentation built on May 29, 2019, 3:42 p.m.