cell2net.preprocessing.get_motifs_from_jaspar#

cell2net.preprocessing.get_motifs_from_jaspar(release='JASPAR2024', collection='CORE', tax_group=None, all_versions=False)#

Fetch transcription factor motifs from the JASPAR database.

This function retrieves transcription factor binding motifs from the JASPAR database using the pyjaspar library. It allows filtering by JASPAR release, motif collection, taxonomic group, and version.

Parameters:
  • release (str (default: 'JASPAR2024')) – The release version ( e.g. JASPAR2020, JASPAR2024) of the JASPAR database to query.

  • collection (str (default: 'CORE')) –

    The collection of motifs to query. Common options include:

    • ”CORE”: High-quality, manually curated collection.

    • ”UNVALIDATED”: Computationally predicted motifs.

  • tax_group (list[str] | None (default: None)) –

    A list of taxonomic groups to filter motifs. For example:

    • [“vertebrates”]

    • [“plants”, “insects”]

    If None, defaults to [“vertebrates”].

  • all_versions (bool (default: False)) – Whether to fetch all versions of each motif. If True, retrieves all motif versions; otherwise, retrieves only the latest version.

Return type:

Iterable | None

Returns:

An iterable of motif objects fetched from the JASPAR database. Returns None if the pyjaspar library is not installed or an error occurs.

Raises:

ImportError – If the pyjaspar library is not installed.

Notes

  • Requires the pyjaspar library to interact with the JASPAR database. Install it via pip install pyjaspar.

  • The motifs fetched are represented as objects with attributes like name, matrix_id, and counts, which can be used for downstream analysis.

Examples

Fetch all motifs from the JASPAR2024 CORE collection for vertebrates:

>>> motifs = get_motifs_from_jaspar(
...     release="JASPAR2024",
...     collection="CORE",
...     tax_group=["vertebrates"],
... )
>>> print(len(motifs))