Skip to main content

A visualisation tool for protein embeddings from pLMs

Project description

ProtSpace

ProtSpace is a powerful visualization tool for exploring protein embeddings and 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.

Table of Contents

Quick Start with Google Colab

Try ProtSpace instantly using our Google Colab notebook:

Open In Colab

The notebook demonstrates:

  • Installation and setup
  • Data preparation
  • Basic visualization

Example Outputs

2D Scatter Plot (SVG)

2D Scatter Plot Example

3D Interactive Plot

View 3D Interactive Plot

Installation

Using uv:

# Quick run
uvx protspace

# Permanent installation
uv tool install protspace
uv tool update-shell

# Latest GitHub version
uv tool install git+https://github.com/tsenoner/ProtSpace.git
uv tool update-shell

Usage

Data Preparation

uvx --from protspace protspace-json -i embeddings.h5 -m features.csv -o output.json --methods pca3 umap2 tsne2

Running ProtSpace

protspace output.json [--pdb_zip pdb_files.zip] [--port 8050]

Access the interface at http://localhost:8050

Features

  • Interactive 2D/3D visualization (PCA, UMAP, t-SNE)
  • Feature-based coloring and marker styling
  • Protein structure visualization (with PDB files)
  • Search and highlight functionality
  • High-quality plot exports
  • Responsive web interface

Data Preparation

The protspace-json command supports:

Required Arguments

  • -i, --input: HDF file (.h5) or similarity matrix (.csv)
  • -m, --metadata: CSV file with features
  • -o, --output: Output JSON path
  • --methods: Reduction methods (e.g., pca2, tsne3, umap2)

Optional Arguments

  • --custom_names: Custom projection names (e.g., pca2=PCA_2D)
  • --verbose: Increase output verbosity

Method-Specific Parameters

  • UMAP:
    • --n_neighbors: Number of neighbors (default: 15)
    • --min_dist: Minimum distance (default: 0.1)
  • t-SNE:
    • --perplexity: Perplexity value (default: 30)
    • --learning_rate: Learning rate (default: 200)
  • PaCMAP:
    • --mn_ratio: MN ratio (default: 0.5)
    • --fp_ratio: FP ratio (default: 2.0)
  • MDS:
    • --n_init: Number of initializations (default: 4)
    • --max_iter: Maximum iterations (default: 300)

Custom Feature Styling

Use protspace-feature-colors to customize feature appearance:

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

  1. Embeddings/Similarity

    • HDF5 (.h5) for embeddings
    • CSV for similarity matrix
  2. Metadata

    • CSV with 'identifier' column
    • Additional columns for features
  3. Structures

    • ZIP containing PDB/CIF files
    • Filenames match identifiers (dots replaced with underscores)

Output

  • JSON containing:
    • Protein features
    • Projection coordinates
    • Visualization state (colors, shapes)
    • Structure references

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-0.14.8.tar.gz (68.1 MB view details)

Uploaded Source

Built Distribution

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

protspace-0.14.8-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: protspace-0.14.8.tar.gz
  • Upload date:
  • Size: 68.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for protspace-0.14.8.tar.gz
Algorithm Hash digest
SHA256 29b7a4efee58ae5e16134e866ab64996d068e442ddec9be9713a1d93114c2fed
MD5 ec63b240eaf3c27ffc1c75592e1c1b80
BLAKE2b-256 1e4cca73c92685440744498cec3f6e37a7156e64cfa79883e2b2f38a6e7b5fd9

See more details on using hashes here.

Provenance

The following attestation bundles were made for protspace-0.14.8.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-0.14.8-py3-none-any.whl.

File metadata

  • Download URL: protspace-0.14.8-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for protspace-0.14.8-py3-none-any.whl
Algorithm Hash digest
SHA256 932da6639a86ab72f7f6881dde39d4b3bbf2a8d8e115ccf693213d6e57746ee9
MD5 71f1e8f407a3b67d559303a4add10f11
BLAKE2b-256 fb91dc772a0a2be5943e9adda46b5ecc806068d3e2baa647add076731692b4b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for protspace-0.14.8-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