FreeSASA  1.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 
21 #include <stdio.h>
22 
23 #ifdef __cplusplus
24 extern "C"{
25 #endif
26 
28 typedef enum {
32 
34 typedef enum {
40 
41 // Default parameters
42 #define FREESASA_DEF_ALGORITHM FREESASA_LEE_RICHARDS
43 #define FREESASA_DEF_PROBE_RADIUS 1.4
44 #define FREESASA_DEF_SR_N 100
45 #define FREESASA_DEF_LR_N 20
46 
47 #define freesasa_default_classifier freesasa_protor_classifier
49 
51 #define freesasa_default_rsa freesasa_protor_rsa
52 
56 const extern int FREESASA_DEF_NUMBER_THREADS;
57 
64 };
65 
81 };
82 
84 #define FREESASA_MAX_SELECTION_NAME 50
85 
87 typedef struct {
89  double probe_radius;
92  int n_threads;
94 
97 
99 typedef struct {
100  double total;
101  double *sasa;
102  int n_atoms;
104 
106 typedef struct {
107  const char *name;
108  double total;
109  double main_chain;
110  double side_chain;
111  double polar;
112  double apolar;
114 
124 
130 typedef struct {
131  double *value;
132  char **string;
133  int n;
135 
141 typedef struct freesasa_classifier {
142  int n_classes;
143  void *config;
144 
149  double (*radius)(const char* res_name,
150  const char* atom_name,
151  const struct freesasa_classifier*);
152 
157  int (*sasa_class)(const char* res_name,
158  const char* atom_name,
159  const struct freesasa_classifier*);
160 
162  const char* (*class2str)(int the_class,
163  const struct freesasa_classifier*);
164 
166  void (*free_config)(void*);
168 
171 
174 
177 
179 typedef struct {
181  char *name;
182 
188 
196 
203 
206 
209 
224  const freesasa_parameters *parameters);
225 
241 freesasa_calc_coord(const double *xyz,
242  const double *radii,
243  int n,
244  const freesasa_parameters *parameters);
245 
251 void
253 
270 
276 void
278 
294  const freesasa_structure *structure,
295  const freesasa_classifier *classifier);
296 
297 
326 int
327 freesasa_select_area(const char *command,
328  char *name,
329  double *area,
330  const freesasa_structure *structure,
331  const freesasa_result *result);
332 
338 void
340 
360 int
361 freesasa_write_pdb(FILE *output,
362  freesasa_result *result,
363  const freesasa_structure *structure);
364 
377 int
378 freesasa_per_chain(FILE *output,
379  freesasa_result *result,
380  const freesasa_structure *structure);
381 
396 int
397 freesasa_per_residue_type(FILE *output,
398  freesasa_result *result,
399  const freesasa_structure *structure);
400 
412 int
413 freesasa_per_residue(FILE *output,
414  freesasa_result *result,
415  const freesasa_structure *structure);
416 
435 int
436 freesasa_log(FILE *log,
437  freesasa_result *result,
438  const char *name,
439  const freesasa_parameters *parameters,
440  const freesasa_strvp* class_sasa);
453 int
454 freesasa_write_result(FILE *log,
455  freesasa_result *result,
456  const char *name,
457  const char *chains,
458  const freesasa_strvp* class_sasa);
467 int freesasa_write_parameters(FILE *log,
468  const freesasa_parameters *parameters);
469 
493 int
494 freesasa_write_rsa(FILE *output,
495  const freesasa_result *result,
496  const freesasa_structure *structure,
497  const char *name,
498  const freesasa_rsa_reference *reference);
506 int
508 
516 
525 void
526 freesasa_set_err_out(FILE *err);
527 
535 FILE *
537 
548 
554 void
556 
616  const freesasa_classifier *classifier,
617  int options);
618 
646 freesasa_structure_array(FILE *pdb,
647  int *n,
648  const freesasa_classifier *classifier,
649  int options);
650 
668 int
670  const char* atom_name,
671  const char* residue_name,
672  const char* residue_number,
673  char chain_label,
674  double x, double y, double z);
721 int
723  const char *atom_name,
724  const char *residue_name,
725  const char *residue_number,
726  char chain_label,
727  double x, double y, double z,
728  const freesasa_classifier *classifier,
729  int options);
730 
750  const char* chains);
751 
758 const char*
760 
767 int
768 freesasa_structure_n(const freesasa_structure *structure);
769 
782 int
784 
791 int
793 
801 const double*
803 
813 void
815  const double* radii);
816 
830 const char*
832  int i);
833 
846 const char*
848  int i);
849 
862 const char*
864  int i);
865 
875 char
877  int i);
878 
892 const char*
894  int i);
895 
903 const char*
905  int r_i);
906 
914 const char*
916  int r_i);
924 char
926  int r_i);
927 
936 int
938 
948 const double*
950 
960 int
962  int r_i,
963  int *first,
964  int *last);
965 
975 int
977  char chain,
978  int *first,
979  int *last);
980 
981 
982 #ifdef __cplusplus
983 }
984 #endif
985 
986 #endif /* FREESASA_H */
Include HETATM entries.
Definition: freesasa.h:73
const freesasa_classifier * bb_classifier
A classifier whose sasa_class() function returns 0 for side chain atoms and non-zero for backbone...
Definition: freesasa.h:201
Halt reading when unknown atom is encountered.
Definition: freesasa.h:78
const double * freesasa_structure_coord_array(const freesasa_structure *structure)
Get array of coordinates.
char * name
Name of RSA reference.
Definition: freesasa.h:181
freesasa_algorithm alg
Algorithm.
Definition: freesasa.h:88
const char * freesasa_structure_chain_labels(const freesasa_structure *structure)
Get string listing all chains in structure.
int freesasa_structure_n_chains(const freesasa_structure *s)
Get number of chains.
Print all errors and warnings.
Definition: freesasa.h:35
void * config
Optional configuration to allow flexibility.
Definition: freesasa.h:143
double probe_radius
Probe radius (in Ångström)
Definition: freesasa.h:89
Struct used for calculating classes and radii for atoms given their residue-names ('ALA'...
Definition: freesasa.h:141
void freesasa_strvp_free(freesasa_strvp *strvp)
Frees a freesasa_strvp object.
Print no errors and warnings.
Definition: freesasa.h:37
int freesasa_write_rsa(FILE *output, const freesasa_result *result, const freesasa_structure *structure, const char *name, const freesasa_rsa_reference *reference)
Print RSA-file.
Struct used to store n string-value-pairs (strvp) in arrays of doubles and strings.
Definition: freesasa.h:130
freesasa_strvp * freesasa_result_classify(const freesasa_result *result, const freesasa_structure *structure, const freesasa_classifier *classifier)
Sums up the SASA for groups of atoms defined by a classifier.
Something went seriously wrong (value will always be negative).
Definition: freesasa.h:62
int freesasa_structure_chain_atoms(const freesasa_structure *s, char chain, int *first, int *last)
Get indices of first and last atoms of a chain.
double side_chain
Side-chain SASA.
Definition: freesasa.h:110
int freesasa_write_parameters(FILE *log, const freesasa_parameters *parameters)
Print parameters to file.
int(* sasa_class)(const char *res_name, const char *atom_name, const struct freesasa_classifier *)
Function that returns the class [0,1,...,n_classes-1] of an atom, should return FREESASA_WARN if atom...
Definition: freesasa.h:157
Print all errors, warnings and debug messages.
Definition: freesasa.h:38
int freesasa_structure_n_residues(const freesasa_structure *s)
Get number of residues.
Read MODELs as separate structures.
Definition: freesasa.h:75
freesasa_algorithm
The FreeSASA algorithms.
Definition: freesasa.h:28
int lee_richards_n_slices
Number of slices per atom in L&R calculation.
Definition: freesasa.h:91
const freesasa_classifier freesasa_protor_classifier
Classifier using ProtOr radii and classes.
const char * freesasa_structure_atom_res_number(const freesasa_structure *structure, int i)
Get residue number.
const freesasa_residue_sasa * max
Array containing max SASA-values for named residues types.
Definition: freesasa.h:187
int n
Number of values and strings.
Definition: freesasa.h:133
const char * freesasa_structure_residue_number(const freesasa_structure *s, int r_i)
Get residue number.
freesasa_verbosity
Verbosity levels.
Definition: freesasa.h:34
const char * freesasa_structure_residue_name(const freesasa_structure *s, int r_i)
Get name of residue.
char freesasa_structure_atom_chain(const freesasa_structure *structure, int i)
Get chain label.
int freesasa_log(FILE *log, freesasa_result *result, const char *name, const freesasa_parameters *parameters, const freesasa_strvp *class_sasa)
Log calculation results.
freesasa_verbosity freesasa_get_verbosity(void)
Get the current verbosity level.
freesasa_structure * freesasa_structure_new(void)
Allocate empty structure.
Struct to store parameters for SASA calculation.
Definition: freesasa.h:87
int freesasa_write_pdb(FILE *output, freesasa_result *result, const freesasa_structure *structure)
Write SASA values and atomic radii to new PDB-file.
int freesasa_structure_residue_atoms(const freesasa_structure *s, int r_i, int *first, int *last)
Get indices of first and last atoms of a residue.
int n_atoms
Number of atoms.
Definition: freesasa.h:102
int freesasa_per_residue_type(FILE *output, freesasa_result *result, const freesasa_structure *structure)
Print SASA for all residue types to file.
freesasa_result * freesasa_calc_structure(const freesasa_structure *structure, const freesasa_parameters *parameters)
Calculates SASA based on a given 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 individual atom to structure.
int freesasa_structure_n(const freesasa_structure *structure)
Get number of atoms.
int n_threads
Number of threads to use, if compiled with thread-support.
Definition: freesasa.h:92
FILE * freesasa_get_err_out()
Get pointer to error file.
int freesasa_structure_model(const freesasa_structure *structure)
Get model number for structure.
Something went wrong, but results might still be meaningful (value will always be negative)...
Definition: freesasa.h:63
const double * freesasa_structure_radius(const freesasa_structure *structure)
Returns a pointer to an array of the radii of each atom.
double apolar
Apolar SASA.
Definition: freesasa.h:112
double * value
Array of values.
Definition: freesasa.h:131
Include hydrogen atoms.
Definition: freesasa.h:74
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.
Read atom radius from occupancy field.
Definition: freesasa.h:80
struct freesasa_structure freesasa_structure
Struct for structure object.
Definition: freesasa.h:123
int freesasa_write_result(FILE *log, freesasa_result *result, const char *name, const char *chains, const freesasa_strvp *class_sasa)
Write results of claculation to file.
void freesasa_set_err_out(FILE *err)
Set where to write errors.
const char * name
Residue name.
Definition: freesasa.h:107
const freesasa_rsa_reference freesasa_protor_rsa
An RSA-reference for the ProtOr configuration.
const freesasa_classifier freesasa_naccess_classifier
Classifier using NACCESS radii and classes.
double(* radius)(const char *res_name, const char *atom_name, const struct freesasa_classifier *)
Function that returns an atom radius.
Definition: freesasa.h:149
int shrake_rupley_n_points
Number of test points in S&R calculation.
Definition: freesasa.h:90
const freesasa_classifier * polar_classifier
A classifier whose sasa_class() function returns 0 for apolar atoms and non-zero for polar atoms...
Definition: freesasa.h:195
Print only errors.
Definition: freesasa.h:36
Struct to store SASA values for a named residue.
Definition: freesasa.h:106
const freesasa_parameters freesasa_default_parameters
The default parameters for FreeSASA.
char freesasa_structure_residue_chain(const freesasa_structure *s, int r_i)
Get chain residue belongs to.
Read separate chains as separate structures.
Definition: freesasa.h:76
double polar
Polar SASA.
Definition: freesasa.h:111
void freesasa_classifier_free(freesasa_classifier *classifier)
Frees a classifier object.
int n_classes
Total number of different classes.
Definition: freesasa.h:142
int freesasa_select_area(const char *command, char *name, double *area, const freesasa_structure *structure, const freesasa_result *result)
Get area of a selection.
Used as reference in generation of RSA file.
Definition: freesasa.h:179
Lee & Richards' algorithm.
Definition: freesasa.h:29
int freesasa_set_verbosity(freesasa_verbosity v)
Set the global verbosity level.
char ** string
Array of strings.
Definition: freesasa.h:132
freesasa_classifier * freesasa_classifier_from_file(FILE *file)
Generate a classifier from a config-file.
const int FREESASA_DEF_NUMBER_THREADS
Default number of threads.
Struct to store results of SASA calculation.
Definition: freesasa.h:99
const char * freesasa_structure_atom_res_name(const freesasa_structure *structure, int i)
Get residue name.
freesasa_structure_options
Options for reading structure from PDB.
Definition: freesasa.h:72
double * sasa
SASA of each atom in Ångström^2.
Definition: freesasa.h:101
double total
Total SASA.
Definition: freesasa.h:108
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.
int freesasa_per_residue(FILE *output, freesasa_result *result, const freesasa_structure *structure)
Print SASA for each residue in the sequence to file.
double total
Total SASA in Ångström^2.
Definition: freesasa.h:100
All is ok (value will always be zero).
Definition: freesasa.h:61
Read MODELs as part of one big structure.
Definition: freesasa.h:77
freesasa_error_codes
Error codes.
Definition: freesasa.h:60
double main_chain
Main-chain/Backbone SASA.
Definition: freesasa.h:109
int freesasa_per_chain(FILE *output, freesasa_result *result, const freesasa_structure *structure)
Print SASA for each chain.
void freesasa_structure_set_radius(freesasa_structure *structure, const double *radii)
Override the radii set when the structure was initialized.
void(* free_config)(void *)
Function that can be called to free the config-pointer.
Definition: freesasa.h:166
const freesasa_classifier freesasa_oons_classifier
Classifier using OONS radii and classes.
freesasa_structure ** freesasa_structure_array(FILE *pdb, int *n, const freesasa_classifier *classifier, int options)
Init array of structures from PDB.
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.
Shrake & Rupley's algorithm.
Definition: freesasa.h:30
const char * freesasa_structure_atom_symbol(const freesasa_structure *structure, int i)
Get atom symbol.
freesasa_structure * freesasa_structure_from_pdb(FILE *pdb, const freesasa_classifier *classifier, int options)
Init structure with coordinates from pdb-file.
const char * freesasa_structure_atom_name(const freesasa_structure *structure, int i)
Get atom name.
void freesasa_structure_free(freesasa_structure *structure)
Free structure.
Skip atom when unknown atom is encountered.
Definition: freesasa.h:79
const freesasa_rsa_reference freesasa_naccess_rsa
An RSA-reference for the NACCESS configuration.
void freesasa_result_free(freesasa_result *result)
Frees a freesasa_result object.