Skip to main content

stspeck

The Speck molecule viewer for Streamlit, with the same renderer and settings as the ipyspeck Jupyter widget: ambient occlusion, cartoons, molecular surfaces (optionally transparent), metallic and glossy materials, shadows, fog, outlines, highlighting, trajectories and unit cells.

pip install stspeck      # Python 3.8+, Streamlit 1.20+

ipyspeck 0.8

import streamlit as st
import stspeck

# Any structure as PDB or (extended) XYZ text
stspeck.speck(data=open("1ubq.pdb").read(), cartoon=True, surface=True, surfaceOpacity=0.35)

# Loaders return keyword arguments to splat into speck()
stspeck.speck(**stspeck.fetch_alphafold("Q8W3K0"), preset="cover", height=500)
stspeck.speck(**stspeck.fetch_pdb("4HHB"), highlight={"resName": "HEM"}, ghost=0.6)
stspeck.speck(**stspeck.from_ase(atoms), preset="metal")   # also from_rdkit, from_pymatgen
  • Settings: every ipyspeck setting is a keyword argument; see stspeck.SETTINGS for names and defaults, and stspeck.PRESETS for named looks (preset="cover").
  • Toolbar: styles, cartoon / surface / ligand toggles, standard views, color schemes and a camera button that downloads a high-resolution PNG (export_width=3000, export_scale=...). Toolbar choices persist across reruns.
  • State: with return_state=True the call returns the camera, the current settings and nframes; pass the camera back as camera= to restore a view.
  • Trajectories: multi-frame XYZ or multi-model PDB; drive frame= with a slider (stspeck.count_frames(data) gives the range).

Run the demo with streamlit run example/app.py.

Rendered with the ipyspeck / stspeck renderer (see example/showcase.ipynb for the settings behind these looks).

Macro photography (depth of field)


Gold nanoparticle, 923 atoms

Copper surface

Heme in hemoglobin (4HHB)

Imatinib in ABL kinase (1IEP)

Nucleosome DNA (1KX5)

AlphaFold RPP7 repeat domain

Proteins and complexes


AlphaFold RPP7, by pLDDT

Hemoglobin, glass surface (4HHB)

SARS-CoV-2 spike (6VXX)

IgG antibody (1IGT)

Green fluorescent protein (1EMA)

GroEL–GroES chaperonin (1AON)

KcsA K⁺ channel (1BL8)

CRISPR-Cas9 with guide RNA (4OO8)

HIV protease + saquinavir (1HXB)

Streptavidin–biotin (1STP)

Myoglobin, toon style (1MBN)

Collagen triple helix (1BKV)

Ubiquitin surface (1UBQ)

Nucleic acids


Nucleosome (1KX5)

Transfer RNA (1EHZ)

G-quadruplex with K⁺ (1KF1)

Chemistry and materials


Gold–thiolate cluster

Copper crystal and unit cell

SrTiO₃ perovskite

MoS₂ monolayer

Graphene

Carbon nanotube

C₆₀ buckminsterfullerene

Taxol (paclitaxel)

Chlorophyll a

Caffeine

For Jupyter, use ipyspeck, which has the same settings.

Development

The frontend (frontend/) bundles the viewer shared with ipyspeck (../core). Build it with cd frontend && npm install && npm run build, which also compiles ../core. pip install . runs the same build when stspeck/static is missing.

Release files for stspeck 0.8.1

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

Source distribution (sdist)

Source distribution for stspeck 0.8.1
File Size Uploaded
stspeck-0.8.1.tar.gz 70.0 kB Details

Built distribution (wheel)

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

Total release size: 121.1 kB

Release files / stspeck-0.8.1.tar.gz

Download URL stspeck-0.8.1.tar.gz
Size 70.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d31347ff33f50243cc6a4d55e79f5f9b753e5e8f45aaa7532d4da97957ed58b7
BLAKE2b-256 checksum
How to use checksums
9cc89536f2bc417af916b6aad2584032ff62c093cd68f1a3d3cbd6a0c39809ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / stspeck-0.8.1-py3-none-any.whl

Download URL stspeck-0.8.1-py3-none-any.whl
Size 51.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cb3f27d2148beb483bf43572fb71badf807702cce0c863aa5d864732af07381
BLAKE2b-256 checksum
How to use checksums
94ce07bce648f2c74268276a9cf064717d357dfd6d94e1af9f8fcac8ef513848
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

This release

0.8.1 This release

2 release files

0.8.0

2 release files

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