py2Dmol 1.0.0__tar.gz

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.
py2dmol-1.0.0/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ /*
2
+ * ----------------------------------------------------------------------------
3
+ * "THE BEER-WARE LICENSE" (Revision 42):
4
+ * <so3@mit.edu> wrote this file. As long as you retain this notice you
5
+ * can do whatever you want with this stuff. If we meet some day, and you think
6
+ * this stuff is worth it, you can buy me a beer in return. Sergey Ovchinnikov
7
+ * ----------------------------------------------------------------------------
8
+ */
py2dmol-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: py2Dmol
3
+ Version: 1.0.0
4
+ Summary: A Python library for visualizing protein structures in 2D.
5
+ Home-page: https://github.com/sokrypton/py2Dmol
6
+ Author: sokrypton
7
+ Author-email: so3@mit.edu
8
+ License: BEER-WARE
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy
15
+ Requires-Dist: ipython
16
+ Requires-Dist: gemmi
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license
24
+ Dynamic: license-file
25
+ Dynamic: requires-dist
26
+ Dynamic: requires-python
27
+ Dynamic: summary
28
+
29
+ A Python library for visualizing protein structures in 2D.
@@ -0,0 +1,74 @@
1
+ # py2Dmol
2
+
3
+ A Python library for visualizing protein structures in 2D, designed for use in Google Colab and Jupyter environments.
4
+
5
+ ## Installation
6
+
7
+ You can install `py2Dmol` directly from GitHub:
8
+
9
+ ```bash
10
+ pip install git+https://github.com/sokrypton/py2Dmol.git
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Here are a few examples of how to use `py2Dmol`.
16
+
17
+ ### Basic Usage
18
+
19
+ To create a viewer, simply import the package and instantiate the `view` class:
20
+
21
+ ```python
22
+ import py2Dmol
23
+ viewer = py2Dmol.view()
24
+ ```
25
+
26
+ ### Loading a Structure from a PDB or CIF File
27
+
28
+ You can load a structure directly from a PDB or CIF file using the `from_pdb` method. This will automatically extract the C-alpha atoms for proteins and all heavy atoms for ligands. If the file contains multiple models, they will be loaded as an animation.
29
+
30
+ ```python
31
+ import py2Dmol
32
+ viewer = py2Dmol.view()
33
+ viewer.from_pdb('my_protein.pdb')
34
+ ```
35
+
36
+ You can also specify which chains to display:
37
+
38
+ ```python
39
+ viewer.from_pdb('my_protein.pdb', chains=['A', 'B'])
40
+ ```
41
+
42
+ ### Manually Adding Data
43
+
44
+ You can also add data to the viewer using the `add` method. This is useful for visualizing custom trajectories or molecular data.
45
+
46
+ ```python
47
+ import numpy as np
48
+
49
+ # Example data
50
+ coords = np.random.rand(100, 3) * 50 # 100 atoms with random coordinates
51
+ plddts = np.random.rand(100) * 100 # Random pLDDT scores
52
+ chains = ['A'] * 50 + ['B'] * 50 # Two chains
53
+ atom_types = ['P'] * 100 # All protein atoms
54
+
55
+ # Create a viewer and display the initial data
56
+ viewer = py2Dmol.view()
57
+ viewer.display(coords, plddts, chains, atom_types)
58
+
59
+ # Update the viewer with new data to create an animation
60
+ for _ in range(10):
61
+ new_coords = coords + np.random.rand(100, 3) * 5
62
+ viewer.add(new_coords)
63
+ ```
64
+
65
+ ## Data Format
66
+
67
+ The viewer distinguishes between two types of atoms:
68
+
69
+ * **P (Protein):** Represents the C-alpha atom of a protein residue.
70
+ * **L (Ligand):** Represents a heavy atom of a non-protein, non-water molecule.
71
+
72
+ ### Chains
73
+
74
+ Chains are automatically extracted from the PDB or CIF file. When loading a structure, you can choose to display all chains or specify a subset of chains to visualize.
@@ -0,0 +1 @@
1
+ from .viewer import view
File without changes