Chemical Shifts API
chemical_shifts
Classes
ShiftX2Predictor
Wrapper for the external ShiftX2 predictor.
Requires the 'shiftx2.py' (or 'shiftx2') executable to be in the system PATH, in the directory specified by SHIFTX2_DIR, or in typical installation locations.
ShiftX2 can be installed via SBGrid: 'sbgrid-cli install shiftx2' It can also be downloaded from here: http://www.shiftx2.ca/download.html
Source code in synth_nmr/chemical_shifts.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | |
Functions
is_available()
predict(structure)
Run ShiftX2 on a Biotite AtomArray.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
AtomArray
|
Biotite AtomArray. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Dict[int, Dict[str, float]]]
|
Predicted shifts in the standard dictionary format. |
Source code in synth_nmr/chemical_shifts.py
Functions
predict_chemical_shifts(structure)
Predict chemical shifts using the highest-accuracy available model. Attempt to use SHIFTX2 first, as it provides the best baseline accuracy. If SHIFTX2 is not available in the system PATH, or if prediction fails, falls back to the SPARTA+ empirical prediction model.
Note: The NeuralShiftPredictor (available in synth_nmr.neural_shifts) is
strictly experimental and serves as an educational example of how Protein
Language Models (PLMs) could be applied to NMR prediction. It currently requires
extensive retraining with geometric attention mechanisms to match or exceed
classical empirical force fields.
Source code in synth_nmr/chemical_shifts.py
predict_empirical_shifts(structure)
Predict chemical shifts based on secondary structure and ring currents.
This function combines random coil shifts, secondary structure-based offsets (SPARTA+-like), and ring current effects from aromatic residues to predict protein chemical shifts.
EDUCATIONAL NOTE - Prediction Algorithm:
- Calculate Backbone Dihedrals (Phi/Psi) for every residue.
- Classify Secondary Structure:
- Alpha: Phi ~ -60, Psi ~ -45
- Beta: Phi ~ -120, Psi ~ 120
- Coil: Everything else
- Calculate Shift: Shift = Random_Coil + Structure_Offset + Noise
LIMITATIONS: - Ring Current Effects (for protons): While an O(N^2) geometry check was previously a concern, these effects are now included for protons near aromatic rings (Phe, Tyr, Trp, His) using a point-dipole approximation. This is crucial for protons in close proximity to aromatic systems. Carbon atoms are not currently included for ring current effects. - H-Bonding: Hydrogen bonds affect Amide H shifts significantly. We omit this for simplicity. - Sequence History: Real shifts depend on (i-1) and (i+1) neighbor types. We omit this for simplicity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
AtomArray
|
A biotite.structure.AtomArray containing the protein. Must not be empty. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Dict[int, Dict[str, float]]]
|
A nested dictionary of predicted shifts: {chain_id: {res_id: {atom_name: value}}} |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the input is not a biotite.structure.AtomArray. |
ValueError
|
If the input structure is empty. |
Source code in synth_nmr/chemical_shifts.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
calculate_csi(shifts, structure)
Calculate the Chemical Shift Index (CSI) for C-alpha atoms.
The CSI is the deviation of an observed chemical shift from its random coil value. It is a reliable indicator of secondary structure. - Positive Delta(CA) > 0.7 ppm suggests a Helical conformation. - Negative Delta(CA) < -0.7 ppm suggests a Sheet conformation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shifts
|
Dict[str, Dict[int, Dict[str, float]]]
|
A dictionary of chemical shifts, as produced by |
required |
structure
|
AtomArray
|
A biotite.structure.AtomArray, required for mapping residue IDs to names. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Dict[int, float]]
|
A dictionary containing the C-alpha CSI for each residue: {chain_id: {res_id: delta_ppm}} |
Raises:
| Type | Description |
|---|---|
TypeError
|
If inputs are not of the correct type. |
ValueError
|
If inputs are empty. |
Source code in synth_nmr/chemical_shifts.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |