Skip to main content

CSP5: pip-installable NMR predictor for 13C and 1H.

Project description

CSP5

CSP5 is a pip-installable NMR predictor package with:

  • batched 13C and 1H prediction
  • prediction from precomputed geometries
  • shift matching utilities with dp (default), scipy, and murty (k-best)

Bundled defaults:

  • 13C model: CSP5-13C (model_id: csp5-13c)
  • 1H model: CSP5-1H (model_id: csp5-1h)

Bundled quantile models:

  • 13C quantile model: CSP5q-13C (model_id: csp5q-13c)
  • 1H quantile model: CSP5q-1H (model_id: csp5q-1h)

Install

Requires Python 3.9 or newer.

pip install CSP5

Prediction CLI

In interactive terminals, csp5 prints status lines to stderr before and after prediction. If a run is slow, it prints an additional note that first invocation can take longer while dependencies and model weights initialize, plus periodic "still working" updates during long runs. Use --no-status to silence them.

From SMILES

csp5 --smiles "CCO" --nucleus 1H
csp5 --smiles "CCO" --nucleus both
csp5 --smiles-file smiles.txt --nucleus 13C --batch-size 64
csp5 --smiles "CCO" --nucleus 13C --num-conformers 8
csp5 --smiles "CCO" --nucleus both --num-conformers 8 --output-conformers-json cco_conformers.json
csp5 --smiles "CCO" --nucleus 13C --num-conformers 8 --output-conformers-sdf cco_conformers.sdf
csp5 --smiles "CCO" --nucleus 13C --output-svg cco_13c.svg
csp5 --smiles "CCO" --nucleus 13C --output-svg cco_13c.svg --svg-bond-length 72 --svg-shift-font-scale 1.1
csp5 --smiles "CCO" --nucleus 13C --model-name CSP5q-13C
csp5 --smiles "CCO" --nucleus 1H --model-name CSP5q-1H

From molecule files (molfile or SDF)

By default, molecule-file input uses the coordinates embedded in the file. Add --regenerate-geometry to keep the input atom order/numbering while generating fresh ETKDG + MMFF/UFF coordinates for prediction.

csp5 --molecule-file input.mol --nucleus 13C
csp5 --molecule-file input.sdf --nucleus 1H --regenerate-geometry

From precomputed geometries (parquet structures dataset)

Input dataset requirements:

  • required columns: smiles, molblock
  • optional columns: conformer_rank, conformer_id, energy, energy_method

Predict only rank-0 conformers:

csp5 \
  --structures-path /path/to/structures.parquet \
  --conformer-rank 0 \
  --nucleus 1H \
  --batch-size 64

Predict using all conformers in the dataset:

csp5 \
  --structures-path /path/to/structures.parquet \
  --use-all-conformers \
  --nucleus 13C

Prediction Python API

from csp5 import draw_prediction, predict_molecule_file, predict_smiles, predict_structures, predict_sdf

# Standard SMILES mode
res = predict_smiles(["CCO", "c1ccccc1"], nucleus="1H", batch_size=32)
print(res.predictions.head())
svg = draw_prediction(res)

# Precomputed-geometry parquet mode
res2 = predict_structures(
    "/path/to/structures.parquet",
    nucleus="1H",
    conformer_rank=0,
    use_all_conformers=False,
)

# Precomputed-geometry SDF mode
res3 = predict_sdf("/path/to/embedded.sdf", nucleus="13C")

# Molfile/SDF mode with fresh generated geometry while preserving atom order
res4 = predict_molecule_file("/path/to/input.mol", nucleus="13C", regenerate_geometry=True)

# Quantile models for uncertainty quantification
res5 = predict_smiles(["CCO"], nucleus="13C", model_name="CSP5q-13C")
print(res5.predictions[["atom_index", "shift_ppm", "shift_q05_ppm", "shift_q50_ppm", "shift_q95_ppm"]])

Matching CLI

csp5-match expects one shift per line in each file.

Default fast path (dp)

csp5-match \
  --predicted-file predicted.txt \
  --experimental-file experimental.txt \
  --solver dp

SciPy Hungarian option

csp5-match \
  --predicted-file predicted.txt \
  --experimental-file experimental.txt \
  --solver scipy

Murty k-best option

csp5-match \
  --predicted-file predicted.txt \
  --experimental-file experimental.txt \
  --solver murty \
  --k-best-policy clip \
  --k-best 25 \
  --temperature 0.5 \
  --mae-delta-threshold 0.2

Matching Python API

from csp5 import match_shifts

pred = [7.35, 7.30, 1.25]
exp = [7.34, 7.31, 1.20]

# DP (default)
r1 = match_shifts(pred, exp, solver="dp")

# SciPy Hungarian
r2 = match_shifts(pred, exp, solver="scipy")

# Murty k-best
r3 = match_shifts(pred, exp, solver="murty", k_best=10, k_best_policy="clip")
print(r3.assignment_entropy, r3.num_competing_assignments)

Solver Notes

  • dp is the default and is intended for the standard 1D shift objective.
  • scipy uses Hungarian assignment on the full padded cost matrix.
  • murty is the k-best solver; use this when you need assignment ambiguity analysis.
  • For murty, k_best_policy="clip" (default) returns all feasible unique assignments when k_best is larger than what exists. Use k_best_policy="strict" to fail instead.
  • dp and scipy are top-1 only (k_best must be 1).

Output Notes

  • Prediction failures are returned explicitly (failures) with reason tags.
  • Prediction output always includes nucleus, model_id, and model_name.
  • Quantile models are selected explicitly with model_name="CSP5q-13C" or model_name="CSP5q-1H". Their shift_ppm value is the median prediction (shift_q50_ppm) and the output also includes shift_q01_ppm through shift_q99_ppm, plus shift_std_ppm estimated from the calibrated q10-q90 interval. CSP5q-13C and CSP5q-1H return calibrated quantile columns for uncertainty quantification.
  • For structures-mode predictions, conformer metadata columns are propagated when available.
  • CLI JSON is molecule-oriented, with top-level model metadata, per-molecule prediction lists, and atom-map numbers matching mapped_smiles_explicit_h.
  • Use --nucleus both to write 13C and 1H predictions in one JSON, grouped by nucleus under each molecule's predictions.
  • In SMILES mode, --num-conformers N predicts generated conformers and returns Boltzmann-averaged shifts at 298.15 K (--boltzmann-temperature-k changes the temperature). The default remains one conformer.
  • In structures mode, --use-all-conformers also returns Boltzmann-averaged shifts. Use --output-conformers-json to save individual conformer predictions separately.
  • Use --output-conformers-sdf to save the exact conformer geometry or geometries used for prediction.
  • Use --molecule-file path.mol or --molecule-file path.sdf for molfile/SDF input. Add --regenerate-geometry to discard embedded coordinates and create fresh geometry without changing the input atom order used for atom maps.
  • Use --output-svg path.svg or draw_prediction(result) to create an RDKit-native SVG drawing with atom labels (C4, H9) and shift notes. SVGs auto-size by default. Use both --svg-width and --svg-height to force a fixed canvas; tune with --svg-bond-length, --svg-atom-font-size, --svg-shift-font-scale, and --svg-padding.
  • When drawing quantile-model predictions, each shift note includes the median followed by shift_std_ppm, for example 18.35 +/- 1.24.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csp5-0.2.16.tar.gz (68.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

csp5-0.2.16-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (68.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

csp5-0.2.16-cp313-cp313-macosx_11_0_universal2.whl (68.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (68.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

csp5-0.2.16-cp312-cp312-macosx_11_0_universal2.whl (68.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (68.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

csp5-0.2.16-cp311-cp311-macosx_11_0_universal2.whl (68.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (68.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

csp5-0.2.16-cp310-cp310-macosx_11_0_universal2.whl (68.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (68.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

csp5-0.2.16-cp39-cp39-macosx_11_0_universal2.whl (68.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file csp5-0.2.16.tar.gz.

File metadata

  • Download URL: csp5-0.2.16.tar.gz
  • Upload date:
  • Size: 68.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for csp5-0.2.16.tar.gz
Algorithm Hash digest
SHA256 8e2cc5d8bc292dbe9585bc00ecc46573dcc8e7b718177c321e99eceaa81ae5d1
MD5 ae052ba2b782ae3cbfea963ad3b4e794
BLAKE2b-256 cd8002fb54697d17267def8b5f8e3cdaf90caab2e7ccdf90eddef0d305d41fc3

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92412fb26a0c6c7277d2af144df9be3cc0c56f253603f5152d682c1d88048a57
MD5 46bb7f9708bca16a316b68c4ec14f791
BLAKE2b-256 ae4551bc7267eb5e507a3690e8f602642bc7a34ce060f4d7d28846c7aee82e9a

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp313-cp313-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 2dc2ca81abdcc493bf97e18c748c802e2b88754126b75c485783d2270ea09001
MD5 fc5b640197b65c65356764d357c71e3d
BLAKE2b-256 df6140c5ab10b891912a8e6599bd92da899f284ba7f4ce25728db8519e20ef99

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7dbf1c66bb9fa3a522e11043acc0c1506753ade86e57c72f299c11b5f7a2c9da
MD5 32dc43c378932dd07730c036c9accafc
BLAKE2b-256 ca2cde2a00b0827ea3db5fa725374a5021f2e58fc63699ef123e4dd405b92c2c

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 f8f31bfa52584da05109b5d6325ba0d80fd10bcc7ee18692ef1b51953d4b768f
MD5 d26bf184d85a94e2e8d09fffcc14d4e9
BLAKE2b-256 6cf518d224651bbe7ea861535c66a10f29892ce81dc8f72c3aa26f1929982976

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 549fafac7e6691c6e1c01face394bf4a624049f8207a30400978ea5916e15780
MD5 01dc57fec97a88bb8b5ecb994b0d2728
BLAKE2b-256 c438c32f9c6257a5d7583faf47708fb33a174991b1e23c5edd47deaa46233db2

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 0cc31207df7f43cef30adb920d77803879ee9df19c69db42182a28420629959a
MD5 a7c7c49351d98deec741007a4fc05578
BLAKE2b-256 5e612b7d3baaee519244ee3b7a7a76e335c8e4a0b2807e14e12d2f5355e68f50

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 952250620ba268bce511de2dd41858d11df854e93253176ba403fc876e5ce7eb
MD5 f530a132c9f624ebbc9a1fdfab8dfd70
BLAKE2b-256 663b0555649802aea32058d1b45d480c660df608a2cd4114622649e5abf24d60

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 465ba4b9876570dd9a08108789c61f44d571db8b3fde52f30a3556559d7a0dda
MD5 3c2da47a8e6b9b635615ea4a9ceeec86
BLAKE2b-256 a8ab24af3cf7717300e414ba8775c6d5df335149918643ab5cf9a4b08f1c6da8

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 697379bfced3c8c8a2ed59436463d49e141a64b2b5d203254e052e5189dd78d1
MD5 74a385a7158829ad7b53b9cece601c80
BLAKE2b-256 2bfe324e9820365fa05c469645cd757056720b295382a321adf8c5a541d8a353

See more details on using hashes here.

File details

Details for the file csp5-0.2.16-cp39-cp39-macosx_11_0_universal2.whl.

File metadata

  • Download URL: csp5-0.2.16-cp39-cp39-macosx_11_0_universal2.whl
  • Upload date:
  • Size: 68.0 MB
  • Tags: CPython 3.9, macOS 11.0+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for csp5-0.2.16-cp39-cp39-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 5dc27283ab136e5ba69adaeb0512c2cd4a985726ed7ceaeb2dffcebcbeb523e5
MD5 73293eff6ac9d0db3d59e5edb3e27f2a
BLAKE2b-256 0697f870cd89a2c99032cccb5bcac9dedb71dee90dff1abcc01bee1569ecf33e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page