FreeSASA  2.1.2
Open source SASA calculations
View on GitHub
example.c
Go to the documentation of this file.
1
14#include <stdio.h>
15#include <stdlib.h>
16
17#include "freesasa.h"
18
20int main(int argc, char **argv)
21{
22 freesasa_structure *structure = NULL;
23 freesasa_result *result = NULL;
26
27 /* Read structure from stdin */
28 structure = freesasa_structure_from_pdb(stdin, classifier, 0);
29
30 /* Calculate SASA using structure */
31 if (structure) {
32 result = freesasa_calc_structure(structure, NULL);
33 }
34
35 /* Calculate area of classes (Polar/Apolar/..) */
36 if (result) {
37 area = freesasa_result_classes(structure, result);
38 } else {
39 /* If there was an error at any step, we will end up here */
40 printf("Error calculating SASA\n");
41 }
42
43 /* Print results */
44 printf("Total : %f A2\n", area.total);
45 printf("Apolar : %f A2\n", area.apolar);
46 printf("Polar : %f A2\n", area.polar);
47
48 /* Free allocated resources */
50 freesasa_structure_free(structure);
51
52 return EXIT_SUCCESS;
53}
Functions and datatypes for performing and analyzing SASA calculations.
struct freesasa_classifier freesasa_classifier
Classifier struct.
Definition: freesasa.h:374
freesasa_nodearea freesasa_result_classes(const freesasa_structure *structure, const freesasa_result *result)
Results by classes.
freesasa_result * freesasa_calc_structure(const freesasa_structure *structure, const freesasa_parameters *parameters)
Calculates SASA based on a given structure.
#define freesasa_default_classifier
Default freesasa_classifier.
Definition: freesasa.h:124
void freesasa_result_free(freesasa_result *result)
Frees a freesasa_result object.
void freesasa_structure_free(freesasa_structure *structure)
Free structure.
struct freesasa_structure freesasa_structure
Struct for structure object.
Definition: freesasa.h:260
freesasa_structure * freesasa_structure_from_pdb(FILE *pdb, const freesasa_classifier *classifier, int options)
Init structure with coordinates from pdb-file.
Struct to store integrated SASA values for either a full structure or a subset thereof.
Definition: freesasa.h:289
double apolar
Apolar SASA.
Definition: freesasa.h:295
double polar
Polar SASA.
Definition: freesasa.h:294
double total
Total SASA.
Definition: freesasa.h:291
Struct to store results of SASA calculation.
Definition: freesasa.h:267