metrics
parse_rosetta_scorefile
parse_rosetta_scorefile(file: AnyStr, key: str = 'decoy') -> dict[str, dict[str, str]]
Take a json formatted metrics file and incorporate entries into nested dictionaries with "key" as outer key
Automatically formats scores according to conventional metric naming scheme, ex: "R_", "S_", or "M_" prefix removal
Parameters:
-
file
(AnyStr
) –Location on disk of scorefile
-
key
(str
, default:'decoy'
) –Name of the json key to use as outer dictionary identifier
Returns: The parsed scorefile Ex {'design_identifier1': {'metric_key': metric_value, ...}, 'design_identifier2': {}, ...}
Source code in symdesign/metrics/__init__.py
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 |
|
keys_from_trajectory_number
keys_from_trajectory_number(pdb_dict)
Remove all string from dictionary keys except for string after last '_'. Ex 'design_0001' -> '0001'
Returns:
-
dict
–{cleaned_key: value, ...}
Source code in symdesign/metrics/__init__.py
376 377 378 379 380 381 382 |
|
join_columns
join_columns(row)
Combine columns in a dataframe with the same column name. Keep only the last column record
Returns:
-
str
–The column name
Source code in symdesign/metrics/__init__.py
385 386 387 388 389 390 391 392 |
|
columns_to_new_column
columns_to_new_column(df: DataFrame, columns: dict[str, tuple[str, ...]], mode: str = 'add')
Set new column value by taking an operation of one column on another
Can perform summation and subtraction if a set of columns is provided Args: df: Dataframe where the columns are located columns: Keys are new column names, values are tuple of existing columns where df[key] = value[0] mode(operation) value[1] mode(operation) ... mode: What operator to use? Viable options are included in the operator module {'sub', 'mul', 'truediv', ...} Returns: Dataframe with new column values
Source code in symdesign/metrics/__init__.py
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 |
|
hbond_processing
hbond_processing(design_scores: dict, columns: list[str]) -> dict[str, set]
Process Hydrogen bond Metrics from Rosetta score dictionary
if rosetta_numbering="true" in .xml then use offset, otherwise, hbonds are PDB numbering Args: design_scores: {'001': {'buns': 2.0, 'per_res_energy_complex_15A': -2.71, ..., 'yhh_planarity':0.885, 'hbonds_res_selection_complex': '15A,21A,26A,35A,...', 'hbonds_res_selection_1_bound': '26A'}, ...} columns : ['hbonds_res_selection_complex', 'hbonds_res_selection_1_unbound', 'hbonds_res_selection_2_unbound'] Returns: {'0001': {34, 54, 67, 68, 106, 178}, ...}
Source code in symdesign/metrics/__init__.py
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 |
|
hot_spot
hot_spot(residue_dict: dict[Any, dict], energy: float = -1.5)
Calculate if each residue in a dictionary is a hot-spot
Parameters:
-
residue_dict
(dict[Any, dict]
) – -
energy
(float
, default:-1.5
) –The threshold for hot spot consideration
Returns:
-
–
The modified residue_dict.
Source code in symdesign/metrics/__init__.py
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
|
interface_composition_similarity
interface_composition_similarity(series: Mapping) -> float
Calculate the composition difference for pose residue classification
Parameters:
-
series
(Mapping
) –Mapping from 'interface_area_total', 'core', 'rim', and 'support' to values
Returns: Average similarity for expected residue classification given the observed classification
Source code in symdesign/metrics/__init__.py
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 |
|
incorporate_sequence_info
incorporate_sequence_info(design_residue_scores: dict[str, dict], sequences: dict[str, Sequence[str]]) -> dict[str, dict]
Incorporate mutation measurements into residue info. design_residue_scores and mutations must be the same index
Parameters:
-
design_residue_scores
(dict[str, dict]
) –{'001': {15: {'complex': -2.71, 'bound': [-1.9, 0], 'unbound': [-1.9, 0], 'solv_complex': -2.71, 'solv_bound': [-1.9, 0], 'solv_unbound': [-1.9, 0], 'fsp': 0., 'cst': 0.}, ...}, ...}
-
sequences
(dict[str, Sequence[str]]
) –{'001': 'MKDLSAVLIRLAD...', '002': '', ...}
Returns: {'001': {15: {'type': 'T', 'energy_delta': -2.71, 'coordinate_constraint': 0. 'residue_favored': 0., 'hbond': 0} ...}, ...}
Source code in symdesign/metrics/__init__.py
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 |
|
process_residue_info
process_residue_info(design_residue_scores: dict, hbonds: dict = None) -> dict
Process energy metrics to Pose formatted dictionary from multiple measurements per residue and incorporate hydrogen bond information. design_residue_scores and hbonds must be the same index
Parameters:
-
design_residue_scores
(dict
) –{'001': {15: {'complex': -2.71, 'bound': [-1.9, 0], 'unbound': [-1.9, 0], 'solv_complex': -2.71, 'solv_bound': [-1.9, 0], 'solv_unbound': [-1.9, 0], 'fsp': 0., 'cst': 0.}, ...}, ...}
-
hbonds
(dict
, default:None
) –{'001': [34, 54, 67, 68, 106, 178], ...}
Returns: {'001': {15: {'type': 'T', 'energy_delta': -2.71, 'coordinate_constraint': 0. 'residue_favored': 0., 'hbond': 0} ...}, ...}
Source code in symdesign/metrics/__init__.py
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 |
|
collapse_per_residue
collapse_per_residue(sequence_groups: Iterable[Iterable[Sequence[str]]], residue_contact_order_z: ndarray, reference_collapse: ndarray, **kwargs) -> list[dict[str, float]]
Measure per-residue sequence folding metrics based on reference values including contact order z score and hydrophobic collapse
Parameters:
-
sequence_groups
(Iterable[Iterable[Sequence[str]]]
) –Groups of sequences, where the outer nest is each sample and the inner nest are unique polymers
-
residue_contact_order_z
(ndarray
) –The per-residue contact order z score from a reference structure
-
reference_collapse
(ndarray
) –The per-residue hydrophobic collapse values measured from a reference sequence
Other Parameters:
-
hydrophobicity
–str = 'standard' – The hydrophobicity scale to consider. Either 'standard' (FILV), 'expanded' (FMILYVW), or provide one with 'custom' keyword argument
-
custom
–mapping[str, float | int] = None – A user defined mapping of amino acid type, hydrophobicity value pairs
-
alphabet_type
–alphabet_types = None – The amino acid alphabet if the sequence consists of integer characters
-
lower_window
–int = 3 – The smallest window used to measure
-
upper_window
–int = 9 – The largest window used to measure
Returns:
-
list[dict[str, float]]
–The mapping of collapse metric to per-residue values for the concatenated sequence in each sequence_groups. These include: {'collapse_deviation_magnitude', 'collapse_increase_significance_by_contact_order_z', 'collapse_increased_z', 'collapse_new_positions', 'collapse_new_position_significance', 'collapse_sequential_peaks_z', 'collapse_sequential_z', 'collapse_significance_by_contact_order_z', 'hydrophobic_collapse' }
Source code in symdesign/metrics/__init__.py
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 |
|
mutation_conserved
mutation_conserved(residue_info: dict, bkgnd: dict) -> dict
Process residue mutations compared to evolutionary background. Returns 1 if residue is observed in background
Both residue_dict and background must be same index Args: residue_info: {15: {'type': 'T', ...}, ...} bkgnd: {0: {'A': 0, 'R': 0, ...}, ...} Returns: conservation_dict: {15: 1, 21: 0, 25: 1, ...}
Source code in symdesign/metrics/__init__.py
806 807 808 809 810 811 812 813 814 815 816 |
|
per_res_metric
per_res_metric(sequence_metrics: dict[Any, float] | dict[Any, dict[str, float]], key: str = None) -> float
Find metric value average over all residues in a per residue dictionary with metric specified by key
Parameters:
-
sequence_metrics
(dict[Any, float] | dict[Any, dict[str, float]]
) –{16: {'S': 0.134, 'A': 0.050, ..., 'jsd': 0.732, 'int_jsd': 0.412}, ...}
-
key
(str
, default:None
) –Name of the metric to average
Returns: The average metric 0.367
Source code in symdesign/metrics/__init__.py
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 |
|
calculate_residue_buried_surface_area
calculate_residue_buried_surface_area(per_residue_df: DataFrame) -> DataFrame
From a DataFrame with per-residue values, calculate values relating to interface surface area
Parameters:
-
per_residue_df
(DataFrame
) –The DataFrame with MultiIndex columns where level1=residue_numbers, level0=residue_metric and containing the metrics [ 'sasa_hydrophobic_bound', 'sasa_polar_bound', 'sasa_hydrophobic_complex', 'sasa_polar_complex' ]
Returns: The same dataframe with added columns [ 'bsa_hydrophobic', 'bsa_polar', 'bsa_total', 'sasa_total_bound', 'sasa_total_complex' ]
Source code in symdesign/metrics/__init__.py
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 |
|
classify_interface_residues
classify_interface_residues(per_residue_df: DataFrame, relative_sasa_thresh: float = default_sasa_burial_threshold) -> DataFrame
From a DataFrame with per-residue values, calculate the classification of residues by interface surface area
Parameters:
-
per_residue_df
(DataFrame
) –The DataFrame with MultiIndex columns where level1=residue_numbers, level0=residue_metric containing the metrics ['bsa_total', 'sasa_relative_complex', 'sasa_relative_bound']
-
relative_sasa_thresh
(float
, default:default_sasa_burial_threshold
) –The area threshold that the Residue should fall below before it is considered 'core' Default cutoff percent is based on Levy, E. 2010
Returns: The same dataframe with added columns ['core', 'interior', 'rim', 'support', 'surface']
Source code in symdesign/metrics/__init__.py
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 |
|
sum_per_residue_metrics
sum_per_residue_metrics(df: DataFrame, rename_columns: Mapping[str, str] = None, mean_metrics: Sequence[str] = None) -> DataFrame
From a DataFrame with per-residue values (i.e. a metric in level -1), tabulate all values across each residue
Renames specific values relating to interfacial energy and solvation energy
Parameters:
-
df
(DataFrame
) –The DataFrame with MultiIndex columns where level -1 = metric
-
rename_columns
(Mapping[str, str]
, default:None
) –Columns to rename as a result of the summation
-
mean_metrics
(Sequence[str]
, default:None
) –Columns to take the mean instead of the sum
Returns: A new DataFrame with the summation of each metric from all residue_numbers in the per_residue columns
Source code in symdesign/metrics/__init__.py
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 |
|
calculate_sequence_observations_and_divergence
calculate_sequence_observations_and_divergence(alignment: MultipleSequenceAlignment, backgrounds: dict[str, ndarray]) -> tuple[dict[str, ndarray], dict[str, ndarray]]
Gather the observed frequencies from each sequence in a MultipleSequenceAlignment
Source code in symdesign/metrics/__init__.py
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 |
|
jensen_shannon_divergence
jensen_shannon_divergence(sequence_frequencies: ndarray, background_aa_freq: ndarray, **kwargs) -> ndarray
Calculate Jensen-Shannon Divergence value for all residues against a background frequency dict
Parameters:
-
sequence_frequencies
(ndarray
) –[[0.05, 0.001, 0.1, ...], ...]
-
background_aa_freq
(ndarray
) –[0.11, 0.03, 0.53, ...]
Other Parameters:
-
lambda_
–float = 0.5 - Bounded between 0 and 1 indicates weight of the observation versus the background
Returns:
-
ndarray
–The divergence per residue bounded between 0 and 1. 1 is more divergent from background, i.e. [0.732, ...]
Source code in symdesign/metrics/__init__.py
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
|
position_specific_jsd
position_specific_jsd(msa: ndarray, background: ndarray, **kwargs) -> ndarray
Generate the Jensen-Shannon Divergence for a dictionary of residues versus a specific background frequency
Both msa and background must be the same index
Parameters:
-
msa
(ndarray
) –{15: {'A': 0.05, 'C': 0.001, 'D': 0.1, ...}, 16: {}, ...}
-
background
(ndarray
) –{0: {'A': 0, 'R': 0, ...}, 1: {}, ...} Containing residue index with inner dictionary of single amino acid types
Other Parameters:
-
lambda_
–float = 0.5 - Bounded between 0 and 1 indicates weight of the observation versus the background
Returns:
-
ndarray
–The divergence values per position, i.e [0.732, 0.552, ...]
Source code in symdesign/metrics/__init__.py
1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 |
|
kl_divergence
kl_divergence(frequencies: ndarray, bgd_frequencies: ndarray, per_entry: bool = False, mask: array = None, axis: int | tuple[int, ...] = None) -> ndarray | float
Calculate Kullback–Leibler Divergence entropy between observed and background (true) frequency distribution(s)
The divergence will be summed across the last axis/dimension of the input array
Parameters:
-
frequencies
(ndarray
) –[0.05, 0.001, 0.1, ...] The model distribution
-
bgd_frequencies
(ndarray
) –[0, 0, ...] The true distribution
-
per_entry
(bool
, default:False
) –Whether the result should be returned after summation over the last axis
-
mask
(array
, default:None
) –A mask to restrict calculations to certain entries
-
axis
(int | tuple[int, ...]
, default:None
) –If the input should be summed over additional axis, which one(s)?
Returns: The additional entropy needed to represent the frequencies as the background frequencies. The minimum divergence is 0 when both distributions are identical
Source code in symdesign/metrics/__init__.py
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 |
|
cross_entropy
cross_entropy(frequencies: ndarray, bgd_frequencies: ndarray, per_entry: bool = False, mask: array = None, axis: int | tuple[int, ...] = None) -> ndarray | float
Calculate the cross entropy between observed and background (truth) frequency distribution(s)
The entropy will be summed across the last axis/dimension of the input array
Parameters:
-
frequencies
(ndarray
) –[0.05, 0.001, 0.1, ...] The model distribution
-
bgd_frequencies
(ndarray
) –[0, 0, ...] The true distribution
-
per_entry
(bool
, default:False
) –Whether the result should be returned after summation over the last axis
-
mask
(array
, default:None
) –A mask to restrict calculations to certain entries
-
axis
(int | tuple[int, ...]
, default:None
) –If the input should be summed over additional axis, which one(s)?
Returns: The total entropy to represent the frequencies as the background frequencies. The minimum entropy is 0 where both distributions are identical
Source code in symdesign/metrics/__init__.py
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 |
|
js_divergence
js_divergence(frequencies: ndarray, bgd_frequencies: ndarray, lambda_: float = 0.5) -> float
Calculate Jensen-Shannon Divergence value from observed and background (true) frequencies
Parameters:
-
frequencies
(ndarray
) –[0.05, 0.001, 0.1, ...] The model distribution
-
bgd_frequencies
(ndarray
) –[0, 0, ...] The true distribution
-
lambda_
(float
, default:0.5
) –Bounded between 0 and 1 indicates weight of the observation versus the background
Returns: Bounded between 0 and 1. 1 is more divergent from background frequencies
Source code in symdesign/metrics/__init__.py
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 |
|
position_specific_divergence
position_specific_divergence(frequencies: ndarray, bgd_frequencies: ndarray, lambda_: float = 0.5) -> ndarray
Calculate Jensen-Shannon Divergence value from observed and background frequencies
Parameters:
-
frequencies
(ndarray
) –[0.05, 0.001, 0.1, ...]
-
bgd_frequencies
(ndarray
) –[0, 0, ...]
-
lambda_
(float
, default:0.5
) –Bounded between 0 and 1 indicates weight of the observation versus the background
Returns: An array of divergences bounded between 0 and 1. 1 indicates frequencies are more divergent from background
Source code in symdesign/metrics/__init__.py
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 |
|
df_permutation_test
df_permutation_test(grouped_df: DataFrame, diff_s: Series, group1_size: int = 0, compare: str = 'mean', permutations: int = 1000) -> Series
Run a permutation test on a dataframe with two categorical groups. Default uses mean to compare significance
Parameters:
-
grouped_df
(DataFrame
) –The features of interest in samples from two groups of interest. Doesn't need to be sorted
-
diff_s
(Series
) –The differences in each feature in the two groups after evaluating the 'compare' stat
-
group1_size
(int
, default:0
) –Size of the observations in group1
-
compare
(str
, default:'mean'
) –Choose from any pandas.DataFrame attribute that collapses along a column. Other options might be median
-
permutations
(int
, default:1000
) –The number of permutations to perform
Returns: Contains the p-value(s) of the permutation test using the 'compare' statistic against diff_s
Source code in symdesign/metrics/__init__.py
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 |
|
filter_df_for_index_by_value
filter_df_for_index_by_value(df: DataFrame, metrics: dict[str, list | dict | str | int | float]) -> dict[str, list[Any]]
Retrieve the indices from a DataFrame which have column values passing an indicated operation threshold
Parameters:
-
df
(DataFrame
) –DataFrame to filter indices on
-
metrics
(dict[str, list | dict | str | int | float]
) –{metric_name: [(operation (Callable), pre_operation (Callable), pre_kwargs (dict), value (Any)),], ...} {metric_name: 0.3, ...} OR {metric_name: {'direction': 'min', 'value': 0.3}, ...} to specify a sorting direction
Returns: {metric_name: ['0001', '0002', ...], ...}
Source code in symdesign/metrics/__init__.py
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 |
|
prioritize_design_indices
prioritize_design_indices(df: DataFrame | AnyStr, filters: dict | bool = None, weights: dict | bool = None, protocols: str | list[str] = None, default_weight: str = 'interface_energy', **kwargs) -> DataFrame
Return a filtered/sorted DataFrame (both optional) with indices that pass a set of filters and/or are ranked according to a feature importance. Both filter and weight instructions are provided or queried from the user
Caution: Expects that if DataFrame is provided by filename there is particular formatting, i.e. 3 column MultiIndices, 1 index indices. If the DF file varies from this, this function will likely cause errors
Parameters:
-
df
(DataFrame | AnyStr
) –DataFrame to filter/weight indices
-
filters
(dict | bool
, default:None
) –Whether to remove viable candidates by certain metric values or a mapping of value and filter threshold pairs
-
weights
(dict | bool
, default:None
) –Whether to rank the designs by metric values or a mapping of value and weight pairs where the total weight will be the sum of all individual weights
-
protocols
(str | list[str]
, default:None
) –Whether specific design protocol(s) should be chosen
-
default_weight
(str
, default:'interface_energy'
) –If there is no weight provided, what is the default metric to sort results
Other Parameters:
-
weight_function
–str = 'rank' - The function to use when weighting design indices
Returns:
-
DataFrame
–The sorted DataFrame based on the provided filters and weights. DataFrame contains simple Index columns
Source code in symdesign/metrics/__init__.py
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 |
|
describe_data
describe_data(df: DataFrame = None) -> None
Describe the DataFrame to STDOUT
Source code in symdesign/metrics/__init__.py
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 |
|
query_user_for_metrics
query_user_for_metrics(available_metrics: Iterable[str], df: DataFrame = None, mode: str = None, level: str = None) -> dict[str, float]
Ask the user for the desired metrics to select indices from a dataframe
Parameters:
-
available_metrics
(Iterable[str]
) –The columns available in the DataFrame to select indices by
-
df
(DataFrame
, default:None
) –A DataFrame from which to use metrics (provided as columns)
-
mode
(str
, default:None
) –The mode in which to query and format metrics information. Either 'filter' or weight'
-
level
(str
, default:None
) –The hierarchy of selection to use. Could be one of 'poses', 'designs', or 'sequences'
Returns: The mapping of metric name to value
Source code in symdesign/metrics/__init__.py
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 |
|
pareto_optimize_trajectories
pareto_optimize_trajectories(df: DataFrame, weights: dict[str, float] = None, function: weight_functions_literal = 'rank', default_weight: str = 'interface_energy', **kwargs) -> Series
From a provided DataFrame with individual design trajectories, select trajectories based on provided metric and weighting parameters
Parameters:
-
df
(DataFrame
) –The designs x metrics DataFrame (single index metrics column) to select trajectories from
-
weights
(dict[str, float]
, default:None
) –{'metric': value, ...}. If not provided, sorts by default_sort
-
function
(weight_functions_literal
, default:'rank'
) –The function to use for weighting. Either 'rank' or 'normalize' is possible
-
default_weight
(str
, default:'interface_energy'
) –The metric to weight the dataframe by default if no weights are provided
Returns: A sorted pandas.Series with the best indices first in the Series.index, and the resulting optimization values in the corresponding value.
Source code in symdesign/metrics/__init__.py
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 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 |
|
window_function
window_function(data: Sequence[int | float], windows: Iterable[int] = None, lower: int = None, upper: int = None) -> ndarray
Perform windowing operations on a sequence of data and return the result of the calculation. Window lengths can be specified by passing the windows to perform calculation on as an Iterable or by a range of window lengths
Parameters:
-
data
(Sequence[int | float]
) –The sequence of numeric data to perform calculations
-
windows
(Iterable[int]
, default:None
) –An iterable of window lengths to use. If a single, pass as the Iterable
-
lower
(int
, default:None
) –The lower range of the window to operate on. "window" is inclusive of this value
-
upper
(int
, default:None
) –The upper range of the window to operate on. "window" is inclusive of this value
Returns: The (number of windows, length of data) array of values with each requested window along axis=0 and the particular value of the windowed data along axis=1
Source code in symdesign/metrics/__init__.py
1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 |
|
hydrophobic_collapse_index
hydrophobic_collapse_index(seq: Sequence[str | int] | ndarray, hydrophobicity: hydrophobicity_scale_literal = 'standard', custom: dict[protein_letters_literal, int | float] = None, alphabet_type: alphabet_types_literal = None, lower_window: int = 3, upper_window: int = 9, **kwargs) -> ndarray
Calculate hydrophobic collapse index for sequence(s) of interest and return an HCI array
Parameters:
-
seq
(Sequence[str | int] | ndarray
) –The sequence to measure. Can be a character based sequence (or array of sequences with shape (sequences, residues)), an integer based sequence, or a sequence profile like array (residues, alphabet) where each character in the alphabet contains a typical distribution of amino acid observations
-
hydrophobicity
(hydrophobicity_scale_literal
, default:'standard'
) –The hydrophobicity scale to consider. Either 'standard' (FILV), 'expanded' (FMILVW), or provide one with the keyword argument, "custom"
-
custom
(dict[protein_letters_literal, int | float]
, default:None
) –A user defined mapping of amino acid type, hydrophobicity value pairs
-
alphabet_type
(alphabet_types_literal
, default:None
) –The amino acid alphabet if seq consists of integer characters
-
lower_window
(int
, default:3
) –The smallest window used to measure
-
upper_window
(int
, default:9
) –The largest window used to measure
Returns: 1D array with the hydrophobic collapse index at every position on the input sequence(s)
Source code in symdesign/metrics/__init__.py
1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 |
|
index_intersection
index_intersection(index_groups: Iterable[Iterable[Any]]) -> list[Any]
Perform AND logic on objects in multiple containers of objects, where all objects must be present to be included
Parameters:
-
index_groups
(Iterable[Iterable[Any]]
) –Groups of indices
Returns: The union of all provided indices
Source code in symdesign/metrics/__init__.py
1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 |
|
z_score
z_score(sample: float | ndarray, mean: float | ndarray, stdev: float | ndarray) -> float | ndarray
From sample(s), calculate the positional z-score, i.e. z-score = (sample - mean) / stdev
Parameters:
-
sample
(float | ndarray
) –An array with the sample at every position
-
mean
(float | ndarray
) –An array with the mean at every position
-
stdev
(float | ndarray
) –An array with the standard deviation at every position
Returns: The z-score of every sample
Source code in symdesign/metrics/__init__.py
1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 |
|