spice-bio
Installation
Create a conda environment
conda create -n spice-env python=3.9
conda activate spice-env
Install spice-bio via pip:
pip3 install spice-bio
Examples
Detailed documentation for SOMA and Melange can be found at folder examples.
SOMA
Here is a simple example of how to use SOMA to train a model and predict PSI values:
from SPICE import Soma
import pandas as pd
df_train = pd.read_csv('path/to/your/df_data') # df contains columns 'psi'(ratio) and 'seq'
# train SOMA models, after training, the model parameters will be saved as 'SOMA_params_seed_0.pth', 'SOMA_params_seed_1.pth', etc.
Soma.train(
df_train, # pandas DataFrame with columns 'psi' and 'seq'
device='cuda', # 'cuda' or 'cpu'
epochs=1, # number of training epochs
batch_size=512, # batch size
learning_rate=1e-4, # learning rate
num_seeds=10 # number of SOMA models to train with different random initializations
)
df_test = pd.read_csv('path/to/your/df_test_data') # df_test contains column 'seq'
# predict PSI values using a trained SOMA model
pred_psi = Soma.predict(
df_test, # pandas DataFrame with column 'seq'
device='cuda', # 'cuda' or 'cpu'
batch_size=512, # batch size
params='SOMA_params_seed_0.pth') # path to the trained SOMA model parameters
Melange
Here is a simple example of how to use Melange and SOMA to generate sequences with desired PSI values:
from SPICE import Melange
import pandas as pd
df_train = pd.read_csv('path/to/your/df_data') # df contains columns 'psi'(ratio) and 'seq'
Melange.train(
df_train, # pandas DataFrame with columns 'psi' and 'seq'
device='cuda', # 'cuda' or 'cpu'
lambda_cls=5.0, # weight for the classification loss, use to control the trade-off between reconstruction and classification accuracy
max_len=250, # maximum sequence length
epochs=10, # number of training epochs
clf_ids=[0,1,2,3,4,5,6,7,8], # indices of the SOMA models to use as teachers
mode='PSI1to0', # choose from {'PSI1to0', 'PSI0to1', 'PSI1to0.5', 'PSI0to0.5', 'PSI0.5to1', 'PSI0.5to0'}
save_path='Melange_params.pth' # path to save the trained Melange model parameters
)
df_test = pd.read_csv('path/to/your/df_test_data') # df_test contains column 'seq'
gen_seq_psi_pred, org_seq_psi_pred = Melange.evaluate_reconstructions(
df_test, # pandas DataFrame with column 'seq'
clf_id=9, # index of the SOMA model to use for evaluation
device='cuda', # 'cuda' or 'cpu'
max_len=250, # maximum sequence length
params='Melange_params.pth' # path to the trained Melange model parameters
)
# visualize any parent and generated sequence using a trained Melange model
Melange.reconstruct_sequence(
df_test.iloc[0]['seq'], # input sequence
max_len=250, # maximum sequence length
device='cuda', # 'cuda' or 'cpu'
params='Melange_params.pth' # path to the trained Melange model parameters
)
Metadata
Release files for spice-bio 1.0.1
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 |
|---|---|---|---|---|
| spice-bio-1.0.1.tar.gz | 10.5 kB | Without provenance | Details for spice-bio-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spice_bio-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for spice_bio-1.0.1-py3-none-any.whl |
Total release size: 20.7 kB
Release files / spice-bio-1.0.1.tar.gz
| Download URL | spice-bio-1.0.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdfd04bce2f5e5cc7f6bdfab48d0e187f09e685c43f0b627b8218ae989414464
|
|
BLAKE2b-256 checksum How to use checksums |
a38968e0db86c312d39fc900a12afba0bf70bf2a0f0850bf798871add096bd92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / spice_bio-1.0.1-py3-none-any.whl
| Download URL | spice_bio-1.0.1-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7574f4f0c5f9a131ba240e63a2d5da7e2d439abc6fce9221110176c6eda32411
|
|
BLAKE2b-256 checksum How to use checksums |
b20c804962900fb35591264b6c08bf34a5f1c0e0d196c534bc8ea938d2cd08d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for spice-bio 1.0.1
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.