cnotebook 1.2.0__py3-none-any.whl → 2.1.1__py3-none-any.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.
- cnotebook/__init__.py +365 -67
- cnotebook/align.py +231 -167
- cnotebook/context.py +50 -18
- cnotebook/grid/__init__.py +56 -0
- cnotebook/grid/grid.py +1655 -0
- cnotebook/helpers.py +147 -15
- cnotebook/ipython_ext.py +0 -3
- cnotebook/marimo_ext.py +67 -0
- cnotebook/pandas_ext.py +760 -514
- cnotebook/polars_ext.py +1237 -0
- cnotebook/render.py +0 -195
- cnotebook-2.1.1.dist-info/METADATA +338 -0
- cnotebook-2.1.1.dist-info/RECORD +16 -0
- {cnotebook-1.2.0.dist-info → cnotebook-2.1.1.dist-info}/WHEEL +1 -1
- cnotebook-1.2.0.dist-info/METADATA +0 -280
- cnotebook-1.2.0.dist-info/RECORD +0 -13
- {cnotebook-1.2.0.dist-info → cnotebook-2.1.1.dist-info}/licenses/LICENSE +0 -0
- {cnotebook-1.2.0.dist-info → cnotebook-2.1.1.dist-info}/top_level.txt +0 -0
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: cnotebook
|
|
3
|
-
Version: 1.2.0
|
|
4
|
-
Summary: Chemistry visualization in Jupyter Notebooks with the OpenEye Toolkits
|
|
5
|
-
Author-email: Scott Arne Johnson <scott.arne.johnson@gmail.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/scott-arne/cnotebook
|
|
8
|
-
Project-URL: Bug Reports, https://github.com/scott-arne/cnotebook/issues
|
|
9
|
-
Project-URL: Source, https://github.com/scott-arne/cnotebook
|
|
10
|
-
Project-URL: Documentation, https://github.com/scott-arne/cnotebook#readme
|
|
11
|
-
Project-URL: Changelog, https://github.com/scott-arne/cnotebook/blob/master/CHANGELOG.md
|
|
12
|
-
Keywords: chemistry,cheminformatics,computational-chemistry,molecular-visualization,jupyter,marimo,openeye,scientific-computing
|
|
13
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
-
Classifier: Intended Audience :: Science/Research
|
|
15
|
-
Classifier: Intended Audience :: Developers
|
|
16
|
-
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
17
|
-
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
18
|
-
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
-
Classifier: Operating System :: OS Independent
|
|
24
|
-
Classifier: Framework :: Jupyter
|
|
25
|
-
Classifier: Framework :: IPython
|
|
26
|
-
Requires-Python: >=3.11
|
|
27
|
-
Description-Content-Type: text/markdown
|
|
28
|
-
License-File: LICENSE
|
|
29
|
-
Requires-Dist: pandas>=2.2.0
|
|
30
|
-
Requires-Dist: oepandas>=2.0.0
|
|
31
|
-
Requires-Dist: openeye-toolkits>=2025.2.1
|
|
32
|
-
Provides-Extra: dev
|
|
33
|
-
Requires-Dist: invoke; extra == "dev"
|
|
34
|
-
Requires-Dist: build; extra == "dev"
|
|
35
|
-
Requires-Dist: pytest; extra == "dev"
|
|
36
|
-
Provides-Extra: test
|
|
37
|
-
Requires-Dist: pytest; extra == "test"
|
|
38
|
-
Requires-Dist: pytest-cov; extra == "test"
|
|
39
|
-
Dynamic: license-file
|
|
40
|
-
|
|
41
|
-
# CNotebook
|
|
42
|
-
|
|
43
|
-
[](https://www.python.org/downloads/)
|
|
44
|
-
[](https://www.eyesopen.com/toolkits)
|
|
45
|
-
[](https://pandas.pydata.org/)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
**Author:** Scott Arne Johnson ([scott.arne.johnson@gmail.com](mailto:scott.arne.johnson@gmail.com))
|
|
49
|
-
|
|
50
|
-
CNotebook provides ergonomic chemistry visualization in Jupyter Notebooks and Marimo with the OpenEye Toolkits. Simply import the package and your molecular data will be automatically rendered as beautiful chemical structures - no additional configuration required!
|
|
51
|
-
|
|
52
|
-
## 🚀 Quick Start
|
|
53
|
-
|
|
54
|
-
### Installation
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
pip install cnotebook
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**Prerequisites:** Requires OpenEye Toolkits and oepandas to be installed and properly licensed.
|
|
61
|
-
|
|
62
|
-
### Basic Usage
|
|
63
|
-
|
|
64
|
-
```python
|
|
65
|
-
import cnotebook
|
|
66
|
-
from openeye import oechem
|
|
67
|
-
|
|
68
|
-
# Create a molecule
|
|
69
|
-
mol = oechem.OEGraphMol()
|
|
70
|
-
oechem.OESmilesToMol(mol, "n1cnccc1")
|
|
71
|
-
|
|
72
|
-
# Display it - automatically renders as a chemical structure!
|
|
73
|
-
mol
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
That's it! CNotebook automatically registers formatters so that OpenEye molecule objects display as chemical structures instead of cryptic text representations.
|
|
77
|
-
|
|
78
|
-
## Features
|
|
79
|
-
|
|
80
|
-
### Automatic Rendering
|
|
81
|
-
- **Zero Configuration**: Just import and go - molecules automatically render as structures
|
|
82
|
-
- **Multiple Formats**: Supports both Jupyter Notebooks and Marimo environments
|
|
83
|
-
- **Smart Detection**: Automatically detects your notebook environment
|
|
84
|
-
|
|
85
|
-
### Molecule Support
|
|
86
|
-
- **OEMol Objects**: Direct rendering of `oechem.OEMolBase` derived objects
|
|
87
|
-
- **OE2DMolDisplay**: Advanced rendering with custom depiction options
|
|
88
|
-
- **Pandas Integration**: Seamless rendering in DataFrames with oepandas
|
|
89
|
-
|
|
90
|
-
### Visualization Options
|
|
91
|
-
- **Multiple Formats**: PNG (default) or SVG output
|
|
92
|
-
- **Customizable Sizing**: Configurable width, height, and scaling
|
|
93
|
-
- **Grid Layouts**: Multi-molecule grid displays
|
|
94
|
-
- **Substructure Highlighting**: SMARTS pattern highlighting
|
|
95
|
-
- **Molecular Alignment**: Align molecules to reference structures
|
|
96
|
-
|
|
97
|
-
### Pandas Integration
|
|
98
|
-
- **DataFrame Rendering**: Automatic molecule column detection and rendering
|
|
99
|
-
- **Column Highlighting**: Highlight different patterns per row
|
|
100
|
-
- **Alignment Tools**: Align molecular depictions in DataFrames
|
|
101
|
-
- **Fingerprint Similarity**: Visual similarity coloring
|
|
102
|
-
- **Property Calculation**: Chemistry-aware DataFrame operations
|
|
103
|
-
|
|
104
|
-
## Environment Support
|
|
105
|
-
|
|
106
|
-
### Jupyter Notebooks
|
|
107
|
-
CNotebook automatically integrates with Jupyter when imported:
|
|
108
|
-
|
|
109
|
-
```python
|
|
110
|
-
import cnotebook
|
|
111
|
-
import pandas as pd
|
|
112
|
-
from openeye import oechem
|
|
113
|
-
|
|
114
|
-
# Molecules will automatically render in cells
|
|
115
|
-
mol = oechem.OEGraphMol()
|
|
116
|
-
oechem.OESmilesToMol(mol, "CCO")
|
|
117
|
-
mol # Displays as chemical structure
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Marimo
|
|
121
|
-
CNotebook provides seamless Marimo integration:
|
|
122
|
-
|
|
123
|
-
```python
|
|
124
|
-
import marimo as mo
|
|
125
|
-
import cnotebook
|
|
126
|
-
from openeye import oechem
|
|
127
|
-
|
|
128
|
-
# Create and display molecules
|
|
129
|
-
mol = oechem.OEGraphMol()
|
|
130
|
-
oechem.OESmilesToMol(mol, "c1ccccc1")
|
|
131
|
-
mol # Automatically renders as PNG for Marimo compatibility
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Advanced Usage
|
|
135
|
-
|
|
136
|
-
### Rendering Configuration
|
|
137
|
-
|
|
138
|
-
```python
|
|
139
|
-
# Access global rendering context
|
|
140
|
-
ctx = cnotebook.cnotebook_context.get()
|
|
141
|
-
|
|
142
|
-
# Customize rendering options
|
|
143
|
-
ctx.width = 300
|
|
144
|
-
ctx.height = 300
|
|
145
|
-
ctx.image_format = "svg" # Use SVG instead of PNG
|
|
146
|
-
ctx.max_width = 600 # Prevent oversized molecules
|
|
147
|
-
|
|
148
|
-
# Reset to defaults
|
|
149
|
-
ctx.reset()
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Molecule Grids
|
|
153
|
-
|
|
154
|
-
```python
|
|
155
|
-
# Display multiple molecules in a grid
|
|
156
|
-
molecules = [mol1, mol2, mol3, mol4]
|
|
157
|
-
cnotebook.render_molecule_grid(
|
|
158
|
-
molecules,
|
|
159
|
-
ncols=2,
|
|
160
|
-
smarts="c1ccccc1", # Highlight benzene rings
|
|
161
|
-
scale=0.8
|
|
162
|
-
)
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Pandas DataFrame Integration
|
|
166
|
-
|
|
167
|
-
```python
|
|
168
|
-
import oepandas as oepd
|
|
169
|
-
import pandas as pd
|
|
170
|
-
|
|
171
|
-
# Create DataFrame with SMILES
|
|
172
|
-
df = pd.DataFrame({
|
|
173
|
-
"Name": ["Benzene", "Pyridine", "Pyrimidine"],
|
|
174
|
-
"SMILES": ["c1ccccc1", "c1cnccc1", "n1cnccc1"]
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
# Convert to molecules
|
|
178
|
-
df.as_molecule("SMILES", inplace=True)
|
|
179
|
-
|
|
180
|
-
# DataFrame automatically renders molecules as structures
|
|
181
|
-
df # Molecule column shows chemical structures!
|
|
182
|
-
|
|
183
|
-
# Add substructure highlighting
|
|
184
|
-
df.SMILES.highlight("c1ccccc1") # Highlight aromatic rings
|
|
185
|
-
df
|
|
186
|
-
|
|
187
|
-
# Align molecules to a reference
|
|
188
|
-
df.SMILES.align_depictions("first") # Align to first molecule
|
|
189
|
-
df
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Substructure Highlighting
|
|
193
|
-
|
|
194
|
-
```python
|
|
195
|
-
# Highlight SMARTS patterns
|
|
196
|
-
df["Pattern"] = ["cc", "cnc", "ncn"]
|
|
197
|
-
df.highlight_using_column("Molecule", "Pattern", inplace=True)
|
|
198
|
-
df # Shows molecules with different highlights per row
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Fingerprint Similarity
|
|
202
|
-
|
|
203
|
-
```python
|
|
204
|
-
# Color molecules by fingerprint similarity
|
|
205
|
-
reference_mol = oechem.OEGraphMol()
|
|
206
|
-
oechem.OESmilesToMol(reference_mol, "c1ccc(N)cc1")
|
|
207
|
-
|
|
208
|
-
df.fingerprint_similarity("Molecule", reference_mol, inplace=True)
|
|
209
|
-
df # Shows similarity coloring and Tanimoto coefficients
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
## Demo Notebooks
|
|
213
|
-
|
|
214
|
-
Explore comprehensive examples in the `demos/` directory:
|
|
215
|
-
|
|
216
|
-
### [Small_Molecules.ipynb](demos/Small_Molecules.ipynb)
|
|
217
|
-
**Complete CNotebook Tutorial** - Comprehensive guide covering:
|
|
218
|
-
- Basic molecule rendering and display options
|
|
219
|
-
- OE2DMolDisplay objects with custom styling
|
|
220
|
-
- Molecule grid layouts with highlighting
|
|
221
|
-
- Advanced rendering configuration
|
|
222
|
-
- Pandas DataFrame integration with oepandas
|
|
223
|
-
- Substructure highlighting and SMARTS patterns
|
|
224
|
-
- Column-based highlighting with different patterns per row
|
|
225
|
-
- Molecular alignment techniques
|
|
226
|
-
- Fingerprint similarity visualization
|
|
227
|
-
- Empty and invalid molecule handling
|
|
228
|
-
|
|
229
|
-
### [SVGs.ipynb](demos/SVGs.ipynb)
|
|
230
|
-
**SVG Rendering Guide** - Learn how to:
|
|
231
|
-
- Switch from PNG to SVG output format
|
|
232
|
-
- Benefits and trade-offs of SVG vs PNG
|
|
233
|
-
- High-quality crisp molecular graphics
|
|
234
|
-
- SVG compatibility considerations
|
|
235
|
-
|
|
236
|
-
## Configuration Options
|
|
237
|
-
|
|
238
|
-
### Global Context Settings
|
|
239
|
-
|
|
240
|
-
```python
|
|
241
|
-
ctx = cnotebook.cnotebook_context.get()
|
|
242
|
-
|
|
243
|
-
# Image dimensions
|
|
244
|
-
ctx.width = 250 # Default width in pixels
|
|
245
|
-
ctx.height = 250 # Default height in pixels
|
|
246
|
-
ctx.max_width = 1200 # Maximum width (prevents oversized molecules)
|
|
247
|
-
ctx.max_height = 800 # Maximum height
|
|
248
|
-
|
|
249
|
-
# Output format
|
|
250
|
-
ctx.image_format = "png" # or "svg"
|
|
251
|
-
|
|
252
|
-
# Display options
|
|
253
|
-
ctx.scale = 1.0 # Scaling factor
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### Environment-Specific Behavior
|
|
257
|
-
|
|
258
|
-
- **Jupyter**: Supports both PNG and SVG formats
|
|
259
|
-
- **Marimo**: Automatically uses PNG format for compatibility
|
|
260
|
-
- **Console**: Falls back to string representations
|
|
261
|
-
|
|
262
|
-
## Contributing
|
|
263
|
-
|
|
264
|
-
We welcome contributions! Please ensure your code:
|
|
265
|
-
- Follows existing code style and conventions
|
|
266
|
-
- Includes appropriate tests
|
|
267
|
-
- Works with both Jupyter and Marimo environments
|
|
268
|
-
- Maintains compatibility with OpenEye Toolkits
|
|
269
|
-
|
|
270
|
-
## License
|
|
271
|
-
|
|
272
|
-
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
273
|
-
|
|
274
|
-
## Issues & Support
|
|
275
|
-
|
|
276
|
-
For bug reports, feature requests, or general support, please open an issue on GitHub or contact the author at [scott.arne.johnson@gmail.com](mailto:scott.arne.johnson@gmail.com).
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
*CNotebook makes chemical data visualization effortless. Import once, visualize everywhere!* 🧬✨
|
cnotebook-1.2.0.dist-info/RECORD
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
cnotebook/__init__.py,sha256=31LjoTU4gu19fgH9g3WGG08Tqopq69mSizz-AUu5WQ8,2702
|
|
2
|
-
cnotebook/align.py,sha256=u22GEHJc8QzCb9If2mjuapKPOTBEB2iu6jtUfgmm1UQ,14086
|
|
3
|
-
cnotebook/context.py,sha256=MXOIIZ7PkWZ8Wi11L00ldAqsaNCBmJRc76bETelIq9w,17493
|
|
4
|
-
cnotebook/helpers.py,sha256=r5-CIcmomd8vbd6ILGU6uW3sAjWZPcng82cikZ0ZDZ8,2193
|
|
5
|
-
cnotebook/ipython_ext.py,sha256=mu9eMQiYFEQeT8pS_xh-8Qx6N4dyn6_9u0YwlEudQXo,1989
|
|
6
|
-
cnotebook/marimo_ext.py,sha256=SPvej9LsRIFz8ljujMjppkm92BWTR8xgX9SqFmkY6VA,7169
|
|
7
|
-
cnotebook/pandas_ext.py,sha256=enGXKWDHOv6TK-MbA2H_KsP2IrAEViftyDvCKIjkTX8,35411
|
|
8
|
-
cnotebook/render.py,sha256=S7N7hPF61tppSAo7WN0kF89pWVJWKVMiDczy7RkOltA,13025
|
|
9
|
-
cnotebook-1.2.0.dist-info/licenses/LICENSE,sha256=HbIgeZz-pWGC7BEnYFCQ-jfD1m_BfiosF9qjgWw64GU,1080
|
|
10
|
-
cnotebook-1.2.0.dist-info/METADATA,sha256=i1vWVNcomhxVXtOAnsVk2YykR57T3EEeCvJvg91qst8,8789
|
|
11
|
-
cnotebook-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
-
cnotebook-1.2.0.dist-info/top_level.txt,sha256=jzkieTjQwdNKfMwnoElvDDtNPkeLMjbvWbsbkSsboo8,10
|
|
13
|
-
cnotebook-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|