Skip to main content

A visualisation tool for protein embeddings from pLMs

Project description

ProtSpace

PyPI version Python 3.10+ License: GPL v3 Downloads DOI

ProtSpace is a visualization tool for exploring protein embeddings or similarity matrices along their 3D protein structures. It allows users to interactively visualize high-dimensional protein language model data in 2D or 3D space, color-code proteins based on various features, and view protein structures when available.

🌐 Try Online

Web Interface: https://protspace.rostlab.org/

🚀 Quick Start with Google Colab

Note: Use Chrome or Firefox for best experience.

  1. Explore Pre-computed Visualizations: Open Explorer In Colab

  2. Generate Protein Embeddings: Open Embeddings In Colab

  3. Full Pipeline Demo: Open Pipeline In Colab

  4. Pfam & Clan Explorer: Open Pfam Explorer In Colab

📦 Installation

# Basic installation (backend - dimensionality reduction only)
pip install protspace

# Full installation (backend + frontend - including visualization interface)
pip install "protspace[frontend]"

🎯 Usage

1. Query UniProt directly

# Search and analyze proteins from UniProt with available protein features
protspace-query -q "insulin AND organism_id:9606 AND reviewed:true" -o output_dir -m pca2,umap3

2. Process local data

# Process your own embeddings or similarity matrices with the protein features you want
protspace-local -i embeddings.h5 -f signal_peptide,pfam -o output_dir -m pca2,pca3

3. Launch visualization

# Auto-detects JSON files or Arrow directories
protspace output_dir
protspace output.json

Access at http://localhost:8050

✨ Features

  • Interactive visualization: 2D/3D plots with multiple dimensionality reduction methods (PCA, UMAP, t-SNE, MDS, PaCMAP)
  • Feature-based styling: Color-code and shape proteins by various features
  • Structure integration: View 3D protein structures alongside embeddings
  • Search & highlight: Find and highlight specific proteins
  • Export options: High-quality SVG (2D) and interactive HTML (3D)
  • Responsive interface: Works on desktop and mobile

📊 Example Outputs

2D Scatter Plot

2D Example

3D Interactive Plot

View 3D Example

🔧 Advanced Usage

Command Options

protspace-query (UniProt search):

  • -q, --query: UniProt search query (required)
  • -o, --output: Output directory (required)
  • -f, --features: Features to extract (comma-separated)
  • -m, --methods: Reduction methods (e.g., pca2,umap3,tsne2)
  • --non-binary: Use legacy JSON format
  • --keep-tmp: Keep temporary files

protspace-local (Local data):

  • -i, --input: HDF5 embeddings or CSV similarity matrix (required)
  • -o, --output: Output directory (required)
  • -f, --features: Features to extract (comma-separated) (legacy usage: csv metadata file path)
  • -m, --methods: Reduction methods (e.g., pca2,umap3,tsne2)
  • --non-binary: Use legacy JSON format

Method Parameters

Fine-tune dimensionality reduction:

  • UMAP: --n_neighbors 15 --min_dist 0.1
  • t-SNE: --perplexity 30 --learning_rate 200
  • PaCMAP: --mn_ratio 0.5 --fp_ratio 2.0
  • MDS: --n_init 4 --max_iter 300 --eps 1e-3

Custom Styling

protspace-feature-colors input.json output.json --feature_styles '{
  "feature_name": {
    "colors": {"value1": "#FF0000", "value2": "#00FF00"},
    "shapes": {"value1": "circle", "value2": "square"}
  }
}'

Available shapes: circle, circle-open, cross, diamond, diamond-open, square, square-open, x

📁 File Formats

Input

  • UniProt queries: Text queries using UniProt syntax
  • Embeddings: HDF5 files (.h5, .hdf5)
  • Similarity matrices: CSV files with symmetric matrices
  • Metadata: CSV with 'identifier' column + feature columns
  • Structures: ZIP files containing PDB/CIF files

Output

  • Default: Parquet files (projections_data.parquet, projections_metadata.parquet, selected_features.parquet)
  • Legacy: JSON format with --non-binary flag
  • Temporary files: FASTA sequences, similarity matrices, all features (with --keep-tmp)

📝 Citation

@article{SENONER2025168940,
title = {ProtSpace: A Tool for Visualizing Protein Space},
journal = {Journal of Molecular Biology},
pages = {168940},
year = {2025},
issn = {0022-2836},
doi = {https://doi.org/10.1016/j.jmb.2025.168940},
url = {https://www.sciencedirect.com/science/article/pii/S0022283625000063},
author = {Tobias Senoner and Tobias Olenyi and Michael Heinzinger and Anton Spannagl and George Bouras and Burkhard Rost and Ivan Koludarov}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protspace-2.2.0.tar.gz (99.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

protspace-2.2.0-py3-none-any.whl (644.4 kB view details)

Uploaded Python 3

File details

Details for the file protspace-2.2.0.tar.gz.

File metadata

  • Download URL: protspace-2.2.0.tar.gz
  • Upload date:
  • Size: 99.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for protspace-2.2.0.tar.gz
Algorithm Hash digest
SHA256 9688bd60a7a9375bd33a1a65a26b457806699fe98f287702794890eae1e84999
MD5 1d01372a8ce2c1fbd61fecaab979bd65
BLAKE2b-256 fde68adc42a6c394a58961ad36ae457014b56466480ad120ebdd4eacb0977c87

See more details on using hashes here.

Provenance

The following attestation bundles were made for protspace-2.2.0.tar.gz:

Publisher: python.yml on tsenoner/protspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protspace-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: protspace-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 644.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for protspace-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7aafc25445984db31f5f3ab2442e31372e5f221711e9842e097a7d1fad2afc2a
MD5 adaa70e0312590308b066297887eb6d7
BLAKE2b-256 2f684be882bab27eeb27e3173093dd36ca10e9a3de52daf25988d8db88bad8f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for protspace-2.2.0-py3-none-any.whl:

Publisher: python.yml on tsenoner/protspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page