Category (version 2.38.0)

cb_contingency: Create and Test Contingency Tables of Chromosome Band Annotations

Description

For each chromosome band identifier in chrVect, cb_contingency builds and performs a test on a 2 x k contingency table for the genes from selids found in the child bands of the given chrVect element.

cb_sigBands extracts the chromosome band identifiers that were in a contingency table that tested significant given the specified p-value cutoff.

cb_children returns the child bands of a given band in the chromosome band graph. The argument must have length equal to one.

Usage

cb_contingency(selids, chrVect, chrGraph, testFun = chisq.test, min.expected = 5L, min.k = 1L)
cb_sigBands(b, p.value = 0.01)
cb_children(n, chrGraph)

Arguments

selids
A vector of the selected gene identifiers (usual Entrez IDs).
chrVect
A character vector of chromosome band identifiers
chrGraph
A graph object as returned by makeChrBandGraph. The nodes should be chromosome band IDs and the edges should represent the tree structure of the bands. Furthermore, the graph is expected to have a "geneIds" node attribute providing a vector of gene IDs annotated at each band.
testFun
The function to use for testing the 2 x k contingency tables. The default is chisq.test. It will be called with a single argument, a 2 x k matrix representing the contingency table.
min.expected
A numeric value specifying the minimum expected count for columns to be included in the contingency table. The expected count is (rowSum * colSum) / n. Chromosome bands with a select cell count less than min.expected are dropped from the table before testing occurs. If NULL, then no bands will be dropped.
min.k
An integer giving the minimum number of chromosome bands that must be present in a contingency table in order to proceed with testing.
b
A list as returned by cb_contingency
p.value
A p-value cutoff to use in selecting significant contingency tables.
n
A length one character vector specifying a chromosome band annotation. Bands not found in chrGraph will return character(0) when passed to cb_children.

Value

cb_contingency returns a list with an element for each test performed. This will most often be shorter than length(chrVect) due to skipped tests based on min.found and min.k. Each element of the returned list is itself a list with components:
table
A 2 x k contingency table
result
The output of testFun applied to the table.
cb_sigBands returns a character vector of chromosome band identifiers that are in one of the contingency tables that had a p-value less than the cutoff specified by p.value.

Details

cb_sigBands assumes that the p-value associated with a result of testFun can by accessed as testFun(t)$p.value. We should improve this to be a method call which can then be specialized based on the class of the object returned by testFun.