cosmol-viewer 0.1.4.dev2__cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl → 0.1.5.dev7__cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- from typing import Optional, Union, List
1
+ from typing import Optional, Union, List
2
2
 
3
3
  def parse_sdf(
4
4
  sdf: str,
5
5
  keep_h: bool = True,
6
6
  multimodel: bool = True,
7
7
  onemol: bool = False
8
- ) -> "MoleculeData":
8
+ ) -> MoleculeData:
9
9
  """
10
- Parse an SDF file or string into molecule data.
10
+ Parse an SDF string into molecule data.
11
11
 
12
12
  # Args
13
- - sdf: Path to an SDF file or a string containing SDF content.
13
+ - sdf: Path to an SD string containing SDF content.
14
14
  - keep_h: Whether to keep explicit hydrogen atoms (default: True).
15
15
  - multimodel: Whether to allow multiple models in one file (default: True).
16
16
  - onemol: Whether to merge multiple models into one molecule (default: False).
@@ -21,11 +21,30 @@ def parse_sdf(
21
21
  # Example
22
22
  ```python
23
23
  from cosmol_viewer import parse_sdf
24
- mol = parse_sdf("molecule.sdf")
24
+ mol = parse_sdf(open("./molecule.sdf", "r", encoding="utf-8").read())
25
25
  ```
26
26
  """
27
27
  ...
28
28
 
29
+ def parse_mmcif(
30
+ mmcif: str
31
+ ) -> ProteinData:
32
+ """
33
+ Parse an MMCIF string into protein data.
34
+
35
+ # Args
36
+ - mmcif: Path to an MMCIF string containing MMCIF content.
37
+
38
+ # Returns
39
+ - ProteinData: Parsed protein data object.
40
+
41
+ # Example
42
+ ```python
43
+ from cosmol_viewer import parse_mmcif
44
+ prot = parse_mmcif(open("./protein.cif", "r", encoding="utf-8").read())
45
+ ```
46
+ """
47
+ ...
29
48
 
30
49
  class Scene:
31
50
  """
@@ -54,12 +73,12 @@ class Scene:
54
73
  """
55
74
  ...
56
75
 
57
- def add_shape(self, shape: Union["Sphere", "Stick", "Molecules"], id: Optional[str] = None) -> None:
76
+ def add_shape(self, shape: Union["Sphere", "Stick", "Molecules", "Protein"], id: Optional[str] = None) -> None:
58
77
  """
59
78
  Add a shape to the scene.
60
79
 
61
80
  # Args
62
- - shape: A shape instance (PySphere, PyStick, or PyMolecules).
81
+ - shape: A shape instance (Sphere, Stick, Molecules, or Protein).
63
82
  - id: Optional string ID to associate with the shape.
64
83
 
65
84
  If the `id` is provided and a shape with the same ID exists,
@@ -73,7 +92,7 @@ class Scene:
73
92
  """
74
93
  ...
75
94
 
76
- def update_shape(self, id: str, shape: Union["Sphere", "Stick", "Molecules"]) -> None:
95
+ def update_shape(self, id: str, shape: Union["Sphere", "Stick", "Molecules", "Protein"]) -> None:
77
96
  """
78
97
  Update an existing shape in the scene by its ID.
79
98
 
@@ -102,6 +121,20 @@ class Scene:
102
121
  """
103
122
  ...
104
123
 
124
+ def recenter(self, center: List[float]) -> None:
125
+ """
126
+ Recenter the scene at a given point.
127
+
128
+ # Args
129
+ - center: An XYZ array of 3 float values representing the new center.
130
+
131
+ # Example
132
+ ```python
133
+ scene.recenter([0.0, 0.0, 0.0])
134
+ ```
135
+ """
136
+ ...
137
+
105
138
  def scale(self, scale: float) -> None:
106
139
  """
107
140
  Set the global scale factor of the scene.
@@ -132,6 +165,17 @@ class Scene:
132
165
  """
133
166
  ...
134
167
 
168
+ def use_black_background(self) -> None:
169
+ """
170
+ Set the background color of the scene to black.
171
+
172
+ # Example
173
+ ```python
174
+ scene.use_black_background()
175
+ ```
176
+ """
177
+ ...
178
+
135
179
  class Viewer:
136
180
  """
137
181
  A viewer that renders 3D scenes in different runtime environments
@@ -201,7 +245,7 @@ class Viewer:
201
245
  - loops: Number of loops to repeat (-1 for infinite).
202
246
  - width: The viewport width in pixels.
203
247
  - height: The viewport height in pixels.
204
- - smooth: Whether to smooth the animation by
248
+ - smooth: Whether to smooth the animation by
205
249
  interpolating between frames.
206
250
 
207
251
  # Returns
@@ -296,23 +340,50 @@ class Stick:
296
340
 
297
341
  class Molecules:
298
342
  """
299
- A molecular shape object parsed from SDF data.
343
+ A molecular shape object.
300
344
 
301
345
  # Example
302
346
  ```python
303
- mol = parse_sdf("molecule.sdf")
347
+ mol = parse_sdf(open("molecule.sdf", "r", encoding="utf-8").read())
304
348
  molecules = Molecules(mol).centered().color([0,1,0])
305
349
  ```
306
350
  """
307
351
 
308
352
  def __init__(self, molecule_data: "MoleculeData") -> None: ...
353
+ def get_center(self) -> List[float]: ...
309
354
  def centered(self) -> "Molecules": ...
310
355
  def color(self, color: List[float]) -> "Molecules": ...
311
356
  def color_rgba(self, color: List[float]) -> "Molecules": ...
312
357
  def opacity(self, opacity: float) -> "Molecules": ...
358
+ def reset_color(self) -> "Molecules": ...
313
359
 
314
360
  class MoleculeData:
315
361
  """
316
362
  Internal representation of molecule data returned by `parse_sdf`.
317
363
  """
318
364
  ...
365
+
366
+ class Protein:
367
+ """
368
+ A protein shape object.
369
+
370
+ # Example
371
+ ```python
372
+ mmcif_data = parse_mmcif(open("2AMD.cif", "r", encoding="utf-8").read())
373
+ prot = Protein(mmcif_data).centered().color([0,1,0])
374
+ ```
375
+ """
376
+
377
+ def __init__(self, molecule_data: "MoleculeData") -> None: ...
378
+ def get_center(self) -> List[float]: ...
379
+ def centered(self) -> "Molecules": ...
380
+ def color(self, color: List[float]) -> "Molecules": ...
381
+ def color_rgba(self, color: List[float]) -> "Molecules": ...
382
+ def opacity(self, opacity: float) -> "Molecules": ...
383
+ def reset_color(self) -> "Molecules": ...
384
+
385
+ class ProteinData:
386
+ """
387
+ Internal representation of protein data returned by `parse_mmcif`.
388
+ """
389
+ ...
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cosmol-viewer
3
- Version: 0.1.4.dev2
3
+ Version: 0.1.5.dev7
4
4
  Summary: Molecular visualization tools
5
5
  Author-email: 95028 <wjt@cosmol.org>
6
6
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
@@ -20,8 +20,8 @@ Project-URL: Repository, https://github.com/COSMol-repl/COSMol-viewer
20
20
  </a>
21
21
  </div>
22
22
 
23
- A high-performance molecular viewer for `Python` and `Rust`, backed by `Rust`.
24
- Supports both static rendering and smooth animation playback — including inside Jupyter notebooks.
23
+ A high-performance molecular viewer for `Python` and `Rust`, backed by `Rust`.
24
+ Supports both static rendering and smooth animation playback — including inside Jupyter notebooks.
25
25
 
26
26
 
27
27
  A compact, high-performance renderer for molecular and scientific shapes with two usage patterns:
@@ -57,7 +57,7 @@ pip install cosmol-viewer
57
57
  ---
58
58
 
59
59
  ## Quick Start
60
-
60
+ See examples in [Google Colab](https://colab.research.google.com/drive/1Sw72QWjQh_sbbY43jGyBOfF1AQCycmIx?usp=sharing).
61
61
  ### 1. Static molecular rendering
62
62
 
63
63
  ```python
@@ -103,5 +103,5 @@ Viewer.play(frames, interval=interval, loops=1, width=600, height=400, smooth=Tr
103
103
 
104
104
  ## Documentation
105
105
 
106
- For API reference and advanced usage, please see the [latest documentation](https://cosmol-repl.github.io/COSMol-viewer).
106
+ For API reference and advanced usage, please see the [latest documentation](https://cosmol-repl.github.io/COSMol-viewer).
107
107
 
@@ -0,0 +1,7 @@
1
+ cosmol_viewer-0.1.5.dev7.dist-info/METADATA,sha256=qaTJlkdyqV0wercZDDVmYbUY1x_UXNX8UuhBC8uCBAk,3579
2
+ cosmol_viewer-0.1.5.dev7.dist-info/WHEEL,sha256=oB91FzNpC-hO8c8ewOPvbQZBthpYN_59_Trh5rKisIg,139
3
+ cosmol_viewer/__init__.py,sha256=K33zoYpHqUVvpFdMVxmCtw4uKj9ZXrGuQD4D4DuUmjk,135
4
+ cosmol_viewer/__init__.pyi,sha256=fNOQlMLuOiY6IJxHG8hmdJxeaSbaz4Vn45f3oi17Gyg,10220
5
+ cosmol_viewer/cosmol_viewer.abi3.so,sha256=v5k_up9PYWf9jccaRx54yW8qwVIxrG_ISXYUeSzNOf0,29500808
6
+ cosmol_viewer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ cosmol_viewer-0.1.5.dev7.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.10.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp37-abi3-manylinux_2_17_i686
5
+ Tag: cp37-abi3-manylinux2014_i686
@@ -1,7 +0,0 @@
1
- cosmol_viewer-0.1.4.dev2.dist-info/METADATA,sha256=ntIjMLqgxfDlGAyBDKLqv7yYLjx_iSvEtdwizEyrPqU,3466
2
- cosmol_viewer-0.1.4.dev2.dist-info/WHEEL,sha256=GiWFiSsWOslMBN41z1mfBeDroO-c1QlctGEFpKcYtJE,123
3
- cosmol_viewer/__init__.py,sha256=K33zoYpHqUVvpFdMVxmCtw4uKj9ZXrGuQD4D4DuUmjk,135
4
- cosmol_viewer/__init__.pyi,sha256=haGIhR4cKSfwOsni4Vk9dG4r9ApSfDN0Z2Zui-BD3e0,8384
5
- cosmol_viewer/cosmol_viewer.abi3.so,sha256=SerZm9h3s6aLbm0qQUhV623jq-ci3otUR-vvj2nKv30,26447488
6
- cosmol_viewer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- cosmol_viewer-0.1.4.dev2.dist-info/RECORD,,
@@ -1,4 +0,0 @@
1
- Wheel-Version: 1.0
2
- Generator: maturin (1.9.6)
3
- Root-Is-Purelib: false
4
- Tag: cp37-abi3-manylinux_2_17_i686.manylinux2014_i686