File size: 49,886 Bytes
7d2290f | 1 2 3 4 5 6 7 8 9 10 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 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 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 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 | #ifndef FREESASA_H
#define FREESASA_H
/**
@file
@author Simon Mitternacht
@copyright [MIT License](md_license.html)
@brief Functions and datatypes for performing and analyzing SASA
calculations.
This header provides the functions and data types necessary to
perform and analyze a SASA calculation using FreeSASA. They are
all listed on this page, but also divided into @ref core, @ref
structure, @ref classifier, @ref node and @ref selection
modules. The page @ref API shows how to set up and perform a
simple SASA calculation.
@defgroup core Core
The core functions to perform a calculation
@defgroup node Node
Represent results as a tree.
Results are represented hierarchically as a tree with the
following levels (see also ::freesasa_node_type)
- Root: wrapper, to allow joining results of several calculations.
- Result: wrapper for an individual result, contains information
about calculation parameters, the classifier used and the input.
- Structure: an individual molecule, the highest level where
actual SASA values are stored.
- Chain: an individual chain.
- Residue: typically an amino acid or nucleic acid.
- Atom: lowest level.
The tree can be traversed using freesasa_node_children(),
freesasa_node_next() and freesasa_node_parent(). The type of a
node is determined by freesasa_node_type(). There are some
properties that are common to all or most levels of the
tree. These accessors simply have the prefix `freesasa_node`, like
for example freesasa_node_name() and the above-mentioned
functions. Other properties are specific to a special level, and
then the prefix of the accessor functions will be
`freesasa_node_atom` or `freesasa_node_structure`, etc. The class
of an atom can for example be accessed using
freesasa_node_atom_is_polar().
The nodes of a tree are to be considered read-only, and changes
are made only to the root node, initialized using
freesasa_tree_new() or freesasa_tree_init(), and modified using
freesasa_tree_add_result(), freesasa_tree_join(). The one
exception where a lower level node can be modified is
freesasa_node_structure_add_selection().
@defgroup structure Structure
@brief Representation of macromolecular structures.
Interface for macromolecule structures, either instantiated
directly from a PDB file (freesasa_structure_from_pdb()) or atom
by atom (freesasa_structure_add_atom()).
@defgroup classifier Classifier
Interface for classifying atoms as polar/apolar and determining
their radius based on atom name and residue name.
@defgroup selection Selection
Interface for selecting a group of atoms and integrating their area.
@defgroup deprecated Deprecated
Legacy functions and datatypes from FreeSASA 1.x. Kept because
they still work although they have been replaced by other
functions. Can disappear at any time in the future.
*/
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @brief The FreeSASA algorithms. @ingroup core */
enum freesasa_algorithm {
FREESASA_LEE_RICHARDS, /**< Lee & Richards' algorithm. */
FREESASA_SHRAKE_RUPLEY /**< Shrake & Rupley's algorithm. */
};
#ifndef __cplusplus
typedef enum freesasa_algorithm freesasa_algorithm;
#endif
/**
@brief Verbosity levels.
@see freesasa_set_verbosity()
@see freesasa_get_verbosity()
*/
enum freesasa_verbosity {
FREESASA_V_NORMAL, /**< Print all errors and warnings. */
FREESASA_V_NOWARNINGS, /**< Print only errors. */
FREESASA_V_SILENT, /**< Print no errors and warnings. */
FREESASA_V_DEBUG, /**< Print all errors, warnings and debug messages. */
};
#ifndef __cplusplus
typedef enum freesasa_verbosity freesasa_verbosity;
#endif
/* Default parameters */
#define FREESASA_DEF_ALGORITHM FREESASA_LEE_RICHARDS /**< Default algorithm @ingroup core. */
#define FREESASA_DEF_PROBE_RADIUS 1.4 /**< Default probe radius (in Ångström) @ingroup core. */
#define FREESASA_DEF_SR_N 100 /**< Default number of test points in S&R @ingroup core. */
#define FREESASA_DEF_LR_N 20 /**< Default number of slices per atom in L&R @ingroup core. */
/**
@brief Default ::freesasa_classifier
@ingroup core
*/
#define freesasa_default_classifier freesasa_protor_classifier
/**
String returned by freesasa_structure_classifier_name() when
structure was initialized using several different
classifiers.
@ingroup structure
*/
#define FREESASA_CONFLICTING_CLASSIFIERS "conflicting-classifiers"
/**
@brief Default number of threads.
Value will depend on if library was compiled with or without thread support.
(2 with threads, 1 without).
@ingroup core
*/
const extern int FREESASA_DEF_NUMBER_THREADS;
/**
@brief Error codes.
Can rely upon FREESASA_SUCCESS being 0 and the errors
having negative numbers.
*/
enum freesasa_error_codes {
FREESASA_SUCCESS = 0, /**< All is ok (value will always be zero). */
FREESASA_FAIL = -1, /**< Something went seriously wrong (value will always be negative). */
FREESASA_WARN = -2, /**< Something went wrong, but results might still be meaningful (value will always be negative). */
};
/**
@brief Atom classes
Atoms can be of the classes Apolar, Polar or Unknown.
@ingroup classifier
*/
enum freesasa_atom_class {
FREESASA_ATOM_APOLAR = 0,
FREESASA_ATOM_POLAR = 1,
FREESASA_ATOM_UNKNOWN = 2,
};
#ifndef __cplusplus
typedef enum freesasa_atom_class freesasa_atom_class;
#endif
/**
@brief Options for reading structure from PDB
To be combined in options bitfield in freesasa_structure_from_pdb(),
freesasa_structure_array() and freesasa_structure_add_atom_wopt().
See documentation for each function for which options are applicable.
@ingroup structure
*/
enum freesasa_structure_options {
FREESASA_INCLUDE_HETATM = 1, /**< Include HETATM entries. */
FREESASA_INCLUDE_HYDROGEN = 1 << 2, /**< Include hydrogen atoms. */
FREESASA_SEPARATE_MODELS = 1 << 3, /**< Read MODELs as separate structures. */
FREESASA_SEPARATE_CHAINS = 1 << 4, /**< Read separate chains as separate structures. */
FREESASA_JOIN_MODELS = 1 << 5, /**< Read MODELs as part of one big structure. */
FREESASA_HALT_AT_UNKNOWN = 1 << 6, /**< Halt reading when unknown atom is encountered. */
FREESASA_SKIP_UNKNOWN = 1 << 7, /**< Skip atom when unknown atom is encountered. */
FREESASA_RADIUS_FROM_OCCUPANCY = 1 << 8, /**< Read atom radius from occupancy field. */
};
/**
@brief Output options
Controls output format, can be combined in options bitfield in freesasa_tree_export()
@ingroup node
*/
enum freesasa_output_options {
FREESASA_OUTPUT_ATOM = 1, /**< Output data for atoms, residues, chains and structure. */
FREESASA_OUTPUT_RESIDUE = 1 << 2, /**< Output data for residues, chains and structure. */
FREESASA_OUTPUT_CHAIN = 1 << 3, /**< Output data for chains and structure. */
FREESASA_OUTPUT_STRUCTURE = 1 << 4, /**< Output data only for the whole structure. */
FREESASA_LOG = 1 << 5, /**< Simple plain text results. */
FREESASA_RSA = 1 << 6, /**< RSA output (not affected by atom, residue, etc above). */
FREESASA_JSON = 1 << 7, /**< JSON output. */
FREESASA_XML = 1 << 8, /**< XML output. */
FREESASA_PDB = 1 << 9, /**< PDB output (with B-factors replaced by SASA values, and occupancy by radius). */
FREESASA_RES = 1 << 10, /**< A list of the integrated SASA of each residue type. */
FREESASA_SEQ = 1 << 11, /**< The SASA of each residue in the sequence. */
FREESASA_CIF = 1 << 12, /**< CIF output with SASA values and SASA radius appended */
/**
Don't output relative areas, for example if structure has
manually set radii, invalidating reference values
*/
FREESASA_OUTPUT_SKIP_REL = 1 << 13,
};
/**
The maximum length of a selection name
@see freesasa_select_area()
@ingroup selection
*/
#define FREESASA_MAX_SELECTION_NAME 50
/**
Struct to store parameters for SASA calculation
@ingroup core
*/
struct freesasa_parameters {
freesasa_algorithm alg; /**< Algorithm. */
double probe_radius; /**< Probe radius (in Ångström). */
int shrake_rupley_n_points; /**< Number of test points in S&R calculation. */
int lee_richards_n_slices; /**< Number of slices per atom in L&R calculation. */
int n_threads; /**< Number of threads to use, if compiled with thread-support. */
};
#ifndef __cplusplus
typedef struct freesasa_parameters freesasa_parameters;
#endif
/**
The default parameters for FreeSASA.
@ingroup core
*/
extern const freesasa_parameters freesasa_default_parameters;
/**
@brief Struct for structure object.
The struct includes the coordinates and radius of each atom, and
its name, residue-name, etc. If it was initiated from a PDB file
enough info will be stored so that a PDB-file can be printed using
the original one as template.
@ingroup structure
*/
typedef struct freesasa_structure freesasa_structure;
/**
Struct to store results of SASA calculation
@ingroup core
*/
struct freesasa_result {
double total; /**< Total SASA in Ångström^2. */
double *sasa; /**< SASA of each atom in Ångström^2. */
int n_atoms; /**< Number of atoms. */
freesasa_parameters parameters; /**< Parameters used when generating result. */
};
#ifndef __cplusplus
typedef struct freesasa_result freesasa_result;
#endif
/**
Struct to store integrated SASA values for either a full structure
or a subset thereof.
Use freesasa_result_classes() to turn a
::freesasa_result into a ::freesasa_nodearea. Each
::freesasa_node is associated with a
::freesasa_nodearea.
@ingroup node
*/
struct freesasa_nodearea {
const char *name; /**< Name of substructure. */
double total; /**< Total SASA. */
double main_chain; /**< Main-chain/Backbone SASA. */
double side_chain; /**< Side-chain SASA. */
double polar; /**< Polar SASA. */
double apolar; /**< Apolar SASA. */
double unknown; /**< SASA of unknown class (neither polar nor apolar). */
};
#ifndef __cplusplus
typedef struct freesasa_nodearea freesasa_nodearea;
#endif
/**
@brief Node types
@ingroup node
*/
enum freesasa_nodetype {
FREESASA_NODE_ATOM, /**< Atom node. */
FREESASA_NODE_RESIDUE, /**< Residue node. */
FREESASA_NODE_CHAIN, /**< Chain node. */
FREESASA_NODE_STRUCTURE, /**< Structure node. */
FREESASA_NODE_RESULT, /**< Result node, wraps results for one or more related structures. */
FREESASA_NODE_ROOT, /**< Root node, wraps one or more unrelated results. */
FREESASA_NODE_NONE /**< for specifying not a valid node. */
};
#ifndef __cplusplus
typedef enum freesasa_nodetype freesasa_nodetype;
#endif
/**
Struct to store data about a mmCIF atom site.
@ingroup structure
*/
struct freesasa_cif_atom {
const char *group_PDB;
const char auth_asym_id;
const char *auth_seq_id;
const char *pdbx_PDB_ins_code;
const char *auth_comp_id;
const char *auth_atom_id;
const char *label_alt_id;
const char *type_symbol;
const double Cartn_x;
const double Cartn_y;
const double Cartn_z;
};
#ifndef __cplusplus
typedef struct freesasa_cif_atom freesasa_cif_atom;
#endif
/**
@brief Result node
A node representing calculation results for a structure, chain,
residue or atom in a structure (see @ref node).
@ingroup node
*/
typedef struct freesasa_node freesasa_node;
/**
@brief Selection struct
Struct to store a selection generated by freesasa_selection_new().
@ingroup selection
*/
typedef struct freesasa_selection freesasa_selection;
/**
@brief Classifier struct
Struct that can be used to determine classes (polar/apolar) and
radii of atoms. Initiated from freesasa_classifier_from_file().
The classifiers ::freesasa_default_classifier, ::freesasa_protor_classifier,
::freesasa_naccess_classifier and ::freesasa_classifier are const
classifiers that can be used directly.
@ingroup classifier
*/
typedef struct freesasa_classifier freesasa_classifier;
/**
@brief ProtOr classifier.
Classifier using ProtOr radii and classes.
@ingroup classifier
*/
extern const freesasa_classifier freesasa_protor_classifier;
/**
@brief NACCESS classifier.
Classifier using NACCESS radii and classes.
@ingroup classifier
*/
extern const freesasa_classifier freesasa_naccess_classifier;
/**
@brief OONS classifier.
Classifier using OONS radii and classes.
@ingroup classifier
*/
extern const freesasa_classifier freesasa_oons_classifier;
/**
Calculates SASA based on a given structure.
This function allows direct access to the results array,
for most users freesasa_calc_tree() is more appropriate.
Return value is dynamically allocated, should be freed with
freesasa_result_free().
@param structure The structure
@param parameters Parameters for the calculation, if `NULL`
defaults are used.
@return The result of the calculation, `NULL` if something went wrong.
@ingroup core
*/
freesasa_result *
freesasa_calc_structure(const freesasa_structure *structure,
const freesasa_parameters *parameters);
/**
Calculates SASA based on a given set of coordinates and radii.
Return value is dynamically allocated, should be freed with
freesasa_result_free().
@param xyz Array of coordinates in the form x1,y1,z1,x2,y2,z2,...,xn,yn,zn.
@param radii Radii, this array should have n elements..
@param n Number of coordinates (i.e. xyz has size 3*n, radii size n).
@param parameters Parameters for the calculation, if `NULL`
defaults are used.
@return The result of the calculation, `NULL` if something went wrong.
@ingroup core
*/
freesasa_result *
freesasa_calc_coord(const double *xyz,
const double *radii,
int n,
const freesasa_parameters *parameters);
/**
Calculates SASA for a structure and returns as a tree of
::freesasa_node.
Return value is dynamically allocated, should be freed with
freesasa_node_free()
@param structure A structure
@param parameters Parameters for the calculation, if `NULL`,
defaults are used.
@param name Name of input structure to be used in output.
@return The result of the calculation, `NULL` if something went wrong.
@ingroup core
*/
freesasa_node *
freesasa_calc_tree(const freesasa_structure *structure,
const freesasa_parameters *parameters,
const char *name);
/**
Results by classes.
Adds up the SASA of Polar/Apolar/Unknown atoms, and
main-chain/side-chain atoms for the whole protein. Uses the
classes defined by the classifier used when generating the
structure.
@param structure The structure the results are based on
@param result The results
@return A struct with all the results.
@ingroup core
*/
freesasa_nodearea
freesasa_result_classes(const freesasa_structure *structure,
const freesasa_result *result);
/**
Frees a ::freesasa_result object.
@param result the object to be freed.
@ingroup core
*/
void freesasa_result_free(freesasa_result *result);
/**
Generate a classifier from a config-file.
Input file format described in @ref Config-file
Return value is dynamically allocated, should be freed with
freesasa_classifier_free().
@param file File containing configuration
@return The generated classifier. `NULL` if there were problems
parsing or reading the file or memory allocation problem.
@see @ref Config-file
@ingroup classifier
*/
freesasa_classifier *
freesasa_classifier_from_file(FILE *file);
/**
Frees a classifier object
@param classifier The classifier.
@ingroup classifier
*/
void freesasa_classifier_free(freesasa_classifier *classifier);
/**
Use a classifier to determine the radius of a given atom.
@param classifier The classifier.
@param res_name The residue name (ALA/VAL/U/C/...)
@param atom_name The atom name (CA/N/CB/...)
@return The radius, negative if atom unknown.
@ingroup classifier
*/
double
freesasa_classifier_radius(const freesasa_classifier *classifier,
const char *res_name,
const char *atom_name);
/**
Use a classifier to determine the class of a given atom.
@param classifier The classifier.
@param res_name The residue name (ALA/VAL/U/C/...)
@param atom_name The atom name (CA/N/CB/...)
@return The class.
@ingroup classifier
*/
freesasa_atom_class
freesasa_classifier_class(const freesasa_classifier *classifier,
const char *res_name,
const char *atom_name);
/**
Names for ::freesasa_atom_class.
@param atom_class The class.
@return Name of class.
@ingroup classifier
*/
const char *
freesasa_classifier_class2str(freesasa_atom_class atom_class);
/**
The name of a classifier.
@param classifier The classifier.
@return The name of the classifier.
@ingroup classifier
*/
const char *
freesasa_classifier_name(const freesasa_classifier *classifier);
/**
Get area of a selection.
Uses subset of the select syntax from Pymol (name, symbol, resn,
resi and chain), the keyword "select" is implicit. All commands
are case insensitive. Valid selections would be, for example,
selection_name, resn ala+arg
selection_name, chain a and resi 1+3-20 and not resn gly
After selecting the atoms from the ::freesasa_structure pointer
specified by the command the area of those atoms is summed up
using the ::freesasa_result pointer.
The return value should be freed with freesasa_selection_free().
@see @ref Selection
@param command The selection
@param structure The structure to select from
@param result The results to integrate
@return The selection. `NULL` if something went wrong. Use
freesasa_selection_name(), freesasa_selection_command(),
freesasa_selection_area() and freesasa_selection_n_atoms() to
access results of selection.
@ingroup selection
*/
freesasa_selection *
freesasa_selection_new(const char *command,
const freesasa_structure *structure,
const freesasa_result *result);
/**
Free selection.
@param selection The selection
@ingroup selection
*/
void freesasa_selection_free(freesasa_selection *selection);
/**
Name of the selection
@param selection The selection
@return the name
@ingroup selection
*/
const char *
freesasa_selection_name(const freesasa_selection *selection);
/**
Command that was used to generate the selection
@param selection The selection
@return The command
@ingroup selection
*/
const char *
freesasa_selection_command(const freesasa_selection *selection);
/**
Area of the selection
@param selection The selection
@return The area
@ingroup selection
*/
double
freesasa_selection_area(const freesasa_selection *selection);
/**
Number of atoms that matched the selection
@param selection The selection
@return Number of atoms
@ingroup selection
*/
int freesasa_selection_n_atoms(const freesasa_selection *selection);
/**
Set the global verbosity level.
@param v the verbosity level
@return ::FREESASA_SUCCESS. If v is invalid ::FREESASA_FAIL.
@see freesasa_verbosity
@ingroup core
*/
int freesasa_set_verbosity(freesasa_verbosity v);
/**
Get the current verbosity level
@return the verbosity level.
@ingroup core
*/
freesasa_verbosity
freesasa_get_verbosity(void);
/**
Set where to write errors.
By default `stderr` is used, this function can be called to redirect
error output elsewhere.
@param err The file to write to. If `NULL`, `stderr` will be used.
@ingroup core
*/
void freesasa_set_err_out(FILE *err);
/**
Get pointer to error file.
`NULL` means `stderr` is used.
@return The error file.
@ingroup core
*/
FILE *
freesasa_get_err_out(void);
/**
Allocate empty structure.
Return value is dynamically allocated, should be freed with
freesasa_structure_free().
@return Empty structure. `NULL` if memory allocation failure.
@ingroup structure
*/
freesasa_structure *
freesasa_structure_new(void);
/**
Free structure.
@param structure The structure to free.
@ingroup structure
*/
void freesasa_structure_free(freesasa_structure *structure);
/**
Init structure with coordinates from pdb-file.
Reads in a PDB-file and generates a structure object.
Automatically skips hydrogens and HETATM. If an atom has
alternative coordinates, only the first alternative is used. If a
file has more than one MODEL (as in NMR structures) only the
first model is used. The provided classifier is used to determine
the radius of each atom, if the atom is not recognized the element
of the atom is guessed, and that element's VdW radius used. If
this fails its radius is set 0, which means that it won't
contribute to SASA, but a radius from another source can be set
through freesasa_structure_set_radius(). All these behaviors can
be modified through the `options` bitfield argument:
- 0: Default behavior
- ::FREESASA_INCLUDE_HYDROGEN: Include hydrogen atoms.
- ::FREESASA_INCLUDE_HETATM: Include HETATM.
- ::FREESASA_JOIN_MODELS: Join models.
- ::FREESASA_SKIP_UNKNOWN: Skip unknown atoms.
- ::FREESASA_HALT_AT_UNKNOWN: Halt at unknown atom and return
`NULL`. Overrides ::FREESASA_SKIP_UNKNOWN.
- ::FREESASA_RADIUS_FROM_OCCUPANCY: Read atomic radii from
Occupancy field in PDB file.
If a more fine-grained control over which atoms to include is
needed, the PDB-file needs to be modified before calling this
function, or atoms can be added manually one by one using
freesasa_structure_add_atom() or
freesasa_structure_add_atom_wopt().
Return value is dynamically allocated, should be freed with
freesasa_structure_free().
@param pdb A PDB file
@param classifier A freesasa_classifier to determine radius of
atom. If `NULL` default classifier is used.
@param options A bitfield to determine what atoms to include and what to do
when atoms are not recognized by classifier.
@return The generated structure. Returns `NULL` and prints error
if input is invalid or memory allocation failure.
@ingroup structure
*/
freesasa_structure *
freesasa_structure_from_pdb(FILE *pdb,
const freesasa_classifier *classifier,
int options);
/**
Init array of structures from PDB.
Either iniatilize one structure per model in multimodel PDB, or
one per chain, or both. Otherwise equivalent to
freesasa_structure_from_pdb().
Returns dynamically allocated array of size n. Its members should
be freed using freesasa_structure_free() and the array itself with
free().
@param pdb Input PDB-file.
@param n Number of structures found are written to this integer.
@param classifier A classifier to calculate atomic radii.
@param options Bitfield. Either or both of
::FREESASA_SEPARATE_MODELS and ::FREESASA_SEPARATE_CHAINS can be
used to generate one structure per model and one structure per
chain, respectively (will return `NULL` if neither is
specified). See freesasa_structure_from_pdb() for documentation
on options for deciding what atoms to include
(::FREESASA_JOIN_MODELS is not supported here).
@return Array of structures. Prints error message(s) and returns
`NULL` if there were problems reading input, if invalid value of
`options`, or upon a memory allocation failure.
@ingroup structure
*/
freesasa_structure **
freesasa_structure_array(FILE *pdb,
int *n,
const freesasa_classifier *classifier,
int options);
/**
Add individual atom to structure using default behavior.
Equivalent to calling freesasa_structure_add_atom_wopt(), with
`classifier = NULL` and `options = 0`.
@param structure The structure to add to.
@param atom_name String of 4 characters, of the format `" CA "`, `" OXT"`, etc.
@param residue_name String of 3 charachters, of the format `"ALA"`, `"PHE"`, etc.
@param residue_number String of 4 characters, of the format `" 1"`, `" 123"`, etc.
@param chain_label Any character to label chain, typically `'A'`, `'B'`, etc.
@param x x-coordinate of atom.
@param y y-coordinate of atom.
@param z z-coordinate of atom.
@return ::FREESASA_SUCCESS on normal execution. ::FREESASA_FAIL if
if memory allocation fails.
@ingroup structure
*/
int freesasa_structure_add_atom(freesasa_structure *structure,
const char *atom_name,
const char *residue_name,
const char *residue_number,
char chain_label,
double x, double y, double z);
/**
Add individual atom to structure.
A structure can be built by adding atoms one by one. Storing
residue numbers as strings allows for non-numeric labels. Will
include hydrogens if added (i.e. up to caller to make sure these
are excluded if necessesary).
The atom name, residue name, etc are checked by the classifier,
and depending on the value of `options` different things will
happen when unknown atoms are encountered. In all cases the user
will be alerted of what has happened through warnings or error
messages:
- `options == 0` means guess element of unknown atoms, and use
that element's VdW radius. If this fails, assign radius 0. A 0
radius means this atom won't contribute to the SASA, but will
still be there if we want to use
freesasa_structure_set_radius() to assign a radius from
another source.
- `options & ::FREESASA_SKIP_UNKNOWN == 1` skip unknown atoms,
return ::FREESASA_WARN.
- `options & ::FREESASA_HALT_AT_UNKNOWN == 1` skip unknown atoms,
return ::FREESASA_FAIL. Overrides ::FREESASA_SKIP_UNKNOWN.
@see Because the argument list is so long, freesasa_structure_add_atom()
is a shortcut to call this with defaults.
@param structure The structure to add to.
@param atom_name The atom name: `" CA "`,`"CA"`, `" OXT"`, etc.
@param residue_name The residue name: `"ALA"`, `"PHE"`, etc.
@param residue_number String of 4 characters, of the format `" 1"`, `" 123"`, etc.
@param chain_label Any character to label chain, typically `'A'`, `'B'`, etc.
@param x x-coordinate of atom.
@param y y-coordinate of atom.
@param z z-coordinate of atom.
@param classifier A ::freesasa_classifier to determine radius of atom and to
decide if to keep atom or not (see options).
@param options A bitfield to determine what to do with unknown atoms (see above).
@return ::FREESASA_SUCCESS on normal execution. ::FREESASA_FAIL if
if memory allocation fails or if halting at unknown
atom. ::FREESASA_WARN if skipping atom.
@ingroup structure
*/
int freesasa_structure_add_atom_wopt(freesasa_structure *structure,
const char *atom_name,
const char *residue_name,
const char *residue_number,
char chain_label,
double x, double y, double z,
const freesasa_classifier *classifier,
int options);
/**
Add atoms from a mmCIF file to a structure
@param structure The structure to add to.
@param atom An atom site from a mmCIF file
@param classifier A ::freesasa_classifier to determine radius of atom and to
decide if to keep atom or not (see options).
@param options Structure options as in freesasa_structure_add_atom_wopt()
@return ::FREESASA_SUCCESS on normal execution. ::FREESASA_FAIL if
if memory allocation fails or if halting at unknown
atom. ::FREESASA_WARN if skipping atom.
@ingroup structure
*/
int freesasa_structure_add_cif_atom(freesasa_structure *structure,
freesasa_cif_atom *atom,
const freesasa_classifier *classifier,
int options);
/**
Create new structure consisting of a selection chains from the
provided structure.
Simply looks for chain labels that match the characters in the
provided string.
Return value is dynamically allocated, should be freed with
freesasa_structure_free().
@param structure Input structure.
@param chains String of chain labels (e.g. `"AB"`)
@param classifier A classifier to use to build the new structure
@param options Structure options as in freesasa_structure_add_atom_wopt()
@return A new structure consisting only of the specified
chains. Returns `NULL` if one or more of the requested chains don't
match any in the input structure or if memory allocation fails.
@ingroup structure
*/
freesasa_structure *
freesasa_structure_get_chains(const freesasa_structure *structure,
const char *chains,
const freesasa_classifier *classifier,
int options);
/**
Get string listing all chains in structure.
@param structure The structure.
@return String with all chain labels in structure (`"A"`, `"ABC"`, etc).
@ingroup structure
*/
const char *
freesasa_structure_chain_labels(const freesasa_structure *structure);
/**
Get number of atoms.
@param structure The structure.
@return Number of atoms.
@ingroup structure
*/
int freesasa_structure_n(const freesasa_structure *structure);
/**
Get number of residues.
Calculated crudely by determining the number of unique
combinations of residue number and chain label contained in the
structure. If residues are mingled i.e. atoms of the same residue
are in non-contiguous regions of the file, this function might be
off.
@param structure A structure.
@return Number of residues.
@ingroup structure
*/
int freesasa_structure_n_residues(const freesasa_structure *structure);
/**
Get number of chains.
@param structure A structure.
@return The number of chains in the structure.
@ingroup structure
*/
int freesasa_structure_n_chains(const freesasa_structure *structure);
/**
Returns a pointer to an array of the radii of each atom.
@param structure The structure.
@return Array of radii. If `NULL` structure has not been properly
initialized.
@ingroup structure
*/
const double *
freesasa_structure_radius(const freesasa_structure *structure);
/**
Override the radii set when the structure was initialized.
Makes a copy of the provided array.
@param structure The structure.
@param radii An array of radii, should have same dimension
as the number of atoms in the structure.
@ingroup structure
*/
void freesasa_structure_set_radius(freesasa_structure *structure,
const double *radii);
/**
Get atom name.
Asserts that index i is within bounds.
@param structure The structure.
@param i Atom index.
@return Atom name in the form `" CA "`, `" OXT"`, etc, if
structure was initialized from a PDB file, or in whatever form
it was added through freesasa_structure_add_atom() or
freesasa_structure_add_atom_wopt().
@ingroup structure
*/
const char *
freesasa_structure_atom_name(const freesasa_structure *structure,
int i);
/**
Get residue name.
Asserts that index i is within bounds.
@param structure The structure.
@param i Atom index.
@return Residue name in the form `"ALA"`, `"PHE"`, `" C"`, etc, if
structure was initialized from a PDB file, or in whatever form
it was added through freesasa_structure_add_atom() or
freesasa_structure_add_atom_wopt().
@ingroup structure
*/
const char *
freesasa_structure_atom_res_name(const freesasa_structure *structure,
int i);
/**
Get residue number.
Asserts that index i is within bounds.
@param structure The structure.
@param i Atom index.
@return Residue name in the form `" 1"`, `" 123"`, etc, if
structure was initialized from a PDB file, or in whatever form
it was added through freesasa_structure_add_atom() or
freesasa_structure_add_atom_wopt().
@ingroup structure
*/
const char *
freesasa_structure_atom_res_number(const freesasa_structure *structure,
int i);
/**
Get chain label.
Asserts that index i is within bounds.
@param structure The structure.
@param i Atom index.
@return Chain label (`'A'`, `'B'`, etc.)
@ingroup structure
*/
char freesasa_structure_atom_chain(const freesasa_structure *structure,
int i);
/**
Get atom symbol.
If the structure was initialized from a PDB file the symbol field
of that file is used. Otherwise the symbol is guessed from atom and
residue name.
Asserts that index i is within bounds.
@param structure The structure.
@param i Atom index.
@return Atom symbol (`" C"`, `" N"`, `"SE"`,etc);
@ingroup structure
*/
const char *
freesasa_structure_atom_symbol(const freesasa_structure *structure,
int i);
/**
Get atom radius.
Asserts that index i is within bounds.
@param structure The structure.
@param i Atom index.
@return Atom radius.
@ingroup structure
*/
double
freesasa_structure_atom_radius(const freesasa_structure *structure,
int i);
/**
Set atom radius.
Asserts that index i is within bounds.
@param structure The structure.
@param radius The radius.
@param i Atom index.
@ingroup structure
*/
void freesasa_structure_atom_set_radius(freesasa_structure *structure,
int i,
double radius);
/**
Get name of residue.
@param structure The structure.
@param r_i Residue index (in whole structure)
@return Name of residue
@ingroup structure
*/
const char *
freesasa_structure_residue_name(const freesasa_structure *structure,
int r_i);
/**
Get residue number.
@param structure The structure.
@param r_i Residue index (in whole structure).
@return Residue number as string.
@ingroup structure
*/
const char *
freesasa_structure_residue_number(const freesasa_structure *structure,
int r_i);
/**
Get chain residue belongs to.
@param structure The structure.
@param r_i Residue index (in whole structure).
@return Chain label.
@ingroup structure
*/
char freesasa_structure_residue_chain(const freesasa_structure *structure,
int r_i);
/**
Get model number for structure.
Useful if structure was generated with freesasa_structure_array().
@param structure The structure.
@return The model number. Will be 1 if MODEL not specified in PDB
input.
@ingroup structure
*/
int freesasa_structure_model(const freesasa_structure *structure);
/**
Get array of coordinates.
Size of array is 3*N, order of coordinates `x1, y1, z1, ...`.
@param structure The structure.
@return Array of coordinates. `NULL` if structure empty. Size can be
accessed through freesasa_structure_n() (multiply by three).
@ingroup structure
*/
const double *
freesasa_structure_coord_array(const freesasa_structure *structure);
/**
Get indices of first and last atoms of a residue
@param structure A structure.
@param r_i Residue index.
@param first First atom of residue `r_i` will be stored here.
@param last Last atom of residue `r_i` will be stored here.
@return ::FREESASA_SUCCESS. ::FREESASA_FAIL if index `r_i` is invalid.
@ingroup structure
*/
int freesasa_structure_residue_atoms(const freesasa_structure *structure,
int r_i,
int *first,
int *last);
/**
Get indices of first and last atoms of a chain
@param structure A structure.
@param chain The chain label.
@param first First atom of `chain` will be stored here.
@param last Last atom of `chain` will be stored here.
@return ::FREESASA_SUCCESS. ::FREESASA_FAIL if `chain` not found.
@ingroup structure
*/
int freesasa_structure_chain_atoms(const freesasa_structure *structure,
char chain,
int *first,
int *last);
/**
Get indices of first and last residues of a chain
@param structure A structure.
@param chain The chain label.
@param first First residue of `chain` will be stored here.
@param last Last residue of `chain` will be stored here.
@return ::FREESASA_SUCCESS. ::FREESASA_FAIL if `chain` not found.
@ingroup structure
*/
int freesasa_structure_chain_residues(const freesasa_structure *structure,
char chain,
int *first,
int *last);
/**
Name of classifier used to generate structure.
@param structure A structure.
@return Name of classifier. Name will equal
::FREESASA_CONFLICTING_CLASSIFIERS if several different
classifiers were used.
@ingroup structure
*/
const char *
freesasa_structure_classifier_name(const freesasa_structure *structure);
/**
Generates empty ::freesasa_node of type ::FREESASA_NODE_ROOT.
To be populated by freesasa_tree_add_result().
The return value is dynamically allocated and should be freed
using freesasa_node_free().
@return A ::freesasa_node. `NULL` if memory allocation fails.
@ingroup node
*/
freesasa_node *
freesasa_tree_new(void);
/**
Init tree based on result and structure.
The return value is dynamically allocated and should be freed
using freesasa_node_free().
@param result A result.
@param structure A structure.
@param name Name of the results (typically filename from
which structure is derived)
@return The root node of the tree. `NULL` if memory allocation
fails.
@ingroup node
*/
freesasa_node *
freesasa_tree_init(const freesasa_result *result,
const freesasa_structure *structure,
const char *name);
/**
Add a new set of results to a tree.
Tree should first be initiated with freesasa_calc_tree(),
freesasa_tree_new() or freesasa_tree_init().
@param tree Node of type ::FREESASA_NODE_ROOT. Tree to add results
to.
@param result SASA values for the structure
@param structure The structure the results are based on
@param name The name to use for the result
@return ::FREESASA_SUCCESS upon success. ::FREESASA_FAIL if memory
allocation fails.
@ingroup node
*/
int freesasa_tree_add_result(freesasa_node *tree,
const freesasa_result *result,
const freesasa_structure *structure,
const char *name);
/**
Join two trees.
Allows joining several calculations into one output file.
@param tree1 Node of type ::FREESASA_NODE_ROOT. The joint tree
will be stored here.
@param tree2 Node of type ::FREESASA_NODE_ROOT. Will be added to
tree1, and then changed to `NULL`, since ownership of its contents
have been transferred to tree1.
@return ::FREESASA_SUCCESS.
@ingroup node
*/
int freesasa_tree_join(freesasa_node *tree1,
freesasa_node **tree2);
/**
Outputs result in format specified by options.
@param output Output file.
@param root Structure tree containing results. Node of type ::FREESASA_NODE_ROOT.
@param options Bitfield specifying output format, see
::freesasa_output_options.
@return ::FREESASA_SUCCESS upon success. ::FREESASA_FAIL if there
was an error (see messages).
@ingroup node
*/
int freesasa_tree_export(FILE *output,
freesasa_node *root,
int options);
/**
Free tree.
Will not free anything if the node is not a root node.
@param root Node of type ::FREESASA_NODE_ROOT
@return ::FREESASA_SUCCESS. ::FREESASA_FAIL if the node has a
parent.
@ingroup node
*/
int freesasa_node_free(freesasa_node *root);
/**
The ::freesasa_nodearea of all atoms belonging to a node.
@param node The node.
@return The area. `NULL` if no area has been attached to this node.
@ingroup node
*/
const freesasa_nodearea *
freesasa_node_area(const freesasa_node *node);
/**
The children of a node.
Use freesasa_node_next() to access next sibling.
@param node The node.
@return Pointer to the first child of a node. `NULL` if the node has no
children.
@ingroup node
*/
freesasa_node *
freesasa_node_children(freesasa_node *node);
/**
Next sibling of a node.
@param node The node.
@return The next node, `NULL` if this is the last node.
@ingroup node
*/
freesasa_node *
freesasa_node_next(freesasa_node *node);
/**
The parent of a node.
@param node The node.
@return The parent node. `NULL` if the node has no parent.
@ingroup node
*/
freesasa_node *
freesasa_node_parent(freesasa_node *node);
/**
The type of a node.
@param node The node.
@return The type.
@ingroup node
*/
freesasa_nodetype
freesasa_node_type(const freesasa_node *node);
/**
The name of a node.
The node types will have the following names:
- Atom: atom name, i.e. `" CA "`, `" OXT"`, etc.
- Residue: residue name, i.e. `"ALA"`, `"ARG"`, etc.
- Chain: chain label, i.e. `"A"`, `"B"`, etc.
- Structure: string of all chain labels in the molecule, i.e. `"A"`, `"ABC"`, etc
- Result: name of input (most often input filename or `"stdin"`)
- Root: `NULL`
@param node The node.
@return The name. `NULL` if the node has no name.
@ingroup node
*/
const char *
freesasa_node_name(const freesasa_node *node);
/**
The name of the classifier used to generate the node.
@param node A node of type ::FREESASA_NODE_RESULT.
@return The name of the classifier
@ingroup node
*/
const char *
freesasa_node_classified_by(const freesasa_node *node);
/**
Is atom polar.
@param node A node of type ::FREESASA_NODE_ATOM.
@return 1 if polar, 0 else.
@ingroup node
*/
int freesasa_node_atom_is_polar(const freesasa_node *node);
/**
Does atom belong to the main chain/backbone.
@param node A node of type ::FREESASA_NODE_ATOM.
@return 1 if mainchain, 0 else.
@ingroup node
*/
int freesasa_node_atom_is_mainchain(const freesasa_node *node);
/**
Atom radius.
@param node A node of type ::FREESASA_NODE_ATOM.
@return The radius.
@ingroup node
*/
double
freesasa_node_atom_radius(const freesasa_node *node);
/**
Line in PDB atom was generated from.
@param node A node of type ::FREESASA_NODE_ATOM.
@return The line. `NULL` if atom wasn't taken from PDB file.
@ingroup node
*/
const char *
freesasa_node_atom_pdb_line(const freesasa_node *node);
/**
Atom residue number.
@param node A node of type ::FREESASA_NODE_ATOM.
@return The residue sequence number that this atom is a part of.
@ingroup node
*/
const char *
freesasa_node_atom_residue_number(const freesasa_node *node);
/**
Atom residue name.
@param node A node of type ::FREESASA_NODE_ATOM.
@return The residue 3-char name this atom is a part of.
@ingroup node
*/
const char *
freesasa_node_atom_residue_name(const freesasa_node *node);
/**
Atom chain.
@param node A node of type ::FREESASA_NODE_ATOM.
@return The chain this atom is a part of.
@ingroup node
*/
char freesasa_node_atom_chain(const freesasa_node *node);
/**
Residue number.
@param node A node of type ::FREESASA_NODE_RESIDUE.
@return String with residue number.
@ingroup node
*/
const char *
freesasa_node_residue_number(const freesasa_node *node);
/**
Number of atoms in a residue.
@param node A node of type ::FREESASA_NODE_RESIDUE.
@return Number of atoms.
@ingroup node
*/
int freesasa_node_residue_n_atoms(const freesasa_node *node);
/**
The reference area for a node from the classifier used to
generate the tree.
@param node A node of type ::FREESASA_NODE_RESIDUE.
@return The reference area. `NULL` if area not available.
@ingroup node
*/
const freesasa_nodearea *
freesasa_node_residue_reference(const freesasa_node *node);
/**
The number of residues in a chain.
@param node A node of type ::FREESASA_NODE_CHAIN.
@return Number of residues.
@ingroup node
*/
int freesasa_node_chain_n_residues(const freesasa_node *node);
/**
The number of chains in a structure.
@param node A node of type ::FREESASA_NODE_STRUCTURE.
@return Number of chains.
@ingroup node
*/
int freesasa_node_structure_n_chains(const freesasa_node *node);
/**
The number of atoms in a structure.
@param node A node of type ::FREESASA_NODE_STRUCTURE.
@return Number of atoms.
@ingroup node
*/
int freesasa_node_structure_n_atoms(const freesasa_node *node);
/**
All chain labels in a structure.
@param node A node of type ::FREESASA_NODE_STRUCTURE.
@return Chain labels as null-terminated string.
@ingroup node
*/
const char *
freesasa_node_structure_chain_labels(const freesasa_node *node);
/**
Model number of a structure (from input PDB)
@param node A node of type ::FREESASA_NODE_STRUCTURE.
@return Model number.
@ingroup node
*/
int freesasa_node_structure_model(const freesasa_node *node);
/**
Raw results for a structure
@param node A node of type ::FREESASA_NODE_STRUCTURE.
@return The results.
@ingroup node
*/
const freesasa_result *
freesasa_node_structure_result(const freesasa_node *node);
/**
Selection results for a structure
Generated using freesasa_node_structure_add_selection().
@param node A node of type ::FREESASA_NODE_STRUCTURE.
@return A null-terminated array of pointers to selections. `NULL` if
no selections were associated with structure.
@ingroup node
*/
const freesasa_selection **
freesasa_node_structure_selections(const freesasa_node *node);
/**
Add a selection result to a structure node
The selection is cloned, so the user can call
freesasa_selection_free() on the provided selection at the time of
their chosing.
@param node A node of type ::FREESASA_NODE_STRUCTURE.
@param selection A selection.
@return ::FREESASA_SUCCESS. ::FREESASA_FAIL if cloning fails
(i.e. memory allocation failure).
@ingroup node
*/
int freesasa_node_structure_add_selection(freesasa_node *node,
const freesasa_selection *selection);
/**
Parameter values used to calculate result.
@param node A node of type ::FREESASA_NODE_RESULT
@return The parameters.
@ingroup node
*/
const freesasa_parameters *
freesasa_node_result_parameters(const freesasa_node *node);
/* Deprecated functions below, from 1.x API */
/**
Get area of a selection.
@deprecated Use freesasa_selection_new() instead.
@param command The selection
@param name The name of the selection is stored here, it should be
able to store a string of length ::FREESASA_MAX_SELECTION_NAME.
@param area The area of the selection is stored here
@param structure The structure to select from
@param result The results to integrate
@return ::FREESASA_SUCCESS upon successful selection.
::FREESASA_WARN if some illegal selections that could be
ignored were encountered (see printed
warnings). ::FREESASA_FAIL if syntax error or memory failure.
@ingroup deprecated
*/
int freesasa_select_area(const char *command,
char *name,
double *area,
const freesasa_structure *structure,
const freesasa_result *result);
void freesasa_structure_set_model(freesasa_structure *structure,
int model);
#ifdef __cplusplus
}
#endif
#endif /* FREESASA_H */
|