Skip to main content

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 Viewer with additional methods for protein visualization.

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 Viewer with additional methods for molecule visualization.

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

deeporigin_molstar-0.2.1.tar.gz (16.6 kB view details)

Uploaded Source

File details

Details for the file deeporigin_molstar-0.2.1.tar.gz.

File metadata

  • Download URL: deeporigin_molstar-0.2.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for deeporigin_molstar-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b6f0b032f01f037c2a11ac1ba1b753d996fb5fead41b25e10703d9c3b27d97fc
MD5 ac1eb55a27eae1e882f54c5456a2478b
BLAKE2b-256 2e5c43646c4d43fa1654171a7965d703771eb2178aec05b95b16da5572b6898a

See more details on using hashes here.

Provenance

The following attestation bundles were made for deeporigin_molstar-0.2.1.tar.gz:

Publisher: pypi-publish.yml on Biosim-AI/biosim_molstar

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