Skip to main content

SignifiKANTE

Python Tests Status Code Coverage PyPI Version Supported Python Versions

SignifiKANTE builds upon the arboreto software library to enable regression-based gene regulatory network inference and efficient, permutation-based empirical P-value computation for predicted regulatory links.

Installation

SignifiKANTE is installable via pip from PyPI using

pip install signifikante

or locally from this repository with

git clone git@github.com:bionetslab/SignifiKANTE.git
cd SignifiKANTE
pip install -e .

Optional dependencies

The core install is dependency-light and requires no build toolchain. Two optional extras are available:

  • kmedoids — enables the KMedoids-based clustering modes (target_cluster_mode="wasserstein-kmedoids" and the "kmeans" modes). It pulls in scikit-learn-extra, which ships no pre-built wheels and is therefore compiled from source at install time — you need a C compiler (e.g. gcc) and the Python development headers. If you invoke a KMedoids mode without this extra, SignifiKANTE raises an informative ImportError.

  • test — everything needed to run the test suite (pytest, and the kmedoids extra, since the tests exercise the KMedoids paths).

Install an extra with

pip install 'signifikante[kmedoids]'      # KMedoids clustering modes
pip install -e '.[test]'                   # development / running the tests

For installation with pixi, download pixi, install and run

git clone git@github.com:bionetslab/SignifiKANTE.git
cd SignifiKANTE
pixi install

Create a jupyter kernel using pixi.toml/pyproject.toml, which will install a jupyter kernel using a custom environment (including ipython)

git clone git@github.com:bionetslab/SignifiKANTE.git
cd SignifiKANTE
pixi run -e kernel install-kernel

Example workflow of SignifiKANTE’s FDR control

We provide an efficient FDR control for regulatory links based on any given regression-based GRN inference method. Currently, for GRN inference SignifiKANTE includes GRNBoost2, GENIE3, extra trees, xgboost, lasso, support vector regression, Bayesian ridge regression, ElasticNet, and orthogonal matching pursuit. For the integration of further regression-based GRN inference methods, please see our manual in the section below. Here, we also provide a minimal working example of how to use SignifiKANTE based on GRNBoost2 on a simulated dataset:

import pandas as pd
import numpy as np
from signifikante.algo import signifikante_fdr

if __name__ == "__main__":

    # Simulate expression dataset with 100 samples and 10 genes.
    expression_data = np.random.randn(100, 10)
    expression_df = pd.DataFrame(expression_data, columns=[f"Gene{i}" for i in range(10)])
    # Simulate three artificial TFs.
    tf_list = [f"Gene{i}" for i in range(3)]

    # Run SignifiKANTE's approximate FDR control.
    fdr_grn = signifikante_fdr(
                expression_data=expression_df,
                normalize_gene_expression=True,
                tf_names=tf_list,
                cluster_representative_mode="random",
                num_target_clusters=100,
                inference_mode="grnboost2",
                apply_bh_correction=True)
    print(fdr_grn)

Parameter descriptions

Below, you can find a more detailed description of the parameters of SignifiKANTE’s central function for FDR control signifikante_fdr. The two absolutely necessary input parameters are:

  • expression_data [pd.DataFrame]: Expression matrix with genes as columns and samples as rows.

  • cluster_representative_mode [str]: How to draw representatives from target gene clusters. Can be one of “random” or “medoid” for approximate P-value computation, or “all_genes” for exact (DIANE-like) P-values.

Additional parameters of SignifiKANTE’s FDR control:

  • normalize_gene_expression [bool] : Whether or not to apply z-score normalization on gene columns in input expression matrix.

  • inference_mode [str]: Which GRN inference method to use under the hood. Can be one of “grnboost2”, “genie3”, “extra_trees” (extremely randomized trees), “xgboost”, “lasso” (Lasso regression), “svr” (support vector regression), “ridge” (Bayesian ridge regression), “elastic” (ElasticNet regression), and “omp” (Orthogonal matching pursuit). Defaults to “grnboost2”.

  • num_permutations [int]: How many permutations to perform for random background model for empirical P-value computation. Defaults to 1000.

  • tf_names [list]: List of strings representing TF names. Should be subset of gene names contained in expression_data. Defaults to None. If no list is given, all genes are treated as potential TFs.

  • apply_bh_correction [bool]: Whether or not to additionally return Benjamini-Hochberg adjusted P-values.

  • apply_westfall_young [bool]: Whether or not to additionally return Westfall-Young corrected P-values.

  • target_cluster_mode [str]: Indicates, which clustering to use for target gene clustering. Defaults to hierarchical clustering based on the wasserstein distance matrix (“wasserstein”). You can alternatively choose to cluster the wasserstein distance matrix using K-medoids clustering (“wasserstein-kmedoids”) or spectral clustering (“wasserstein-spectral”), or K-medoids clustering on PCA-reduced expression (“kmeans”). The K-medoids based modes (“wasserstein-kmedoids” and “kmeans”) require the optional kmedoids extra (see Installation).

  • input_grn [pd.DataFrame]: Reference GRN to use for FDR control. Needs to possess columns ‘TF’, ‘target’, ‘importance’. Should only be used, when it is clear that this GRN is inferred using the same method indicated in inference_mode. Defaults to None. If no reference GRN is given, a new one is inferred in the beginning.

  • target_subset [list]: Subset of target genes to consider for FDR control. Only compatible with “all_genes” FDR mode.

  • num_target_clusters [int]: Number of target gene clusters. If set to -1, no target gene clustering will be applied. Defaults to 10.

  • num_tf_clusters [int]: Experimental feature. Used for setting the number of desired TF clusters, if set to -1, no TF clustering will be applied. Defaults to -1.

  • tf_cluster_mode [str]: Experimental feature. Indicates, which clustering mode to use for TF clustering. Can be “correlation” or “kmeans” (the latter requires the optional kmedoids extra). Defaults to “correlation”.

  • scale_for_tf_sampling [bool]: Experimental feature. Whether or not to keep track of occurences of edges in permuted GRNs. Defaults to False.

  • return_cluster_ids [bool]: Whether or not to add a cluster_id column to the returned DataFrame, indicating the target gene cluster each edge belongs to. Defaults to False.

Further more technical parameters:

  • client_or_address [str,Dask.Client]: Whether to perform computation on given input Dask Cluster object, or to create a new local one (“local”). Defaults to “local”.

  • early_stop_window_length [int]: Window length to use for early stopping. Defaults to 25.

  • seed [int]: Random seed for regressor models. Defaults to None.

  • verbose [bool]: Whether or not to print detailed additional information. Defaults to False.

  • output_dir [str]: Where to save additional intermediate data to. Defaults to None, i.e. saves no intermediate results.

The function returns a pandas dataframe representing the reference GRN with columns ‘TF’, ‘target’, and ‘importance’. The column ‘pvalue’ stores empirical P-values per edge. If apply_bh_correction=True, an additional column ‘pvalue_bh’ with Benjamini-Hochberg adjusted P-values is returned; if apply_westfall_young=True, a ‘pvalue_westfall_young’ column is added; and if return_cluster_ids=True, a ‘cluster_id’ column is added.

Integration of additional regression-based GRN inference methods

In order to integrate new regression-based GRN inference methods into SignifiKANTE, simply use the following steps, which exemplify the integration of lasso regression as implemented in the GRENADINE package:

  1. Give your regression-based method an abbreviated string-based name (regressor_type) and name the variable storing its model-specific parameters (regressor_args), then add those to the existing accepted values of the inference_mode parameter within the function signifikante_fdr in the file algo.py, directly below the indicated line stating UPDATE FOR NEW GRN METHOD. In the case of lasso regression, we simply added the regressor type “LASSO” and the regressor parameters stored in LASSO_KWARGS in the respective code block:

# UPDATE FOR NEW GRN METHOD
if inference_mode == "grnboost2":
    regressor_type = "GBM"
    regressor_args = SGBM_KWARGS
# other existing methods...
elif inference_mode == "lasso":
    regressor_type = "LASSO"
    regressor_args = LASSO_KWARGS

Since the actual parameters of LASSO_KWARGS will be defined in another file, you need to make sure to import the variable into algo.py. To achieve this, simply add your new regressor’s arguments variable at the top of algo.py, directly below the indicated line stating UPDATE FOR NEW GRN METHOD, just like this:

# UPDATE FOR NEW GRN METHOD
from signifikante.core import (
    create_graph, SGBM_KWARGS, RF_KWARGS, EARLY_STOP_WINDOW_LENGTH, ET_KWARGS, XGB_KWARGS, LASSO_KWARGS
)
  1. Now we switch to the file core.py. At the top of the file, add any required import-statements for your regression to work (e.g. imports of sklearn). Below import statements, create a dictionary named exactly like the regressor’s arguments variable you imported in algo.py. You can include it directly below the line stating # UPDATE FOR NEW GRN METHOD, analogously to how we did it for the lasso regression:

from sklearn.linear_model import Lasso
# ... other code in between
LASSO_KWARGS = {
'alpha' : 0.01
}

The actual logic of your new regression-based inference method will be implemented in the function fit_model. There, you should implement a new local function that contains the logic of your new model, given a tf_matrix and a target_gene_expression vector, such as we did for lasso regression:

def do_lasso_regression():
    regressor = Lasso(**regressor_kwargs, random_state=seed)
    regressor.fit(tf_matrix, target_gene_expression)
    return regressor

Directly below, add another case distinction for your regressor_type which calls your locally defined function. The exact position is indicated by the line stating # UPDATE FOR NEW GRN METHOD:

# UPDATE FOR NEW GRN METHOD
if is_sklearn_regressor(regressor_type):
    return do_sklearn_regression()
# other methods...
elif is_lasso_regressor(regressor_type):
    return do_lasso_regression()

Finally, in the function to_feature_importances, you have to implement the extraction of feature importances or model coefficients from your trained_regressor, which are supposed to represent edge weights in the inferred GRN. To accomplish that, add another case for your new regressor in the case distinction below the line stating # UPDATE FOR NEW GRN METHOD. For lasso regression this looks like:

# UPDATE FOR NEW GRN METHOD
if is_oob_heuristic_supported(regressor_type, regressor_kwargs):
    # other code...
elif regressor_type.upper() == "LASSO":
    scores = np.abs(trained_regressor.coef_)
    return scores

Done, you have successfully added your new desired regression method for GRN inference!

Heuristic for finding an optimal number of clusters

We recommend using the function find_optimal_number_of_clusters(pd.DataFrame) on any expression matrix (with genes as columns) to obtain suggested values for the number of target gene clusters. You can easily import the function with

from signifikante.algo import find_optimal_number_of_clusters

Unit tests

Unit tests for arboreto-based functionalities, as well as additional tests for SignifiKANTE’s FDR control functionality and a comparison of our efficiently parallelized Wasserstein-distance computation against SciPy can be found under tests/. The tests are based on Python’s unittest module, and can be run all-together from the repository’s root-directory with

python -m unittest discover -s tests -v

The Numba-accelerated Wasserstein distance tests (tests/test_numba.py) must be run with JIT compilation disabled, so that the pure-Python code path is exercised for coverage and assertions:

NUMBA_DISABLE_JIT=1 python -m unittest discover -s tests -p 'test_numba.py' -v

Running the tests requires the test extra (see Installation), which also provides the optional kmedoids dependency exercised by some tests.

Citing SignifiKANTE

If you use SignifiKANTE for your work, please cite it as follows:

Woller, F., Martini, P., Sen, S., Blumenthal, D. B. & Hartebrodt, A. SignifiKANTE: efficient P-value computation for gene regulatory networks. Bioinformatics 42, btag531 (2026) doi: 10.1093/bioinformatics/btag531.

Metadata

Release files for signifikante 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for signifikante 0.2.0
File Size Uploaded Provenance
signifikante-0.2.0.tar.gz 49.6 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for signifikante 0.2.0
File Interpreter ABI Platform
signifikante-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.6 MB

Release files / signifikante-0.2.0.tar.gz

Download URL signifikante-0.2.0.tar.gz
Size 49.6 MB
Tags Source
SHA-256 checksum
How to use checksums
cbcc545666a757bb6b5862ba5011049c9c650b70d376d0d7f1c632e30e229ef3
BLAKE2b-256 checksum
How to use checksums
69ff4e94ad414632075f858325436b7eccfeb7772026178d8fcd69467fffa234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

Release files / signifikante-0.2.0-py3-none-any.whl

Download URL signifikante-0.2.0-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e8aa8a7bfe8a90aaaa2beb726fedd8ff2c34861d3905428dafb997480112f47
BLAKE2b-256 checksum
How to use checksums
5bd02ed5128a5284a2b7efcc5f3a6b7665839a0cb16aafdd39b7f47d11aa285d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

Security for signifikante 0.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page