FreeSASA  2.0.1
Open source SASA calculations
View on GitHub
freesasa.h
Go to the documentation of this file.
1 #ifndef FREESASA_H
2 #define FREESASA_H
3 
82 #include <stdio.h>
83 
84 #ifdef __cplusplus
85 extern "C"{
86 #endif
87 
89 typedef enum {
93 
95 typedef enum {
101 
102 // Default parameters
103 #define FREESASA_DEF_ALGORITHM FREESASA_LEE_RICHARDS
104 #define FREESASA_DEF_PROBE_RADIUS 1.4
105 #define FREESASA_DEF_SR_N 100
106 #define FREESASA_DEF_LR_N 20
107 
108 #define freesasa_default_classifier freesasa_protor_classifier
110 
114 #define FREESASA_CONFLICTING_CLASSIFIERS "conflicting-classifiers"
115 
119 const extern int FREESASA_DEF_NUMBER_THREADS;
120 
127 };
128 
130 typedef enum {
131  FREESASA_ATOM_APOLAR=0,
132  FREESASA_ATOM_POLAR=1,
133  FREESASA_ATOM_UNKNOWN=2,
135 
153 };
154 
166  FREESASA_RES=1<<10,
167  FREESASA_SEQ=1<<11,
168 
172 };
173 
175 #define FREESASA_MAX_SELECTION_NAME 50
176 
178 typedef struct {
180  double probe_radius;
183  int n_threads;
185 
188 
200 
202 typedef struct {
203  double total;
204  double *sasa;
205  int n_atoms;
208 
220 typedef struct {
221  const char *name;
222  double total;
223  double main_chain;
224  double side_chain;
225  double polar;
226  double apolar;
227  double unknown;
229 
231 typedef enum {
240 
248 
255 
267 
270 
273 
276 
296  const freesasa_parameters *parameters);
297 
315 freesasa_calc_coord(const double *xyz,
316  const double *radii,
317  int n,
318  const freesasa_parameters *parameters);
319 
337 freesasa_calc_tree(const freesasa_structure *structure,
338  const freesasa_parameters *parameters,
339  const char *name);
340 
357  const freesasa_result *result);
358 
366 void
368 
387 
395 void
397 
408 double
410  const char *res_name,
411  const char *atom_name);
412 
425  const char *res_name,
426  const char *atom_name);
427 
436 const char*
438 
447 const char*
449 
479 freesasa_selection_new(const char *command,
480  const freesasa_structure *structure,
481  const freesasa_result *result);
482 
490 void
492 
501 const char *
503 
512 const char *
514 
523 double
525 
534 int
536 
546 int
548 
558 
569 void
570 freesasa_set_err_out(FILE *err);
571 
581 FILE *
583 
596 
604 void
606 
662  const freesasa_classifier *classifier,
663  int options);
664 
693 freesasa_structure_array(FILE *pdb,
694  int *n,
695  const freesasa_classifier *classifier,
696  int options);
697 
717 int
719  const char* atom_name,
720  const char* residue_name,
721  const char* residue_number,
722  char chain_label,
723  double x, double y, double z);
772 int
774  const char *atom_name,
775  const char *residue_name,
776  const char *residue_number,
777  char chain_label,
778  double x, double y, double z,
779  const freesasa_classifier *classifier,
780  int options);
781 
803  const char* chains);
804 
813 const char*
815 
824 int
825 freesasa_structure_n(const freesasa_structure *structure);
826 
841 int
843 
852 int
854 
864 const double*
866 
878 void
880  const double* radii);
881 
897 const char*
899  int i);
900 
915 const char*
917  int i);
918 
933 const char*
935  int i);
936 
948 char
950  int i);
951 
967 const char*
969  int i);
970 
982 double
984  int i);
996 void
998  int i,
999  double radius);
1000 
1010 const char*
1012  int r_i);
1013 
1023 const char*
1025  int r_i);
1035 char
1037  int r_i);
1038 
1050 int
1052 
1064 const double*
1066 
1078 int
1080  int r_i,
1081  int *first,
1082  int *last);
1083 
1095 int
1097  char chain,
1098  int *first,
1099  int *last);
1100 
1112 int
1114  char chain,
1115  int *first,
1116  int *last);
1117 
1128 const char *
1130 
1143 freesasa_node *
1144 freesasa_tree_new(void);
1145 
1162 freesasa_node *
1163 freesasa_tree_init(const freesasa_result *result,
1164  const freesasa_structure *structure,
1165  const char *name);
1166 
1183 int
1185  const freesasa_result *result,
1186  const freesasa_structure *structure,
1187  const char *name);
1188 
1203 int
1205  freesasa_node **tree2);
1206 
1219 int
1220 freesasa_tree_export(FILE *output,
1221  freesasa_node *root,
1222  int options);
1223 
1235 int
1237 
1246 const freesasa_nodearea *
1247 freesasa_node_area(const freesasa_node *node);
1248 
1260 freesasa_node *
1262 
1271 freesasa_node *
1273 
1282 freesasa_node *
1284 
1294 freesasa_node_type(const freesasa_node *node);
1295 
1312 const char *
1313 freesasa_node_name(const freesasa_node *node);
1314 
1323 const char*
1325 
1334 int
1336 
1345 int
1347 
1356 double
1358 
1367 const char*
1369 
1378 const char *
1380 
1389 int
1391 
1401 const freesasa_nodearea *
1403 
1412 int
1414 
1423 int
1425 
1434 int
1436 
1445 const char *
1447 
1456 int
1458 
1467 const freesasa_result *
1469 
1481 const freesasa_selection **
1483 
1498 int
1500  const freesasa_selection *selection);
1509 const freesasa_parameters *
1511 
1512 // Deprecated functions below, from 1.x API
1513 
1532 int
1533 freesasa_select_area(const char *command,
1534  char *name,
1535  double *area,
1536  const freesasa_structure *structure,
1537  const freesasa_result *result);
1538 
1539 #ifdef __cplusplus
1540 }
1541 #endif
1542 
1543 #endif /* FREESASA_H */
freesasa_verbosity freesasa_get_verbosity(void)
Get the current verbosity level.
const char * freesasa_structure_atom_name(const freesasa_structure *structure, int i)
Get atom name.
int freesasa_structure_n(const freesasa_structure *structure)
Get number of atoms.
void freesasa_selection_free(freesasa_selection *selection)
Free selection.
double polar
Polar SASA.
Definition: freesasa.h:225
RSA output (not affected by atom, residue, etc above)
Definition: freesasa.h:162
freesasa_algorithm alg
Algorithm.
Definition: freesasa.h:179
Read MODELs as part of one big structure.
Definition: freesasa.h:149
int freesasa_node_structure_n_atoms(const freesasa_node *node)
The number of atoms in a structure.
freesasa_algorithm
The FreeSASA algorithms.
Definition: freesasa.h:89
struct freesasa_selection freesasa_selection
Struct to store a selection generated by freesasa_selection_new().
Definition: freesasa.h:254
Output data only for the whole structure.
Definition: freesasa.h:160
Print all errors and warnings.
Definition: freesasa.h:96
Read MODELs as separate structures.
Definition: freesasa.h:147
const freesasa_classifier freesasa_protor_classifier
Classifier using ProtOr radii and classes.
double probe_radius
Probe radius (in Ångström)
Definition: freesasa.h:180
Root node, wraps one or more unrelated results.
Definition: freesasa.h:237
Include hydrogen atoms.
Definition: freesasa.h:146
const char * freesasa_structure_atom_res_name(const freesasa_structure *structure, int i)
Get residue name.
int freesasa_node_atom_is_mainchain(const freesasa_node *node)
Does atom belong to the main chain/backbone.
Print no errors and warnings.
Definition: freesasa.h:98
const char * freesasa_structure_classifier_name(const freesasa_structure *structure)
Name of classifier used to generate structure.
int freesasa_structure_model(const freesasa_structure *structure)
Get model number for structure.
const char * freesasa_node_residue_number(const freesasa_node *node)
Residue number.
freesasa_output_options
Controls output format, can be combined in options bitfield in freesasa_tree_export() ...
Definition: freesasa.h:156
Something went seriously wrong (value will always be negative).
Definition: freesasa.h:125
void freesasa_structure_set_radius(freesasa_structure *structure, const double *radii)
Override the radii set when the structure was initialized.
int freesasa_set_verbosity(freesasa_verbosity v)
Set the global verbosity level.
int freesasa_select_area(const char *command, char *name, double *area, const freesasa_structure *structure, const freesasa_result *result)
Get area of a selection.
int freesasa_node_chain_n_residues(const freesasa_node *node)
The number of residues in a chain.
Print all errors, warnings and debug messages.
Definition: freesasa.h:99
const char * freesasa_selection_name(const freesasa_selection *selection)
Name of the selection.
freesasa_selection * freesasa_selection_new(const char *command, const freesasa_structure *structure, const freesasa_result *result)
Get area of a selection.
freesasa_result * freesasa_calc_structure(const freesasa_structure *structure, const freesasa_parameters *parameters)
Calculates SASA based on a given structure.
int lee_richards_n_slices
Number of slices per atom in L&R calculation.
Definition: freesasa.h:182
const char * freesasa_node_classified_by(const freesasa_node *node)
The name of the classifier used to generate the node.
Simple plain text results.
Definition: freesasa.h:161
Output data for atoms, residues, chains and structure.
Definition: freesasa.h:157
freesasa_atom_class freesasa_classifier_class(const freesasa_classifier *classifier, const char *res_name, const char *atom_name)
Use a classifier to determine the class of a given atom.
freesasa_structure * freesasa_structure_from_pdb(FILE *pdb, const freesasa_classifier *classifier, int options)
Init structure with coordinates from pdb-file.
void freesasa_set_err_out(FILE *err)
Set where to write errors.
freesasa_structure * freesasa_structure_get_chains(const freesasa_structure *structure, const char *chains)
Create new structure consisting of a selection chains from the provided structure.
freesasa_verbosity
Verbosity levels.
Definition: freesasa.h:95
double freesasa_selection_area(const freesasa_selection *selection)
Area of the selection.
double total
Total SASA.
Definition: freesasa.h:222
int freesasa_structure_n_chains(const freesasa_structure *structure)
Get number of chains.
A list of the integrated SASA of each residue type.
Definition: freesasa.h:166
int freesasa_node_structure_model(const freesasa_node *node)
Model number of a structure (from input PDB)
Struct to store parameters for SASA calculation.
Definition: freesasa.h:178
const char * freesasa_node_atom_pdb_line(const freesasa_node *node)
Line in PDB atom was generated from.
void freesasa_classifier_free(freesasa_classifier *classifier)
Frees a classifier object.
const char * freesasa_structure_residue_number(const freesasa_structure *structure, int r_i)
Get residue number.
const freesasa_nodearea * freesasa_node_residue_reference(const freesasa_node *node)
The reference area for a node from the classifier used to generate the tree.
int n_atoms
Number of atoms.
Definition: freesasa.h:205
Structure node.
Definition: freesasa.h:235
freesasa_structure ** freesasa_structure_array(FILE *pdb, int *n, const freesasa_classifier *classifier, int options)
Init array of structures from PDB.
Lee & Richards' algorithm.
Definition: freesasa.h:90
double freesasa_classifier_radius(const freesasa_classifier *classifier, const char *res_name, const char *atom_name)
Use a classifier to determine the radius of a given atom.
void freesasa_result_free(freesasa_result *result)
Frees a freesasa_result object.
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 using default behavior.
freesasa_node * freesasa_calc_tree(const freesasa_structure *structure, const freesasa_parameters *parameters, const char *name)
Calculates SASA for a structure and returns as a tree of freesasa_node.
Halt reading when unknown atom is encountered.
Definition: freesasa.h:150
double unknown
SASA of unknown class (neither polar nor apolar)
Definition: freesasa.h:227
Shrake & Rupley's algorithm.
Definition: freesasa.h:91
int n_threads
Number of threads to use, if compiled with thread-support.
Definition: freesasa.h:183
Skip atom when unknown atom is encountered.
Definition: freesasa.h:151
const char * freesasa_structure_residue_name(const freesasa_structure *structure, int r_i)
Get name of residue.
freesasa_nodearea freesasa_result_classes(const freesasa_structure *structure, const freesasa_result *result)
Results by classes.
freesasa_nodetype
Node types.
Definition: freesasa.h:231
Chain node.
Definition: freesasa.h:234
Something went wrong, but results might still be meaningful (value will always be negative)...
Definition: freesasa.h:126
const double * freesasa_structure_radius(const freesasa_structure *structure)
Returns a pointer to an array of the radii of each atom.
int freesasa_node_residue_n_atoms(const freesasa_node *node)
Number of atoms in a residue.
int freesasa_tree_add_result(freesasa_node *tree, const freesasa_result *result, const freesasa_structure *structure, const char *name)
Add a new set of results to a tree.
XML output.
Definition: freesasa.h:164
const int FREESASA_DEF_NUMBER_THREADS
Default number of threads.
void freesasa_structure_free(freesasa_structure *structure)
Free structure.
char freesasa_structure_residue_chain(const freesasa_structure *structure, int r_i)
Get chain residue belongs to.
int freesasa_tree_export(FILE *output, freesasa_node *root, int options)
Outputs result in format specified by options.
struct freesasa_classifier freesasa_classifier
Struct that can be used to determine classes (polar/apolar) and radii of atoms.
Definition: freesasa.h:266
struct freesasa_node freesasa_node
A node representing calculation results for a structure, chain, residue or atom in a structure (see N...
Definition: freesasa.h:247
for specifying not a valid node
Definition: freesasa.h:238
freesasa_node * freesasa_node_children(freesasa_node *node)
The children of a node.
freesasa_node * freesasa_node_parent(freesasa_node *node)
The parent of a node.
PDB output (with B-factors replaced by SASA values, and occupancy by radius)
Definition: freesasa.h:165
Result node, wraps results for one or more related structures.
Definition: freesasa.h:236
int freesasa_structure_chain_residues(const freesasa_structure *structure, char chain, int *first, int *last)
Get indices of first and last residues of a chain.
const char * freesasa_structure_atom_symbol(const freesasa_structure *structure, int i)
Get atom symbol.
int shrake_rupley_n_points
Number of test points in S&R calculation.
Definition: freesasa.h:181
Print only errors.
Definition: freesasa.h:97
double apolar
Apolar SASA.
Definition: freesasa.h:226
The SASA of each residue in the sequence.
Definition: freesasa.h:167
freesasa_node * freesasa_tree_init(const freesasa_result *result, const freesasa_structure *structure, const char *name)
Init tree based on result and structure.
const freesasa_parameters * freesasa_node_result_parameters(const freesasa_node *node)
Parameter values used to calculate result.
freesasa_node * freesasa_node_next(freesasa_node *node)
Next sibling of a node.
int freesasa_tree_join(freesasa_node *tree1, freesasa_node **tree2)
Join two trees.
FILE * freesasa_get_err_out()
Get pointer to error file.
const char * freesasa_classifier_class2str(freesasa_atom_class atom_class)
Names for freesasa_atom_class.
Don't output relative areas, for example if structure has manually set radii, invalidating reference ...
Definition: freesasa.h:171
const freesasa_classifier freesasa_naccess_classifier
Classifier using NACCESS radii and classes.
const char * freesasa_selection_command(const freesasa_selection *selection)
Command that was used to generate the selection.
Struct to store integrated SASA values for either a full structure or a subset thereof.
Definition: freesasa.h:220
freesasa_atom_class
Atoms can be of the classes Apolar, Polar or Unknown.
Definition: freesasa.h:130
int freesasa_structure_chain_atoms(const freesasa_structure *structure, char chain, int *first, int *last)
Get indices of first and last atoms of a chain.
const char * freesasa_node_structure_chain_labels(const freesasa_node *node)
All chain labels in a structure.
int freesasa_structure_n_residues(const freesasa_structure *structure)
Get number of residues.
freesasa_classifier * freesasa_classifier_from_file(FILE *file)
Generate a classifier from a config-file.
Include HETATM entries.
Definition: freesasa.h:145
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 individual atom to structure.
const char * freesasa_classifier_name(const freesasa_classifier *classifier)
The name of a classifier.
int freesasa_node_free(freesasa_node *root)
Free tree.
freesasa_structure_options
Options for reading structure from PDB.
Definition: freesasa.h:144
double freesasa_structure_atom_radius(const freesasa_structure *structure, int i)
Get atom radius.
JSON output.
Definition: freesasa.h:163
double main_chain
Main-chain/Backbone SASA.
Definition: freesasa.h:223
Atom node.
Definition: freesasa.h:232
const freesasa_result * freesasa_node_structure_result(const freesasa_node *node)
Raw results for a structure.
const char * freesasa_structure_chain_labels(const freesasa_structure *structure)
Get string listing all chains in structure.
Read separate chains as separate structures.
Definition: freesasa.h:148
char freesasa_structure_atom_chain(const freesasa_structure *structure, int i)
Get chain label.
const freesasa_parameters freesasa_default_parameters
The default parameters for FreeSASA.
const double * freesasa_structure_coord_array(const freesasa_structure *structure)
Get array of coordinates.
Struct to store results of SASA calculation.
Definition: freesasa.h:202
struct freesasa_structure freesasa_structure
Struct for structure object.
Definition: freesasa.h:199
freesasa_structure * freesasa_structure_new(void)
Allocate empty structure.
const char * name
Name of substructure.
Definition: freesasa.h:221
double * sasa
SASA of each atom in Ångström^2.
Definition: freesasa.h:204
int freesasa_node_atom_is_polar(const freesasa_node *node)
Is atom polar.
double freesasa_node_atom_radius(const freesasa_node *node)
Atom radius.
freesasa_nodetype freesasa_node_type(const freesasa_node *node)
The type of a node.
Output data for chains and structure.
Definition: freesasa.h:159
int freesasa_selection_n_atoms(const freesasa_selection *selection)
Number of atoms that matched the selection.
double total
Total SASA in Ångström^2.
Definition: freesasa.h:203
const freesasa_selection ** freesasa_node_structure_selections(const freesasa_node *node)
Selection results for a structure.
All is ok (value will always be zero).
Definition: freesasa.h:124
const freesasa_nodearea * freesasa_node_area(const freesasa_node *node)
The freesasa_nodearea of all atoms belonging to a node.
freesasa_node * freesasa_tree_new(void)
Generates empty freesasa_node of type FREESASA_NODE_ROOT.
freesasa_error_codes
Error codes.
Definition: freesasa.h:123
void freesasa_structure_atom_set_radius(freesasa_structure *structure, int i, double radius)
Set atom radius.
double side_chain
Side-chain SASA.
Definition: freesasa.h:224
int freesasa_node_structure_add_selection(freesasa_node *node, const freesasa_selection *selection)
Add a selection result to a structure node.
const char * freesasa_node_name(const freesasa_node *node)
The name of a node.
const freesasa_classifier freesasa_oons_classifier
Classifier using OONS radii and classes.
freesasa_parameters parameters
Parameters used when generating result.
Definition: freesasa.h:206
Read atom radius from occupancy field.
Definition: freesasa.h:152
const char * freesasa_structure_atom_res_number(const freesasa_structure *structure, int i)
Get residue number.
Residue node.
Definition: freesasa.h:233
int freesasa_node_structure_n_chains(const freesasa_node *node)
The number of chains in a structure.
freesasa_result * freesasa_calc_coord(const double *xyz, const double *radii, int n, const freesasa_parameters *parameters)
Calculates SASA based on a given set of coordinates and radii.
Output data for residues, chains and structure.
Definition: freesasa.h:158
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 residue.