FreeSASA  2.0.3
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 
99 typedef enum {
105 
106 /* Default parameters */
107 #define FREESASA_DEF_ALGORITHM FREESASA_LEE_RICHARDS
108 #define FREESASA_DEF_PROBE_RADIUS 1.4
109 #define FREESASA_DEF_SR_N 100
110 #define FREESASA_DEF_LR_N 20
116 #define freesasa_default_classifier freesasa_protor_classifier
117 
125 #define FREESASA_CONFLICTING_CLASSIFIERS "conflicting-classifiers"
126 
135 const extern int FREESASA_DEF_NUMBER_THREADS;
136 
147 };
148 
155 typedef enum {
156  FREESASA_ATOM_APOLAR=0,
157  FREESASA_ATOM_POLAR=1,
158  FREESASA_ATOM_UNKNOWN=2,
160 
179 };
180 
198  FREESASA_RES=1<<10,
199  FREESASA_SEQ=1<<11,
206 };
207 
213 #define FREESASA_MAX_SELECTION_NAME 50
214 
219 typedef struct {
221  double probe_radius;
224  int n_threads;
226 
232 
244 
250 typedef struct {
251  double total;
252  double *sasa;
253  int n_atoms;
256 
268 typedef struct {
269  const char *name;
270  double total;
271  double main_chain;
272  double side_chain;
273  double polar;
274  double apolar;
275  double unknown;
277 
282 typedef enum {
291 
301 
310 
323 
332 
341 
350 
370  const freesasa_parameters *parameters);
371 
389 freesasa_calc_coord(const double *xyz,
390  const double *radii,
391  int n,
392  const freesasa_parameters *parameters);
393 
411 freesasa_calc_tree(const freesasa_structure *structure,
412  const freesasa_parameters *parameters,
413  const char *name);
414 
431  const freesasa_result *result);
432 
440 void
442 
461 
469 void
471 
482 double
484  const char *res_name,
485  const char *atom_name);
486 
499  const char *res_name,
500  const char *atom_name);
501 
510 const char*
512 
521 const char*
523 
553 freesasa_selection_new(const char *command,
554  const freesasa_structure *structure,
555  const freesasa_result *result);
556 
564 void
566 
575 const char *
577 
586 const char *
588 
597 double
599 
608 int
610 
620 int
622 
632 
643 void
644 freesasa_set_err_out(FILE *err);
645 
655 FILE *
657 
670 
678 void
680 
736  const freesasa_classifier *classifier,
737  int options);
738 
767 freesasa_structure_array(FILE *pdb,
768  int *n,
769  const freesasa_classifier *classifier,
770  int options);
771 
791 int
793  const char* atom_name,
794  const char* residue_name,
795  const char* residue_number,
796  char chain_label,
797  double x, double y, double z);
846 int
848  const char *atom_name,
849  const char *residue_name,
850  const char *residue_number,
851  char chain_label,
852  double x, double y, double z,
853  const freesasa_classifier *classifier,
854  int options);
855 
877  const char* chains);
878 
887 const char*
889 
898 int
899 freesasa_structure_n(const freesasa_structure *structure);
900 
915 int
917 
926 int
928 
938 const double*
940 
952 void
954  const double* radii);
955 
971 const char*
973  int i);
974 
989 const char*
991  int i);
992 
1007 const char*
1009  int i);
1010 
1022 char
1024  int i);
1025 
1041 const char*
1043  int i);
1044 
1056 double
1058  int i);
1070 void
1072  int i,
1073  double radius);
1074 
1084 const char*
1086  int r_i);
1087 
1097 const char*
1099  int r_i);
1109 char
1111  int r_i);
1112 
1124 int
1126 
1138 const double*
1140 
1152 int
1154  int r_i,
1155  int *first,
1156  int *last);
1157 
1169 int
1171  char chain,
1172  int *first,
1173  int *last);
1174 
1186 int
1188  char chain,
1189  int *first,
1190  int *last);
1191 
1202 const char *
1204 
1217 freesasa_node *
1218 freesasa_tree_new(void);
1219 
1236 freesasa_node *
1237 freesasa_tree_init(const freesasa_result *result,
1238  const freesasa_structure *structure,
1239  const char *name);
1240 
1257 int
1259  const freesasa_result *result,
1260  const freesasa_structure *structure,
1261  const char *name);
1262 
1277 int
1279  freesasa_node **tree2);
1280 
1293 int
1294 freesasa_tree_export(FILE *output,
1295  freesasa_node *root,
1296  int options);
1297 
1309 int
1311 
1320 const freesasa_nodearea *
1321 freesasa_node_area(const freesasa_node *node);
1322 
1334 freesasa_node *
1336 
1345 freesasa_node *
1347 
1356 freesasa_node *
1358 
1368 freesasa_node_type(const freesasa_node *node);
1369 
1386 const char *
1387 freesasa_node_name(const freesasa_node *node);
1388 
1397 const char*
1399 
1408 int
1410 
1419 int
1421 
1430 double
1432 
1441 const char*
1443 
1452 const char *
1454 
1463 int
1465 
1475 const freesasa_nodearea *
1477 
1486 int
1488 
1497 int
1499 
1508 int
1510 
1519 const char *
1521 
1530 int
1532 
1541 const freesasa_result *
1543 
1555 const freesasa_selection **
1557 
1572 int
1574  const freesasa_selection *selection);
1583 const freesasa_parameters *
1585 
1586 /* Deprecated functions below, from 1.x API */
1587 
1606 int
1607 freesasa_select_area(const char *command,
1608  char *name,
1609  double *area,
1610  const freesasa_structure *structure,
1611  const freesasa_result *result);
1612 
1613 #ifdef __cplusplus
1614 }
1615 #endif
1616 
1617 #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:273
RSA output (not affected by atom, residue, etc above).
Definition: freesasa.h:194
freesasa_algorithm alg
Algorithm.
Definition: freesasa.h:220
Read MODELs as part of one big structure.
Definition: freesasa.h:175
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
Selection struct.
Definition: freesasa.h:309
Output data only for the whole structure.
Definition: freesasa.h:192
Print all errors and warnings.
Definition: freesasa.h:100
Read MODELs as separate structures.
Definition: freesasa.h:173
const freesasa_classifier freesasa_protor_classifier
ProtOr classifier.
double probe_radius
Probe radius (in Ångström).
Definition: freesasa.h:221
Root node, wraps one or more unrelated results.
Definition: freesasa.h:288
Include hydrogen atoms.
Definition: freesasa.h:172
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:102
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
Output options.
Definition: freesasa.h:188
Something went seriously wrong (value will always be negative).
Definition: freesasa.h:145
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:103
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:223
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:193
Output data for atoms, residues, chains and structure.
Definition: freesasa.h:189
FILE * freesasa_get_err_out(void)
Get pointer to error file.
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:99
double freesasa_selection_area(const freesasa_selection *selection)
Area of the selection.
double total
Total SASA.
Definition: freesasa.h:270
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:198
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:219
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:253
Structure node.
Definition: freesasa.h:286
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:176
double unknown
SASA of unknown class (neither polar nor apolar).
Definition: freesasa.h:275
Shrake & Rupley's algorithm.
Definition: freesasa.h:91
int n_threads
Number of threads to use, if compiled with thread-support.
Definition: freesasa.h:224
Skip atom when unknown atom is encountered.
Definition: freesasa.h:177
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:282
Chain node.
Definition: freesasa.h:285
Something went wrong, but results might still be meaningful (value will always be negative)...
Definition: freesasa.h:146
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:196
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
Classifier struct.
Definition: freesasa.h:322
struct freesasa_node freesasa_node
Result node.
Definition: freesasa.h:300
for specifying not a valid node.
Definition: freesasa.h:289
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:197
Result node, wraps results for one or more related structures.
Definition: freesasa.h:287
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:222
Print only errors.
Definition: freesasa.h:101
double apolar
Apolar SASA.
Definition: freesasa.h:274
The SASA of each residue in the sequence.
Definition: freesasa.h:199
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.
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:205
const freesasa_classifier freesasa_naccess_classifier
NACCESS classifier.
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:268
freesasa_atom_class
Atom classes.
Definition: freesasa.h:155
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:171
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:170
double freesasa_structure_atom_radius(const freesasa_structure *structure, int i)
Get atom radius.
JSON output.
Definition: freesasa.h:195
double main_chain
Main-chain/Backbone SASA.
Definition: freesasa.h:271
Atom node.
Definition: freesasa.h:283
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:174
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:250
struct freesasa_structure freesasa_structure
Struct for structure object.
Definition: freesasa.h:243
freesasa_structure * freesasa_structure_new(void)
Allocate empty structure.
const char * name
Name of substructure.
Definition: freesasa.h:269
double * sasa
SASA of each atom in Ångström^2.
Definition: freesasa.h:252
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:191
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:251
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:144
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:143
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:272
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
OONS classifier.
freesasa_parameters parameters
Parameters used when generating result.
Definition: freesasa.h:254
Read atom radius from occupancy field.
Definition: freesasa.h:178
const char * freesasa_structure_atom_res_number(const freesasa_structure *structure, int i)
Get residue number.
Residue node.
Definition: freesasa.h:284
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:190
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.