chromospyce
This is an anywidget-powered version of the chromospace library intended for use in computational notebooks, such as Jupyter Notebook.
Basic usage
The available functionality is pretty limited at this moment. We will stabilize the API as we go. At this point, you can display 3D chromatin models.
import chromospyce
import numpy as np
BINS_NUM = 1000
# Step 1: Generate random structure, returns a 2D numpy array:
def make_random_3D_chromatin_structure(n):
position = np.array([0.0, 0.0, 0.0])
positions = [position.copy()]
for _ in range(n):
step = np.random.choice([-1.0, 0.0, 1.0], size=3) # Randomly choose to move left, right, up, down, forward, or backward
position += step
positions.append(position.copy())
return np.array(positions)
random_structure = make_random_3D_chromatin_structure(BINS_NUM)
# Step 2: Display the structure in a chromospyce widget
numbers = list(range(0, BINS_NUM+1))
vc = {
"color": {
"values": numbers,
"min": 0,
"max": BINS_NUM,
"colorScale": "Spectral"
},
"scale": 0.01,
"links": True,
"mark": "sphere"
}
chromospyce.Widget(random_structure, vc)
The underlying JS library, chromospace, only supports data in the Apache Arrow format.
In chromospyce, on the other hand, you can also visualize structures
defined as 2D numpy arrays, or pandas dataframe (with columns named 'x',
'y', 'z'.
Quickly test out chromospyce with uv:
uv run --with chromospyce --with numpy --with pyarrow --with jupyterlab jupyter lab- make a new notebook
- copy and paste the code above into an empty cell
Metadata
Release files for chromospyce 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chromospyce-0.1.2.tar.gz | 2.0 MB | Without provenance | Details for chromospyce-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chromospyce-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for chromospyce-0.1.2-py3-none-any.whl |
Total release size: 2.0 MB
Release files / chromospyce-0.1.2.tar.gz
| Download URL | chromospyce-0.1.2.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8990f84e7bb19c17e944affc6d3f7df69c28f2cce777926a7b5feb4a58b85ca
|
|
BLAKE2b-256 checksum How to use checksums |
98bff43b6cbad614198c2ccf902d1885b546c6991c45f2e7d992a8573abbf3dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.16
|
Release files / chromospyce-0.1.2-py3-none-any.whl
| Download URL | chromospyce-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d6a7f23339daf9161adc8e34cd9d7a7674c670f8f97a1dfa1c32e177e64ef99
|
|
BLAKE2b-256 checksum How to use checksums |
1209880a1647ae8a2c0435d3d0df6ac5feb51bde5b1c4093265f770273555fbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.16
|
Security for chromospyce 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.