deeporigin_molstar
Project description
DeepOrigin Mol* Viewer
DeepOrigin Mol* Viewer is a powerful tool for visualizing molecular structures using Mol* in a web environment. This package allows users to load, manipulate, and visualize molecular structures with ease.
Table of Contents
Installation
pip install deeporigin-molstar
Usage
Basic Viewer
The Viewer class is the base template class for rendering molecular structures.
it contains all the necessary methods for reading, writing and constracting molstar visualizations.
Protein Viewer
The ProteinViewer class extends the Viewer class and provides additional methods specific to visualizations of protein structures.
from deeporigin_molstar.src.viewers.protein_viewer import ProteinViewer
# Example usage of the ProteinViewer
protein_viewer = ProteinViewer(data='path/to/protein.pdb', format='pdb')
html_content = protein_viewer.render_protein()
print(html_content)
Docking Viewer
The DockingViewer class is used to merge and visualize multiple molecular structures.
from deeporigin_molstar.src.viewers.docking_viewer import DockingViewer
# Example usage of the MoleculeMergerViewer
merger_viewer = DockingViewer()
html_content = merger_viewer.render_merged_structures(
protein_data='path/to/protein.pdb',
protein_format='pdb',
ligand_data='path/to/ligand.mol2',
ligand_format='mol2'
)
print(html_content)
Molecule Viewer
The MoleculeViewer class is used to visualize molecule conformations.
from deeporigin_molstar.src.viewers.molecule_viewer import MoleculeViewer
# Example usage of the MoleculeMergerViewer
molecule_viewer = MoleculeViewer(data='path/to/protein.[mol2, sdf, pdb]', format='[mol2, sdf, pdb]')
html_content = molecule_viewer.render_ligand()
print(html_content)
API Reference
Viewer
-
Viewer(data: str, format: str, html: str = '')- Base class for rendering molecular structures.
- Parameters:
data: Path to the molecular data file.format: Format of the molecular data (e.g., 'pdb', 'pdbqt').html: Initial HTML content.
-
render() -> str- Renders the molecular structure and returns the HTML content.
ProteinViewer
ProteinViewer(data: str, format: str, html: str = '')- Extends
Viewerwith additional methods for protein visualization.
- Extends
DockingViewer
-
DockingViewer(html: str = '')- Used to merge and visualize multiple molecular structures.
-
render_merged_structures(protein_data: str, protein_format: str, ligand_data: str, ligand_format: str) -> str- Renders merged molecular structures.
- Parameters:
protein_data: Path to the protein data file.protein_format: Format of the protein data.ligand_data: Path to the ligand data file.ligand_format: Format of the ligand data.
MoleculeViewer
DockingViewer(data: str, format: str, html: str = '')- Extends
Viewerwith additional methods for molecule visualization.
- Extends
Examples
Here are some example scripts demonstrating how to use the package. For more examples, please refer to the examples directory.
Example 1: Protein Viewer
from deeporigin_molstar.src.viewers.protein_viewer import ProteinViewer
protein_viewer = ProteinViewer(data='path/to/protein.pdb', format='pdb')
html_content = protein_viewer.render_active_site()
print(html_content)
Example 2: Render Protein Mutagens Analysis Result
from deeporigin_molstar.src.viewers.protein_viewer import ProteinViewer
protein_viewer = ProteinViewer(data='path/to/protein.pdb', format='pdb')
residue_gaps = [10, 20, 30] # example gaps
residue_mutations = [15, 25, 35] # example mutations
html_content = protein_viewer.render_protein_mutagens_result(residue_gaps, residue_mutations)
print(html_content)
Example 3: Render Protein with pockets
from deeporigin_molstar.src.viewers.protein_viewer import ProteinViewer
protein_viewer = ProteinViewer(data='path/to/protein.pdb', format='pdb')
pocket_paths = ['path/to/pocket1.pdb', 'path/to/pocket2.pdb']
pocket_config = protein_viewer.get_pocket_visualization_config()
pocket_config.surface_colors = ['red', 'blue']
html_content = protein_viewer.render_protein_with_pockets(pocket_paths=pocket_paths)
print(html_content)
Example 4: Render Proteins overlaying result
from deeporigin_molstar.src.viewers.protein_viewer import ProteinViewer
html = ProteinViewer.render_structures_overlaying(
first_raw_data='path/to/pocket1.pdb',
second_raw_data='path/to/pocket2.pdb',
first_format="pdb",
second_format="pdb",
)
print(html)
Example 5: Molecule viewer
from deeporigin_molstar.src.viewers.molecule_viewer import MoleculeViewer
molecule_viewer = MoleculeViewer(data='path/to/ligand.mol2', format='mol2')
html_content = molecule_viewer.render_ligand()
print(html_content)
Example 6: Docking viewer
from deeporigin_molstar.src.viewers.docking_viewer import DockingViewer
docking_viewer = DockingViewer()
html_content = docking_viewer.render_merged_structures(
protein_data='path/to/protein.pdb',
protein_format='pdb',
ligand_data='path/to/ligand.mol2',
ligand_format='mol2',
)
print(html_content)
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
File details
Details for the file deeporigin_molstar-0.1.2.tar.gz.
File metadata
- Download URL: deeporigin_molstar-0.1.2.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e96d87a10050ffd156d7eb0de80d61b8e8cad5077f5906349c70ca73a2500eba
|
|
| MD5 |
8de7861beb4bd5c20c8407e76d265d83
|
|
| BLAKE2b-256 |
56b9450683e40d7cccd0205264088db3b3bba5c0afcda20fb8dbee6229c6752f
|
Provenance
The following attestation bundles were made for deeporigin_molstar-0.1.2.tar.gz:
Publisher:
pypi-publish.yml on Biosim-AI/biosim_molstar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deeporigin_molstar-0.1.2.tar.gz -
Subject digest:
e96d87a10050ffd156d7eb0de80d61b8e8cad5077f5906349c70ca73a2500eba - Sigstore transparency entry: 185022809
- Sigstore integration time:
-
Permalink:
Biosim-AI/biosim_molstar@09c35dd7e3eaa9819362c1c89afc1b13da8cbe12 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/Biosim-AI
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@09c35dd7e3eaa9819362c1c89afc1b13da8cbe12 -
Trigger Event:
push
-
Statement type: