Python implementation of the SuperExactTest algorithm
Please refer to the documentation. In particular, the
Superextractestpy is a python reimplementation of the R package SuperExactTest allowing to perform tests on the statistical distribution as well as to visualize multiset intersection.
This algorithm calculates the intersection probability of a large number of genes in a genetic set with linear complexity.
Import the package
import superexacttestpy as stest
For example, we want to make the test on this fictive set:
Set1 = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
]
Set2 = ["L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
Set3 = ["H", "I", "J", "K", "L", "M", "N", "O", "P", "Q"]
data = [Set1, Set2, Set3]
names = ["Set1", "Set2", "Set3"]
background_size = 1000
If you just want the data frame with the results, you can use the function stest.tl.supertest()
stest.tl.supertest(data=data, n=background_size, names=names).head()
The function tl.supertest
has some optional arguments:
degree
: the degree of the intersection you want to compute.lower_tail
: Let m be the number of elements shared in the sets : if True, p = P[overlap < m] and if False, p = P[overlap >= m].
If you want to plot the results, you can use the function stest.pl.plot()
stest.pl.plot(data=data, n=background_size, names=names)
The function plot has some optional arguments:
degree
: the degree of the intersection you want to compute.sort_by
: on what you want to sort the bars "degree" or "p_val"show_count
: if True, the number of genes in the intersection is shown.size
: tuple of the figsizebackground_color
: the color of the background of the plot.
Plotting function output
Additional functions are available and will be described in the readthedocs
You need to have Python 3.8 or newer installed on your system. If you don't have
Python installed, we recommend installing Miniconda <https://docs.conda.io/en/latest/miniconda.html>
_.
There are several alternative options to install superexacttestpy:
-
Install the latest release of
superexacttestpy
fromPyPI <https://pypi.org/project/superexacttestpy/>
_:pip install superexacttestpy
-
Install the latest development version:
pip install git+https://github.com/theislab/superexacttestpy.git@main
See the changelog.
For questions and help requests, you can reach out in the scverse discourse. If you found a bug, please use the issue tracker.
If superexactestpy is relevant for your work, please cite the following:
@software{superexacttest,
author = {Ibarra, Mauger-Birocheau},
doi = {},
month = {},
title = {{superexacttest}},
url = {https://github.com/theislab/superexacttestpy},
year = {2022}
}
Wang, M., Zhao, Y. & Zhang, B. Efficient Test and Visualization of Multi-Set Intersections. Sci Rep 5, 16923 (2015). doi