API Reference
Sicifus
sicifus.Sicifus
Main API for Sicifus.
Source code in src/sicifus/api.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 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 344 345 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 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 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 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 | |
backbone
property
all_atom
property
Returns protein heavy atoms (sidechains included). Hydrogens are excluded by default for performance, unless using legacy data.
ligands
property
meta
property
Returns all loaded metadata joined into a single LazyFrame on structure_id. If multiple metadata sources are loaded, they are joined together.
clusters
property
Returns the cluster assignments DataFrame (structure_id, cluster). Available after calling annotate_clusters().
ingest(input_folder, batch_size=100, file_extension='cif', protonate=False)
Ingests structure files from a folder into the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_folder
|
str
|
Folder containing structure files. |
required |
batch_size
|
int
|
Number of files per parquet partition. |
100
|
file_extension
|
str
|
File extension to look for (e.g., "cif", "pdb"). |
'cif'
|
protonate
|
bool
|
If True, uses PDBFixer (OpenMM) to add hydrogens to the structure before parsing. This ensures consistent protonation for energy calculations. |
False
|
Source code in src/sicifus/api.py
load()
Loads the database (lazy).
Source code in src/sicifus/api.py
get_structure(structure_id)
get_all_atoms(structure_id)
Retrieves ALL protein atoms (including sidechains) for a structure.
get_ligands(structure_id)
load_metadata(path, name=None, id_column='id')
Loads external metadata (CSV) and stores it in the database as parquet. The metadata is joined to structures via structure_id.
Supports
- A single CSV file with an id column matching structure IDs.
- A directory of CSVs — all are concatenated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to a CSV file or a directory of CSVs. |
required |
name
|
Optional[str]
|
Name for this metadata source (used for storage and lookup). Defaults to the filename stem (e.g. "3ca3.summarize" → "3ca3_summarize"). |
None
|
id_column
|
str
|
Name of the column in the CSV that contains structure IDs. Defaults to "id". |
'id'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The loaded metadata as a Polars DataFrame. |
Source code in src/sicifus/api.py
meta_columns()
Lists all available metadata columns (across all loaded sources).
hist(column, bins=30, title=None, output_file=None, **kwargs)
Plots a histogram of any metadata column.
If cluster annotations exist, you can pass color_by="cluster" to color the histogram by cluster assignment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
str
|
Column name from the metadata (e.g. "radius_of_gyration"). |
required |
bins
|
int
|
Number of histogram bins. |
30
|
title
|
Optional[str]
|
Plot title. Defaults to the column name. |
None
|
output_file
|
Optional[str]
|
Save to file instead of showing. |
None
|
**kwargs
|
Extra kwargs passed to matplotlib hist(). |
{}
|
Examples:
db.hist("radius_of_gyration") db.hist("protein_length", bins=50)
Source code in src/sicifus/api.py
scatter(x, y, title=None, output_file=None, **kwargs)
Scatter plot of two metadata columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
str
|
Column name for x-axis. |
required |
y
|
str
|
Column name for y-axis. |
required |
title
|
Optional[str]
|
Plot title. |
None
|
output_file
|
Optional[str]
|
Save to file instead of showing. |
None
|
**kwargs
|
Extra kwargs passed to matplotlib scatter(). |
{}
|
Examples:
db.scatter("protein_length", "radius_of_gyration")
Source code in src/sicifus/api.py
align_all(reference_id, target_ids=None)
Aligns all (or specified) structures to a reference structure. Returns a DataFrame with RMSD and alignment stats.
Source code in src/sicifus/api.py
get_aligned_structure(structure_id, reference_id)
Returns the structure transformed to align with the reference.
Source code in src/sicifus/api.py
generate_tree(structure_ids=None, output_file=None, root_id=None, newick_file=None, pruning_threshold=None, layout='circular')
Generates a structural phylogenetic tree. Unrooted by default. Branch lengths are RMSD values.
This is the expensive step (O(N^2) alignments). After this, use tree_stats() to inspect branch lengths, then annotate_clusters() to assign clusters cheaply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_ids
|
Optional[List[str]]
|
List of structure IDs. If None, uses all structures (warning: O(N^2)). |
None
|
output_file
|
Optional[str]
|
Save the tree plot to this file (e.g. "tree.png"). |
None
|
root_id
|
Optional[str]
|
Root the tree at this structure ID. If None, tree is unrooted. |
None
|
newick_file
|
Optional[str]
|
Export to Newick format for iTOL or similar tools. |
None
|
pruning_threshold
|
Optional[float]
|
Skip alignment for structurally dissimilar pairs (0.0-1.0). |
None
|
layout
|
str
|
Tree layout for the plot: "circular" (default, unrooted radial) or "rectangular". |
'circular'
|
Returns:
| Type | Description |
|---|---|
|
Biopython Tree object. |
Source code in src/sicifus/api.py
cluster(structure_ids=None, distance_threshold=2.0, coverage_threshold=0.8, output_file=None)
Fast greedy structural clustering (no full tree required).
Uses a 3Di k-mer prefilter to rapidly identify candidate centroids, then only computes RMSD for those candidates. Much faster than building a full phylogenetic tree for large datasets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_ids
|
Optional[List[str]]
|
Structures to cluster. If None, uses all. |
None
|
distance_threshold
|
float
|
Max RMSD (Ã…) for assigning to a centroid. |
2.0
|
coverage_threshold
|
float
|
Min length-ratio for comparing two structures. |
0.8
|
output_file
|
Optional[str]
|
Save a summary bar-chart of cluster sizes. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with columns |
DataFrame
|
|
Source code in src/sicifus/api.py
annotate_clusters(distance_threshold, output_file=None, layout='circular')
Annotates the tree with cluster labels by cutting branches whose RMSD exceeds distance_threshold. Each resulting subtree becomes a cluster.
This is cheap and instant — run it multiple times with different thresholds after generate_tree() to explore coarse vs fine clustering.
Use tree_stats() first to see the branch length distribution and pick a meaningful threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance_threshold
|
float
|
Cut branches longer than this RMSD value. e.g. 1.0 = subtrees separated by > 1 Ã… RMSD become different clusters. |
required |
output_file
|
Optional[str]
|
Optionally re-plot the tree with cluster colors. |
None
|
layout
|
str
|
"circular" (default) or "rectangular". |
'circular'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with columns: structure_id, cluster |
Source code in src/sicifus/api.py
tree_branch_lengths()
Returns all branch lengths from the tree. Use this to understand the distribution and pick a meaningful distance_threshold for clustering.
Example
bls = db.tree_branch_lengths() print(f"min={bls.min():.2f}, median={np.median(bls):.2f}, max={bls.max():.2f}")
Then pick a threshold that makes biological sense
Source code in src/sicifus/api.py
tree_stats()
Prints summary statistics of the tree's branch lengths (RMSD). Helps you pick a good distance_threshold for clustering.
Source code in src/sicifus/api.py
get_cluster(cluster_id)
Returns all structure IDs belonging to a specific cluster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cluster_id
|
int
|
The cluster number to query. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List of structure IDs in that cluster. |
Source code in src/sicifus/api.py
get_cluster_for(structure_id)
Returns the cluster ID that a specific structure belongs to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
The structure to look up. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The cluster number. |
Source code in src/sicifus/api.py
get_cluster_siblings(structure_id)
Returns all structure IDs in the same cluster as the given structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
The reference structure. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List of structure IDs in the same cluster (including the reference). |
Source code in src/sicifus/api.py
cluster_summary()
Returns a summary of all clusters: cluster ID, count, and member IDs.
Source code in src/sicifus/api.py
get_clustered_ids(min_size=2)
Returns structure IDs that belong to clusters with at least min_size members. Filters out singletons (or small clusters) — the outliers on long branches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_size
|
int
|
Minimum cluster size to include (default 2 = drop singletons). |
2
|
Returns:
| Type | Description |
|---|---|
List[str]
|
List of structure IDs. |
Source code in src/sicifus/api.py
analyze_ligand_binding(ligand_name, structure_ids=None, output_file=None)
Analyzes binding residues for a specific ligand across structures. Plots a histogram of binding residue types.
Source code in src/sicifus/api.py
analyze_pi_stacking(ligand_name, structure_ids=None, output_file=None, charge=None, infer_bond_orders=True)
Detects pi-stacking interactions (sandwich, parallel displaced, T-shaped) between protein aromatic residues and aromatic rings in the specified ligand.
Requires all_atom data (re-ingest if you only have backbone/CA).
Produces a grouped bar chart of interaction types and residue breakdown. Returns a DataFrame of all detected interactions.
The ligand_ring_atoms column uses the same canonical atom labels
as analyze_ligand_contacts and the 2D depiction, so atom names
are consistent across all analyses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ligand_name
|
str
|
Three-letter ligand code (e.g. "GLC", "ATP"). |
required |
structure_ids
|
Optional[List[str]]
|
Optional list of structures to analyze. Defaults to all structures containing the ligand. |
None
|
output_file
|
Optional[str]
|
Save the plot instead of displaying. |
None
|
charge
|
Optional[int]
|
Total formal charge of the ligand (passed to build_ligand_mol). |
None
|
infer_bond_orders
|
bool
|
Whether to infer double/aromatic bonds (passed to build_ligand_mol). |
True
|
Example
pi_df = db.analyze_pi_stacking("ATP")
Source code in src/sicifus/api.py
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
analyze_ligand_contacts(ligand_name, distance_cutoff=3.3, structure_ids=None, output_file=None, ligand_2d_file=None, charge=None, infer_bond_orders=True)
Identifies atom-level protein-ligand contacts within a distance cutoff. Default 3.3 Ã… is appropriate for hydrogen bonding.
Requires all_atom data (re-ingest if you only have backbone/CA).
Produces TWO visualizations
1) Stacked bar chart: which ligand atoms form the most contacts. 2) 2D ligand depiction (RDKit): atoms color-coded by contact count (red = many, blue = few) so you can cross-reference the chart.
Returns a DataFrame of all contacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ligand_name
|
str
|
Three-letter ligand code. |
required |
distance_cutoff
|
float
|
Max distance in Ã… (default 3.3 for H-bonds). |
3.3
|
structure_ids
|
Optional[List[str]]
|
Optional list of structures. |
None
|
output_file
|
Optional[str]
|
Save the contacts bar chart to file. |
None
|
ligand_2d_file
|
Optional[str]
|
Save the 2D ligand depiction to file. If not set, auto-generates filename from output_file or displays inline. |
None
|
charge
|
Optional[int]
|
Total formal charge of the ligand (e.g. -3 for citrate). Helps RDKit infer correct protonation / bond orders in the 2D depiction. |
None
|
infer_bond_orders
|
bool
|
If True, RDKit will try to determine double and aromatic bonds from 3D geometry. Set to False if the 2D depiction shows incorrect double bonds — it will display connectivity only (all single bonds), which is still useful. |
True
|
Example
contacts = db.analyze_ligand_contacts("GLC", distance_cutoff=3.3)
If the 2D shows wrong double bonds, pass the charge or disable inference:
contacts = db.analyze_ligand_contacts("CIT", charge=-3) contacts = db.analyze_ligand_contacts("LIG", infer_bond_orders=False)
Source code in src/sicifus/api.py
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | |
get_binding_pockets(ligand_name, distance_cutoff=8.0, structure_ids=None)
Returns a DataFrame where each row is a structure and columns are residue counts in the binding pocket (e.g. ALA, TRP, etc.).
This is useful for filtering structures based on pocket composition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ligand_name
|
str
|
Three-letter ligand code. |
required |
distance_cutoff
|
float
|
Radius in Angstroms (default 8.0). |
8.0
|
structure_ids
|
Optional[List[str]]
|
Optional list of structures. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with structure_id and counts for each residue type found. |
DataFrame
|
Missing residues are filled with 0. |
Source code in src/sicifus/api.py
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 | |
analyze_binding_pocket(ligand_name, distance_cutoff=8.0, structure_ids=None, output_file=None)
Analyzes the amino acid composition of the binding pocket (residues within a defined radius of the ligand) across all structures.
Produces a histogram of residue counts (X-axis = 20 amino acids).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ligand_name
|
str
|
Three-letter ligand code. |
required |
distance_cutoff
|
float
|
Radius in Angstroms (default 8.0). |
8.0
|
structure_ids
|
Optional[List[str]]
|
Optional list of structures. |
None
|
output_file
|
Optional[str]
|
Save the histogram to file. |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, int]
|
Dictionary of residue counts (e.g. {'ALA': 10, 'HIS': 5}). |
Source code in src/sicifus/api.py
repair_structure(structure_id, **kwargs)
Repair a structure: fix missing atoms, add hydrogens, minimise.
Repairs protein structure by fixing clashes and adding missing atoms. Requires pdbfixer and openmm
(install with pip install sicifus[energy]).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
RepairResult
|
RepairResult with repaired PDB and energy change. |
Source code in src/sicifus/api.py
calculate_stability(structure_id, **kwargs)
Calculate total potential energy with per-term decomposition.
Calculates protein stability using energy minimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
StabilityResult
|
StabilityResult with total energy (kcal/mol) and per-force-term breakdown. |
Source code in src/sicifus/api.py
mutate_structure(structure_id, mutations, **kwargs)
Apply point mutations, minimise, and compute ddG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
mutations
|
List[Union[Mutation, str]]
|
List of Mutation objects or strings
(e.g. |
required |
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
MutationResult
|
MutationResult with wild-type energy, mutant energy, ddG, and |
MutationResult
|
mutant PDB strings. |
Source code in src/sicifus/api.py
load_mutations(csv_path)
Load a mutation list from a CSV file.
The CSV must have a mutation column (e.g. G13L). An optional
chain column provides chain IDs; if absent, defaults to 'A'.
Extra columns are preserved as metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_path
|
str
|
Path to a CSV file. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame ready for :meth: |
Source code in src/sicifus/api.py
mutate_batch(structure_id, mutations_df, **kwargs)
Run every mutation in a DataFrame against a structure.
Each row is an independent single-point mutation. Extra columns from the input are carried through to the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
mutations_df
|
DataFrame
|
DataFrame with |
required |
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with input columns plus |
DataFrame
|
|
Source code in src/sicifus/api.py
calculate_binding_energy(structure_id, chains_a, chains_b, **kwargs)
Calculate binding energy between two groups of chains.
Calculates binding energy for protein-protein complexes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
chains_a
|
List[str]
|
Chain IDs for the first group (e.g. |
required |
chains_b
|
List[str]
|
Chain IDs for the second group (e.g. |
required |
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
BindingResult
|
BindingResult with binding energy and interface residues. |
Source code in src/sicifus/api.py
alanine_scan(structure_id, chain, positions=None, **kwargs)
Alanine scan: mutate each position to Ala and report ddG.
Performs systematic alanine scanning mutagenesis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
chain
|
str
|
Chain ID to scan. |
required |
positions
|
Optional[List[int]]
|
Specific residue numbers. If None, scans all eligible residues. |
None
|
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns [chain, position, wt_residue, ddg_kcal_mol]. |
Source code in src/sicifus/api.py
position_scan(structure_id, chain, positions, **kwargs)
Scan all 20 amino acids at specified positions.
Generates position-specific scoring matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
chain
|
str
|
Chain ID. |
required |
positions
|
List[int]
|
List of residue numbers to scan. |
required |
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns |
DataFrame
|
[chain, position, wt_residue, mut_residue, ddg_kcal_mol]. |
Source code in src/sicifus/api.py
per_residue_energy(structure_id, **kwargs)
Approximate per-residue energy contribution via Ala-subtraction.
Computes per-residue energy decomposition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_id
|
str
|
ID of the structure in the database. |
required |
**kwargs
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns |
DataFrame
|
[chain, residue_number, residue_name, energy_contribution_kcal_mol]. |
Source code in src/sicifus/api.py
Mutation Engine
sicifus.MutationEngine
Industry-standard protein mutation and stability engine using OpenMM + PDBFixer.
Provides structure repair, in silico mutagenesis, stability scoring, binding energy calculation, alanine scanning, and positional scanning without requiring the commercial protein design tools.
Source code in src/sicifus/mutate.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 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 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 | |
repair(source, pH=7.0, max_iterations=2000)
Repair a structure: fix missing atoms/residues, add hydrogens, minimise.
Repairs protein structure by fixing clashes and adding missing atoms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame of atoms. |
required | |
pH
|
float
|
pH for protonation (default 7.0). |
7.0
|
max_iterations
|
int
|
Maximum minimisation steps. |
2000
|
Returns:
| Type | Description |
|---|---|
RepairResult
|
RepairResult with repaired PDB and energy change. |
Source code in src/sicifus/mutate.py
calculate_stability(source, max_iterations=2000)
Calculate total potential energy with per-term decomposition.
Calculates protein stability using energy minimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame. |
required | |
max_iterations
|
int
|
Minimisation steps before scoring. |
2000
|
Returns:
| Type | Description |
|---|---|
StabilityResult
|
StabilityResult with total energy and per-force-term breakdown (kcal/mol). |
Source code in src/sicifus/mutate.py
mutate(source, mutations, chain='A', n_runs=3, max_iterations=2000, constrain_backbone=True, keep_statistics=True, use_mean=False, _repair_cache=None)
Apply one or more point mutations, minimise, and compute ddG.
Mutations can be Mutation objects or short strings like 'G13L'.
Multiple mutations in the same call are applied simultaneously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame.
Ignored when |
required | |
mutations
|
List[Union[Mutation, str]]
|
List of Mutation objects or strings (e.g. |
required |
chain
|
str
|
Default chain ID applied when parsing mutation strings
(default |
'A'
|
n_runs
|
int
|
Number of independent minimisation runs for the mutant (default 3). |
3
|
max_iterations
|
int
|
Minimisation steps per run (default 2000). |
2000
|
constrain_backbone
|
bool
|
If True, restrain backbone atoms during mutant minimisation, allowing only sidechain flexibility. |
True
|
keep_statistics
|
bool
|
If True, collect and return statistical summary (mean, SD, CI) from all runs (default True). |
True
|
use_mean
|
bool
|
If True, use mean energy for ddG calculation (industry-standard). If False, use best (minimum) energy (default False). |
False
|
_repair_cache
|
Optional[_RepairCache]
|
Pre-processed WT from :meth: |
None
|
Returns:
| Type | Description |
|---|---|
MutationResult
|
MutationResult with wild-type energy, mutant energy, ddG, |
MutationResult
|
mutant PDB strings, and a full energy-term DataFrame. If |
MutationResult
|
keep_statistics=True, also includes mean, SD, CI, and convergence |
MutationResult
|
metrics. |
Source code in src/sicifus/mutate.py
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 | |
load_mutations(csv_path)
staticmethod
Load a mutation list from a CSV file.
The CSV must contain a mutation column with strings like G13L.
Optional columns:
chain— chain identifier (defaults to'A'if absent).- Any other columns (e.g.
score,source,notes) are preserved as metadata and carried through to the results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_path
|
str
|
Path to a CSV file. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with at least |
DataFrame
|
extra columns from the CSV. |
Source code in src/sicifus/mutate.py
mutate_batch(source, mutations_df, max_iterations=2000, n_runs=3, constrain_backbone=True, _repair_cache=None)
Run every mutation in a DataFrame and return results.
Each row is treated as an independent single-point mutation. Any extra columns in the input DataFrame are preserved in the output.
The wild-type structure is prepared once and reused for every mutation, giving deterministic WT energies and eliminating hydrogen-placement noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame. |
required | |
mutations_df
|
DataFrame
|
DataFrame with |
required |
max_iterations
|
int
|
Minimisation steps per mutation (default 2000). |
2000
|
n_runs
|
int
|
Independent minimisation runs per mutation (default 3). |
3
|
constrain_backbone
|
bool
|
Restrain backbone during minimisation. |
True
|
_repair_cache
|
Optional[_RepairCache]
|
Optional pre-processed WT from :meth: |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with the input columns plus |
DataFrame
|
|
Source code in src/sicifus/mutate.py
1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 | |
calculate_binding_energy(source, chains_a, chains_b, max_iterations=2000)
Calculate binding energy between two groups of chains.
Calculates binding energy for protein-protein complexes.
E_binding = E_complex - (E_chains_a + E_chains_b)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame. |
required | |
chains_a
|
List[str]
|
Chain IDs for the first group (e.g. ['A']). |
required |
chains_b
|
List[str]
|
Chain IDs for the second group (e.g. ['B']). |
required |
max_iterations
|
int
|
Minimisation steps. |
2000
|
Returns:
| Type | Description |
|---|---|
BindingResult
|
BindingResult with binding energy, component energies, |
BindingResult
|
and interface residues. |
Source code in src/sicifus/mutate.py
alanine_scan(source, chain, positions=None, max_iterations=2000, constrain_backbone=True)
Perform alanine scanning on a chain.
Performs systematic alanine scanning mutagenesis. Each non-Ala/Gly position is mutated to alanine and the ddG is reported.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame. |
required | |
chain
|
str
|
Chain ID to scan (e.g. 'A'). |
required |
positions
|
Optional[List[int]]
|
Specific residue numbers to scan. If None, scans all non-Ala/Gly standard residues. |
None
|
max_iterations
|
int
|
Minimisation steps per mutant. |
2000
|
constrain_backbone
|
bool
|
Freeze backbone atoms during minimisation. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with columns: |
DataFrame
|
[chain, position, wt_residue, ddg_kcal_mol]. |
Source code in src/sicifus/mutate.py
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 | |
position_scan(source, chain, positions, max_iterations=2000, constrain_backbone=True)
Scan all 20 amino acids at specified positions.
Generates position-specific scoring matrix by scanning all amino acids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame. |
required | |
chain
|
str
|
Chain ID. |
required |
positions
|
List[int]
|
List of residue numbers to scan. |
required |
max_iterations
|
int
|
Minimisation steps per mutant. |
2000
|
constrain_backbone
|
bool
|
Freeze backbone atoms during minimisation. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with columns: |
DataFrame
|
[chain, position, wt_residue, mut_residue, ddg_kcal_mol]. |
Source code in src/sicifus/mutate.py
1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 | |
per_residue_energy(source, max_iterations=2000)
Approximate per-residue energy contribution.
Computes per-residue energy decomposition.
Uses an alanine-subtraction approach: for each residue, the energy difference between the full structure and the Ala-mutant estimates that residue's energetic contribution (positive = stabilising, negative = destabilising).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PDB file path, PDB string, or Polars DataFrame. |
required | |
max_iterations
|
int
|
Minimisation steps. |
2000
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with columns: |
DataFrame
|
[chain, residue_number, residue_name, energy_contribution_kcal_mol]. |
Source code in src/sicifus/mutate.py
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | |
Mutation
sicifus.Mutation
dataclass
Describes a single point mutation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
int
|
Residue number in the structure. |
required |
wt_residue
|
str
|
Wild-type residue (1-letter or 3-letter code). |
required |
mut_residue
|
str
|
Mutant residue (1-letter or 3-letter code). |
required |
chain
|
str
|
Chain identifier (default |
'A'
|
Source code in src/sicifus/mutate.py
label
property
Short label like G13L.
from_str(notation, chain='A')
classmethod
Parse a mutation string like 'G13L' (Gly at position 13 to Leu).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notation
|
str
|
String in the format |
required |
chain
|
str
|
Chain identifier (default |
'A'
|
Source code in src/sicifus/mutate.py
Analysis Toolkit
sicifus.analysis.AnalysisToolkit
Tools for analyzing structural dataframes.
Source code in src/sicifus/analysis.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 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 344 345 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 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 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 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | |
compute_rmsd_matrix(structures, n_jobs=-1, pruning_threshold=None, prefilter=True)
Computes all-vs-all RMSD matrix for a dictionary of structures. Returns (matrix, labels).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structures
|
Dict[str, DataFrame]
|
Dictionary of structure_id -> DataFrame |
required |
n_jobs
|
int
|
Number of parallel jobs (-1 for all CPUs) |
-1
|
pruning_threshold
|
Optional[float]
|
If set (0.0-1.0), skip alignment if sequence length ratio < threshold. Skipped pairs get a high RMSD value (e.g., 99.9). |
None
|
prefilter
|
bool
|
If True (default), use 3Di k-mer prefiltering to skip dissimilar pairs. Much faster for large N. |
True
|
Source code in src/sicifus/analysis.py
cluster_fast(structures, distance_threshold=2.0, coverage_threshold=0.8)
Greedy centroid-based structural clustering (linclust-inspired).
Uses the 3Di k-mer index to quickly identify candidate centroids for each structure, then only computes RMSD to those candidates. No full N×N distance matrix is needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structures
|
Dict[str, DataFrame]
|
Dictionary of structure_id -> DataFrame. |
required |
distance_threshold
|
float
|
Maximum RMSD to assign a structure to an existing cluster centroid (Ã…). |
2.0
|
coverage_threshold
|
float
|
Minimum length-ratio between a structure and a centroid (0-1) for them to be compared. |
0.8
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with columns |
DataFrame
|
|
Source code in src/sicifus/analysis.py
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 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
build_tree(rmsd_matrix, labels, method='average')
Builds a hierarchical clustering tree from RMSD matrix using Scipy. Returns the linkage matrix.
Source code in src/sicifus/analysis.py
build_phylo_tree(rmsd_matrix, labels, root_id=None)
Builds a phylogenetic tree from RMSD matrix. Uses Scipy's fast C-based linkage, then converts to Biopython Tree for Newick export. Tree is unrooted by default. If root_id is provided, roots at that structure.
Source code in src/sicifus/analysis.py
cluster_from_tree(tree, distance_threshold)
Derives clusters directly from the phylogenetic tree by cutting branches whose length (RMSD) exceeds the threshold. Each resulting subtree's leaves form a cluster.
This uses the actual tree topology and RMSD branch lengths — the clusters are defined by the tree itself, not by an external algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree
|
Biopython Tree object with RMSD branch lengths. |
required | |
distance_threshold
|
float
|
Cut any branch longer than this RMSD value. e.g. 1.0 means groups separated by > 1 Ã… RMSD are different clusters. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with columns: structure_id, cluster |
Source code in src/sicifus/analysis.py
plot_tree(tree_obj, labels=None, output_file=None)
Plots the tree. Handles both Scipy linkage matrix and Biopython Tree.
Source code in src/sicifus/analysis.py
plot_circular_tree(Z, labels, cluster_df=None, output_file=None, show_labels=None, figsize=(14, 14), linewidth=0.4)
Plots an unrooted circular/radial dendrogram from a linkage matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Z
|
ndarray
|
Scipy linkage matrix. |
required |
labels
|
List[str]
|
Structure IDs (leaf labels). |
required |
cluster_df
|
Optional[DataFrame]
|
Optional cluster assignments (from cluster_structures) to color branches. |
None
|
output_file
|
Optional[str]
|
If provided, saves to file instead of showing. |
None
|
show_labels
|
Optional[bool]
|
Whether to show leaf labels. Defaults to True if <=100 leaves, else False. |
None
|
figsize
|
Tuple[int, int]
|
Figure size. |
(14, 14)
|
linewidth
|
float
|
Line width for branches. |
0.4
|
Source code in src/sicifus/analysis.py
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 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 | |
build_similarity_network(rmsd_matrix, labels, threshold)
Builds a network where edges exist if RMSD < threshold.
Source code in src/sicifus/analysis.py
Ligand Analyzer
sicifus.analysis.LigandAnalyzer
Tools for analyzing ligand binding sites, pi-stacking interactions, and atom-level protein-ligand contacts.
Source code in src/sicifus/analysis.py
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 | |
find_binding_residues(backbone_df, ligand_df, ligand_name, distance_cutoff=5.0)
Identifies residues within a cutoff distance of a specific ligand. Uses CA atoms from backbone for fast residue-level proximity.
Source code in src/sicifus/analysis.py
plot_binding_histogram(residues_list, title='Ligand Binding Residue Distribution', output_file=None)
Plots a histogram of binding residue types.
Source code in src/sicifus/analysis.py
detect_pi_stacking(all_atom_df, ligand_df, ligand_name)
Detects pi-stacking interactions between protein aromatic residues and aromatic rings in the specified ligand.
Returns a DataFrame with columns
protein_chain, protein_residue, protein_resname, ligand_ring_atoms, interaction_type, distance, angle
Source code in src/sicifus/analysis.py
plot_pi_stacking(interactions_list, title='Pi-Stacking Interactions', output_file=None)
Plots a grouped bar chart of pi-stacking interaction types broken down by interaction type and protein residue type.
Source code in src/sicifus/analysis.py
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | |
find_ligand_atom_contacts(all_atom_df, ligand_df, ligand_name, distance_cutoff=3.3)
Identifies atom-level contacts between protein atoms and individual ligand atoms. Default cutoff of 3.3 Ã… targets hydrogen-bond-like interactions (user can adjust).
Returns a DataFrame with columns
ligand_atom, ligand_element, protein_chain, protein_residue, protein_resname, protein_atom, protein_element, distance
Source code in src/sicifus/analysis.py
plot_ligand_contacts(contacts_df, title='Ligand Atom Contacts', output_file=None)
Plots a bar chart showing which ligand atoms form the most contacts, colored by the protein residue type they interact with.
Uses canonical atom labels (e.g. C1, O2) if available, otherwise falls back to PDB atom names.
Source code in src/sicifus/analysis.py
1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | |
build_ligand_mol(ligand_atoms, charge=None, infer_bond_orders=True)
Builds an RDKit molecule from ligand atom 3D coordinates.
Uses canonical SMILES ordering to assign consistent atom labels that are independent of the input file's atom naming convention. This ensures the same atom always gets the same label regardless of which structure predictor generated the file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ligand_atoms
|
DataFrame
|
DataFrame with x, y, z, element, atom_name columns. |
required |
charge
|
Optional[int]
|
Total formal charge of the ligand. Helps RDKit infer correct bond orders / protonation state. For example, citrate at pH 7 is typically -3. If None, RDKit guesses. |
None
|
infer_bond_orders
|
bool
|
If True, attempt to determine double/aromatic bonds from 3D geometry. If False, only connectivity (single bonds) is determined — safer when the protonation state is unknown. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
|
(mol, pdb_atom_names, canonical_labels, canonical_smiles) |
||
|
or (None, None, None, None) if RDKit is not installed. |
||
canonical_labels |
list of str like ["C1", "C2", "O1", "O2", ...] numbered per-element in canonical SMILES traversal order. |
Source code in src/sicifus/analysis.py
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | |
plot_ligand_2d(ligand_atoms, contacts_df=None, title='Ligand 2D Structure', output_file=None, size=(700, 500), charge=None, infer_bond_orders=True, prebuilt_mol=None, prebuilt_canonical_labels=None)
Generates a 2D depiction of the ligand using RDKit. Atoms are labelled with canonical SMILES-derived names (e.g. C1, O2, N1) so they match the contacts bar chart and are consistent across different structure predictors.
If contacts_df is provided, atoms are color-coded by the number of protein contacts (red = many, blue = few, gray = none).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ligand_atoms
|
DataFrame
|
DataFrame of ligand atoms (from one structure). |
required |
contacts_df
|
Optional[DataFrame]
|
Optional contacts DataFrame to color-code atoms. Must contain a "canonical_atom" column. |
None
|
title
|
str
|
Plot title. |
'Ligand 2D Structure'
|
output_file
|
Optional[str]
|
Save image to file. If None, displays inline. |
None
|
size
|
Tuple[int, int]
|
Image dimensions (width, height) in pixels. |
(700, 500)
|
charge
|
Optional[int]
|
Total formal charge of the ligand (e.g. -3 for citrate). |
None
|
infer_bond_orders
|
bool
|
If True, attempt to determine double/aromatic bonds. If False, show only connectivity (all single bonds). |
True
|
prebuilt_mol
|
Optional pre-built RDKit Mol from build_ligand_mol(). Avoids a redundant rebuild and guarantees the same canonical labels used by the bar chart. |
None
|
|
prebuilt_canonical_labels
|
Optional[List[str]]
|
Optional canonical labels matching prebuilt_mol atom order. Must be provided together with prebuilt_mol for consistency. |
None
|
Returns:
| Type | Description |
|---|---|
|
PNG data as bytes (or None if RDKit unavailable). |
Source code in src/sicifus/analysis.py
1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 | |
get_pocket_residues(all_atom_df, ligand_df, ligand_name, distance_cutoff=8.0)
Identifies all unique residues within the specified distance cutoff of any atom in the ligand. Uses all-atom coordinates for accuracy.
Returns a list of residue names (e.g. ["ALA", "HIS", ...]) found in the pocket.
Source code in src/sicifus/analysis.py
plot_binding_pocket_composition(residue_counts, title='Binding Pocket Composition', output_file=None)
Plots a histogram of residue types found in the binding pocket. Ensures all 20 standard amino acids are represented on the X-axis.
Source code in src/sicifus/analysis.py
CIF Loader
sicifus.io.CIFLoader
Handles ingestion of CIF files into Polars DataFrames.
Source code in src/sicifus/io.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 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 344 345 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 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | |
ingest_folder(input_folder, output_folder, batch_size=100, file_extension='cif', protonate=False)
Ingests all structure files in a folder and saves them as a partitioned Parquet dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_folder
|
str
|
Path to the folder containing structure files. |
required |
output_folder
|
str
|
Path to the folder where Parquet files will be saved. |
required |
batch_size
|
int
|
Number of structures to process before writing a partition. |
100
|
file_extension
|
str
|
Extension of files to ingest (e.g., "cif" or "pdb"). |
'cif'
|
protonate
|
bool
|
If True, uses PDBFixer (OpenMM) to add hydrogens to the structure before parsing. This is slower but ensures consistent protonation for energy calculations. |
False
|