Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mittinatten committed Sep 5, 2015
2 parents 9d03925 + c835ad4 commit 0c6ab72
Show file tree
Hide file tree
Showing 19 changed files with 25,107 additions and 256 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ doc/doxygen
bindings/python/*.c
doc/html/
tests/libtest
tests/test-cli.sh
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT([FreeSASA], [0.3.3.1])
AC_INIT([FreeSASA], [0.3.4])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([src/freesasa.c])
AC_CONFIG_HEADERS([config.h])
Expand Down
6 changes: 2 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
if COND_GCOV
AM_CFLAGS = --coverage
AM_LDFLAGS = -lgcov
GCOV_FILES = *.gcda *.gcno *.gcov
else
GCOV_FILES =
endif
GCOV_FILES = *.gcda *.gcno *.gcov

bin_PROGRAMS = freesasa
lib_LIBRARIES = libfreesasa.a
Expand All @@ -21,4 +19,4 @@ freesasa_LDADD = libfreesasa.a
example_LDADD = libfreesasa.a


CLEANFILES = $(GCOV_FILES)
CLEANFILES = $(GCOV_FILES) *~
21 changes: 20 additions & 1 deletion src/classify.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ static const char *residue_names[] = {
"MET","PHE","PRO","SER",
"THR","TRP","TYR","VAL",
"CSE","ASX","GLX",
"ACE","NH2",
"UNK",
//DNA
"DA","DC","DG","DT","DU","DI",
//RNA
"A","C","G","U","I","T",
//General nuceleotide
"N"

};


Expand Down Expand Up @@ -112,6 +114,8 @@ const freesasa_classifier freesasa_residue_classifier = {

double freesasa_classify_radius(const char *res_name, const char *atom_name)
{
if (freesasa_classify_element(atom_name) == freesasa_hydrogen)
return freesasa_classify_element_radius(freesasa_hydrogen);
int res = freesasa_classify_residue(res_name);
if (freesasa_classify_is_aminoacid(res)) {
return freesasa_classify_oons_radius(freesasa_classify_oons(res_name,
Expand Down Expand Up @@ -215,6 +219,7 @@ int freesasa_classify_element(const char *atom_name)
case 'N': return freesasa_nitrogen;
case 'S': return freesasa_sulfur;
case 'P': return freesasa_phosphorus;
case 'H': return freesasa_hydrogen;
// what about Se?
default:
freesasa_warn("%s: atom '%s' unknown.\n",__func__,atom_name);
Expand Down Expand Up @@ -252,7 +257,7 @@ double freesasa_classify_element_radius(int element)
case freesasa_sulfur: return 1.8;
case freesasa_phosphorus: return 1.8;
case freesasa_selenium: return 1.9;
//case freesasa_hydrogen: return 1.2;
case freesasa_hydrogen: return 0.0; // the exception
case freesasa_element_unknown:
default:
return 0.0;
Expand Down Expand Up @@ -319,6 +324,18 @@ static int classify_oons_cse(const char* a)
return freesasa_oons_unknown;
}

static int classify_oons_nh2(const char* a)
{
if (a[1] == 'N' && a[2] == 'H' && a[3] == '2') return freesasa_amide_N;
return freesasa_oons_unknown;
}

static int classify_oons_ace(const char* a)
{
if (a[1] == 'C' && a[2] == 'H' && a[3] == '3') return freesasa_aliphatic_C;
return freesasa_oons_unknown;
}

/** Main OONS function */
int freesasa_classify_oons(const char *res_name, const char *a)
{
Expand Down Expand Up @@ -376,6 +393,8 @@ int freesasa_classify_oons(const char *res_name, const char *a)
case freesasa_ASX: return classify_oons_ND(a);
case freesasa_GLX: return classify_oons_QE(a);
case freesasa_CSE: return classify_oons_cse(a);
case freesasa_ACE: return classify_oons_ace(a);
case freesasa_NH2: return classify_oons_nh2(a);
default:
return freesasa_oons_unknown;
}
Expand Down
3 changes: 3 additions & 0 deletions src/classify.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ enum freesasa_residue {
freesasa_THR, freesasa_TRP, freesasa_TYR, freesasa_VAL,
//some non-standard ones
freesasa_CSE, freesasa_ASX, freesasa_GLX,
//capping N- and C-terminal groups (usually HETATM)
freesasa_ACE, freesasa_NH2,
//residue unknown
freesasa_UNK,
//DNA
freesasa_DA, freesasa_DC, freesasa_DG, freesasa_DT,
Expand Down
3 changes: 2 additions & 1 deletion src/freesasa.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,11 @@ int freesasa_log(FILE *log,
// return value.
errno = 0;

fprintf(log,"## %s %s ##\n",freesasa_name,freesasa_version);
if (name == NULL) fprintf(log,"name: unknown\n");
else fprintf(log,"name: %s\n",name);

fprintf(log,"n_atoms: %d\n",result->n_atoms);

fprintf(log,"algorithm: %s\nprobe-radius: %f A\n",
freesasa_alg_names[p->alg],
p->probe_radius);
Expand Down
83 changes: 72 additions & 11 deletions src/freesasa.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@
using freesasa_classifier_from_file() (see @ref Config-file).
The default classifier is available as a global const variable
::freesasa_default_classifier.
::freesasa_default_classifier. This uses the classes and radii,
defined in the paper by Ooi et al. ([PNAS 1987, 84:
3086](http://www.ncbi.nlm.nih.gov/pmc/articles/PMC304812/)) for
the standard amino acids and also for some capping groups
(ACE/NH2) if HETATM fields are included when the PDB input is
read. For other residues such as Nucleic Acids or nonstandard
amino acids, or unrecognized HETATM entries the VdW radius of
the element is used. Warnings are emitted in this case.
@subsubsection Config-file Classifier configuration files
Expand Down Expand Up @@ -199,7 +206,6 @@ typedef enum {
FREESASA_NUCLEICACID, FREESASA_CLASS_UNKNOWN
} freesasa_class;


// Default parameters
#define FREESASA_DEF_PROBE_RADIUS 1.4 //!< Default probe radius (in Ångström) @ingroup API
#define FREESASA_DEF_SR_N 100 //!< Default number of test points in S&R @ingroup API
Expand All @@ -209,6 +215,13 @@ typedef enum {
#define FREESASA_FAIL -1 //!< Something went seriously wrong. @ingroup API
#define FREESASA_WARN -2 //!< Something went wrong, but results might still be meaningful @ingroup API

// Parameters for reading structure from PDB
#define FREESASA_INCLUDE_HETATM 1 //!< Include HETATM entries
#define FREESASA_INCLUDE_HYDROGEN 2 //!< Include hydrogen atoms
#define FREESASA_SEPARATE_MODELS 4 //!< Read MODELs as separate structures
#define FREESASA_SEPARATE_CHAINS 8 //!< Read separate chains as separate structures
#define FREESASA_JOIN_MODELS 16 //!< Read MODELs as part of one big structure

//! Struct to store parameters for SASA calculation @ingroup API
typedef struct {
freesasa_algorithm alg; //!< Algorithm
Expand Down Expand Up @@ -535,24 +548,62 @@ freesasa_structure* freesasa_structure_new(void);
Automatically skips hydrogens. 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. User specifies if `HETATM` entries should be included. If
non-default behavior is wanted, 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().
is used. User specifies if `HETATM` entries and/or hydrogen atoms
should be included. It is also possible to specify that all MODELs
should be joined to one large structure. If 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().
Return value is dynamically allocated, should be freed with
freesasa_structure_free().
@param pdb Input PDB-file.
@param include_hetatm The value 0 means only read `ATOM` entries, 1
means also include `HETATM` entries.
@return The generated structure. Returns `NULL` and prints error if
input is invalid.
@param options Bitfield. 0 means only use non-hydrogen `ATOM`
entries, first MODEL only. ::FREESASA_INCLUDE_HETATM and
::FREESASA_INCLUDE_HYDROGEN can be used to include more
atoms. ::FREESASA_JOIN_MODELS can be used if input has several
models that should be considered part of the same structure. The
options can be included using `|`, for example
`FREESASA_INCLUDE_HETATM | FREESASA_INCLUDE_HYDROGEN` means
include both hydrogens and HETATMs.
@return The generated structure. Returns `NULL` and prints error
if input is invalid.
@ingroup StructureAPI
*/
freesasa_structure* freesasa_structure_from_pdb(FILE *pdb,
int include_hetatm);
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 options Bitfield. 0 means only use non-hydrogen `ATOM`
entries. ::FREESASA_INCLUDE_HETATM and
::FREESASA_INCLUDE_HYDROGEN can be used to include more
atoms. ::FREESASA_SEPARATE_MODELS and
::FREESASA_SEPARATE_CHAINS can be used to generate one structure
per model and one structure per chain, respectively. All four
options can be combined using `|`, analogously to
freesasa_structure_from_pdb().
@ingroup StructureAPI
*/
freesasa_structure** freesasa_structure_array(FILE *pdb,
int *n,
int options);

/**
Add individual atom to structure.
Expand Down Expand Up @@ -624,6 +675,7 @@ void freesasa_structure_free(freesasa_structure* structure);
double* freesasa_structure_radius(const freesasa_structure *structure,
const freesasa_classifier *classifier);


/**
Get atom name
Expand Down Expand Up @@ -671,6 +723,15 @@ const char* freesasa_structure_atom_res_number(const freesasa_structure *s,
*/
char freesasa_structure_atom_chain(const freesasa_structure *s, int i);

/**
Get model number for structure.
Useful if structure was generated with freesasa_structure_array().
@param structure The structure.
@return The model number. 0 means no model number has been read.
*/
int freesasa_structure_model(const freesasa_structure *structure);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 0c6ab72

Please sign in to comment.