Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "CCC-GPU: A graphics processing unit (GPU)-accelerated nonlinear correlation coefficient for large-scale transcriptomic analyses"
doi: 10.1093/bioinformatics/btag068
version: v1.0.0
version: 0.2.4
date-released: 2026-01-16
authors:
- family-names: Zhang
Expand Down Expand Up @@ -31,7 +31,7 @@ keywords:
- gene expression
- RNA-seq analysis
- nonlinear patterns
license: MIT
license: BSD-2-Clause-Patent
repository-code: https://github.com/pivlab/ccc-gpu
preferred-citation:
type: article
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 3.15...3.26)
# Single CMake floor for the project; keep in sync with `cmake.version` in
# pyproject.toml ([tool.scikit-build]). The `...4.0` policy ceiling opts into
# modern CMake behavior up to 4.0.
cmake_minimum_required(VERSION 3.26...4.0)
project(${SKBUILD_PROJECT_NAME} LANGUAGES CUDA CXX)

# When ON, build the CUDA C++ gtests under tests/cuda_ext/ and register them with
Expand Down
63 changes: 55 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Clustermatch Correlation Coefficient GPU (CCC-GPU)

[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/License-BSD--2--Clause--Patent-orange.svg)](https://opensource.org/license/bsdpluspatent)
[![Python 3.10+](https://img.shields.io/badge/python-3.10--3.14-blue.svg)](https://www.python.org/downloads/)
[![CUDA](https://img.shields.io/badge/CUDA-12.0+-green.svg)](https://developer.nvidia.com/cuda-downloads)
[![Documentation](https://img.shields.io/badge/docs-readthedocs-blue.svg)](https://ccc-gpu.readthedocs.io/en/latest/)

Expand All @@ -25,16 +25,16 @@ Original notebooks and scripts used for the manuscript, as well as other analyse
### Requirements

**Hardware:**
- Nvidia GPU with CUDA Compute Capability 8.6 or higher
- Nvidia GPU with CUDA Compute Capability 7.5 or higher (wheels ship native code for 7.5, 8.0, 8.6, 8.9, and 9.0)

**Software:**
- OS: Linux x86_64 distributions using glibc 2.28 or later, including:
- Debian 10+
- Ubuntu 18.10+
- Fedora 29+
- CentOS/RHEL 8+
- Python 3.10 to 3.13 (3.14 will be supported soon)
- Nvidia driver with CUDA 12.5 or higher (for GPU acceleration)
- Python 3.10 to 3.14
- Nvidia driver with CUDA 12.0 or higher (for GPU acceleration)

> **Note**: You can use command `nvidia-smi` to check your Nvidia driver and CUDA version.

Expand All @@ -45,7 +45,7 @@ Original notebooks and scripts used for the manuscript, as well as other analyse

```bash
# Create conda environment if you want to test it out in a separate environment
# conda create -n ccc-gpu -c conda-forge python=3.10 (or 3.11, 3.12, 3.13)
# conda create -n ccc-gpu -c conda-forge python=3.12 # any of 3.10-3.14
# conda activate ccc-gpu

# Install cccgpu from PyPI
Expand Down Expand Up @@ -168,7 +168,7 @@ ccc(

- **`n_jobs`** *(int, default=1)*: Number of CPU cores/threads for internal parallelization. `None` uses all available cores. Negative values use `os.cpu_count() + n_jobs`. Must yield a value >= 1.

- **`pvalue_n_perms`** *(int, optional)*: If provided and > 0, computes p-value using the specified number of permutations. If None or 0, p-values are not computed.
- **`pvalue_n_perms`** *(int, optional)*: If provided and > 0, also estimates a one-sided permutation p-value for each coefficient using the specified number of permutations. If None or 0, p-values are not computed. See [Computing p-values](#computing-p-values) below.

- **`partitioning_executor`** *(str, default="thread")*: Executor type for data partitioning. `"thread"` uses ThreadPoolExecutor (less memory), `"process"` uses ProcessPoolExecutor (potentially faster), any other value disables parallelization for partitioning.

Expand All @@ -193,6 +193,42 @@ Return type varies based on input dimensionality and parameters:
- Uses GPU acceleration (CUDA) for coefficient computation
- NaN values in input data are not supported

### Computing p-values

Passing `pvalue_n_perms` estimates a **one-sided permutation p-value** for each
coefficient. One feature's partitions are shuffled `pvalue_n_perms` times and the
CCC is recomputed to build an empirical null distribution; the p-value is

```
p = (#{permuted CCC >= observed CCC} + 1) / (pvalue_n_perms + 1)
```

```python
import numpy as np
from ccc.coef.impl_gpu import ccc

np.random.seed(123)
x = np.random.randn(300)
y = x + np.random.randn(300) * 0.5

coef, pvalue = ccc(x, y, pvalue_n_perms=1000)
print(f"CCC: {coef:.3f}, p-value: {pvalue:.3f}")
```

- **Interpretation:** the test is one-sided — a *smaller* p-value is stronger
evidence of a non-chance association. The smallest resolvable p-value is
`1 / (pvalue_n_perms + 1)` (≈ `1e-3` for 999 permutations), so pick
`pvalue_n_perms` for the resolution you need.
- **Shapes:** a 1d pair returns `(coef, pvalue)`; a 2d input returns a
`(coefficients, p-values)` tuple of aligned arrays.
- **Cost:** for a 2d input a p-value is computed for each of the `n*(n-1)/2`
pairs, each costing `pvalue_n_perms` extra CCC evaluations — this can be far
more expensive than the point estimate, so prefer small inputs or a modest
permutation count and parallelize with `n_jobs`.

See the [Computing p-values](https://ccc-gpu.readthedocs.io/en/latest/usage.html#computing-p-values)
docs section for the full method and interpretation.

### Working with Gene Expression Data

CCC-GPU is particularly useful for genomics applications:
Expand Down Expand Up @@ -270,6 +306,17 @@ CCC-GPU provides significant performance improvements over CPU-only implementati

*Benchmarks performed on synthetic gene expression data with 1000 fixed samples. Hardware: AMD Ryzen Threadripper 7960X CPU and an NVIDIA RTX 4090 GPU. Git commit on which the benchmark results were collected: 05f129dfa47ad801eff963b4189484c7c64bd28e*

The table above was produced with the bundled `ccc-gpu-bench` CLI (installed with the package):

```bash
# Fast sanity sweep
ccc-gpu-bench coef --preset smoke
# Reproduce the sweep behind the table (long-running; run on the reference GPU box)
ccc-gpu-bench coef --preset paper --format csv -o coef_paper.csv
```

See the [Benchmarking](https://ccc-gpu.readthedocs.io/en/latest/benchmarking.html) docs for all modes and the output schema.

## Documentation

Build and view the full documentation locally:
Expand Down Expand Up @@ -304,7 +351,7 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major

## License

This project is licensed under the BSD 2-Clause License - see the [LICENSE](LICENSE) file for details.
This project is licensed under the BSD-2-Clause Plus Patent License (SPDX: `BSD-2-Clause-Patent`) - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

Expand Down
Loading
Loading