FastWilcox
Fast Wilcoxon rank-sum test for differential expression analysis in single-cell genomics.
This is a Python implementation of the wilcoxauc from the R' presto package, providing high-performance statistical testing for single-cell RNA-seq data.
Features
- Fast Wilcoxon rank-sum test with AUC calculation
- Multiple matrix formats supported: Dense, CSR, and CSC sparse matrices
- Optimized for single-cell data with efficient handling of sparse matrices
- FDR correction using Benjamini-Hochberg method
- Compatible with AnnData objects
Installation
cd python
pip install fastwilcox
For development:
pip install -e ".[dev]"
Usage
import anndata as ad
from fastwilcox import wilcoxauc
# Load your data
adata = ad.read_h5ad("your_data.h5ad")
# Run Wilcoxon test
results = wilcoxauc(
x=adata.X,
y=adata.obs['cell_type'].values,
groups_use=None, # Optional: test specific groups
y_order=None, # Optional: specify group order
comparison=None # Optional: pairwise comparison label
)
# Results is a list of WilcoxResult objects
for res in results:
print(f"Feature {res.feature}, Group {res.group}: "
f"logFC={res.log_fc:.3f}, AUC={res.auc:.3f}, "
f"p-adj={res.padj:.3e}")
API Reference
wilcoxauc(x, y, groups_use=None, y_order=None, comparison=None)
Perform Wilcoxon rank-sum test for differential expression.
Parameters:
x: Matrix (Dense array, CSR, or CSC sparse matrix) where rows are samples and columns are featuresy: List/array of group labels (strings)groups_use: Optional list of groups to test (default: all groups)y_order: Optional list specifying the order of groupscomparison: Optional comparison pattern for pairwise tests
Returns:
- List of
WilcoxResultobjects with fields:feature: Feature indexgroup: Group nameavg_expr: Average expression in grouplog_fc: Log fold change (in-group mean - out-group mean)ustat: U-statisticauc: Area under ROC curvepval: P-valuepadj: FDR-adjusted p-valuepct_in: Percentage of cells expressing in grouppct_out: Percentage of cells expressing out of groupcomparison: Comparison label, useful when only compare two group
Testing
Run tests:
cd python
pytest tests/
Run tests with coverage:
pytest tests/ --cov=fastwilcox --cov-report=html
Performance
This implementation is optimized for:
- Large sparse matrices (common in single-cell RNA-seq)
- Efficient group-wise operations
- Vectorized numpy operations
For the best performance with sparse data, use CSC format.
License
MIT License
Citation
If you use this software, please cite the fastwilcox project.
Metadata
Release files for fastwilcox 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastwilcox-0.1.0.tar.gz | 14.2 kB | Without provenance | Details for fastwilcox-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastwilcox-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fastwilcox-0.1.0-py3-none-any.whl |
Total release size: 25.8 kB
Release files / fastwilcox-0.1.0.tar.gz
| Download URL | fastwilcox-0.1.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6f381d1e8df9d272cd35b4f30b05a362cef810bd335b5d9446c34ece9259be2
|
|
BLAKE2b-256 checksum How to use checksums |
e42ad62660db6e8dd2fa04cb19f534ede338504654d89139eb030846365cb176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / fastwilcox-0.1.0-py3-none-any.whl
| Download URL | fastwilcox-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
392a1fbcd6ca70226bf664e43f47b3ef636f0bde889ff7269f4c35edefeb529f
|
|
BLAKE2b-256 checksum How to use checksums |
cd61d61c158d79fdab8865a0a42ad93f7ffb9c1743cab5f8bbfe4e72ff13a495
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for fastwilcox 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.