inmoose.edgepy.binomTest
- inmoose.edgepy.binomTest(y1, y2, n1=None, n2=None, p=None)
Computes p-values for differential abundance for each gene between two digital libraries, conditioning on the total counts for each gene. The counts in each group as a proportion of the whole are assumed to follow a binomial distribution.
This function can be used to compare two libraries from SAGE, RAN-Seq, ChIP-Seq or other sequencing technologies with respect to technical variation.
An exact two-sided binomial test is computed for each gene. This test is closely related to Fisher’s exact test for 2x2 contingency tables but, unlike Fisher’s test, it conditions on the total number of counts for each gene. The null hypothesis is that the expected counts are in the same proportions as the library sizes, i.e. that the binomial probability for the first library is
n1 / (n1+n2).The two-sided rejection region is chosen analogously to Fisher’s test. Specifically, the rejection region consists of those values with smallest probabilities under the null hypothesis.
Then the counts are reasonably large, the binomial test, Fisher’s test and Pearson’s chi square all give the same results. When the counts are smaller, the binomial test is usually to be preferred in this context.
References
Binomial test Fisher’s exact test Serial analysis of gene expression
- Parameters:
y1 (array_like) – integer array giving the count for each gene in the first library. Non-integer values are rounded to the nearest integer.
y2 (array_like) – integer array giving the count for each gene in the second library. Non-integer values are rounded to the nearest integer.
n1 (int) – total number of counts in the first library, across all genes. Not required if
pis supplied.n2 (int) – total number of counts in the second library, across all genes. Not required if
pis supplied.p (float) – expected proportion of
y1to the total for each gene under the null hypothesis.
- Returns:
array of p-values
- Return type:
ndarray