Examples and notebooks¶
The first three notebooks are self-contained offline tutorials. Download a
writable copy and use a Python kernel with the development package plus
.[ml,wavelets,validation] installed. They require no external peptide dataset,
AAindex download, UMAP, or MISTIC. Their code is executed in documentation CI.
After installation, locate the bundled notebooks without assuming a site-packages path, then copy one to a writable workspace:
from importlib.resources import files
import shutil
examples = files("protspect.examples")
notebook = examples.joinpath("01_matrix_to_features.ipynb")
assert notebook.is_file()
# shutil.copyfile(notebook, "my_first_tutorial.ipynb")
1. Matrix view and first features¶
01 — Matrix view and first featuresRead the supplied one-hot/embedding diagram, build the matrices explicitly, check the axis-0 FFT against Protspect, compare BLOSUM100 and Kidera, and select coefficients from a sequence table. Edit the sequence and padded length.
2. Transforms and paired chains¶
02 — Transforms and paired chainsCompare four transforms of one signal, adjust Z/Mellin/wavelet settings, inspect actual axes, and use ComplexSet for aligned cross-chain products. Includes an executable conjugation check when chains are reversed.
3. Training-only machine learning¶
03 — Fitted pipelines and synthetic comparisonGenerate labelled synthetic sequences, split before fitting, tune four transforms in a Pipeline, and evaluate the selected model on held-out data. Inspect frozen channel moments and JSON-safe metadata. Synthetic accuracy is not evidence of antimicrobial or other biological performance.
Research workflows¶
These notebooks use checkout helpers or user-managed inputs. They are not run as part of the small offline documentation suite.
AMP four-transform MLP benchmarkExisting ABP_GN split, matched baseline MLP sizes, validation selection, training-only scaling, ROC/PR/loss curves, and provenance exports. Start with Compare MLPs on antimicrobial peptides.
Embedding atlasCompare AAindex, BLOSUM100, and Kidera channels and whole representations. Requires explicit local AAindex snapshots and the research plotting stack. Start with Explore the residue-embedding atlas.
Existing transform sandboxA compact plotting notebook for transform settings and fixed-width features.
Small Python examples¶
Run these as modules from a checkout, or with the editable package installed. The AAindex examples require explicit local inputs.
"""Core-only unified API example; both collection types support every backend."""
from protspect import ComplexSet, SequenceSet
sequences = SequenceSet(method='fourier', compute_cross_spectra=False)
sequences.from_sequence_list(
["ACDE", "ACDF"], length=8,
attributes={"name": ["peptide-1", "peptide-2"]},
)
print(sequences.export_features(attributes=["name"]))
pairs = ComplexSet(method='z', transform_options={'radius': 1.05})
pairs.from_sequence_list(["ACDE"], ["ACDF"], length=8)
print(pairs.export_features(('amplitude', 'phase')).shape)
Basic collection example ·
Normalized sklearn pipeline ·
AAindex1 adapter ·
AAindex2/3 adapters
The old CPP/MISTIC research notebook remains under research/ with its own
locked environment and data provenance. It is a separate scientific example,
not an installation prerequisite for Protspect.