Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Macros | Functions
secstr.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "pdb.h"
#include "array.h"
#include "MathType.h"
#include "SysDefs.h"
#include "macros.h"
#include "angle.h"
#include "secstr.h"

Go to the source code of this file.

Macros

#define TESTCODE   1
 
#define MAXBUFF   160
 Secondary structure calculation. More...
 
#define COORD_DIM   3 /* number of coord dimensions: x, y, z */
 
#define NUM_STRAND_CHARS
 
#define MAX_NUM_HBOND   4 /* number of allowed H-bonds */
 
#define MAX_NUM_CHN
 
#define NRULES   3
 
#define PARLEL   1
 
#define NUM_BRIDGE   4 /* Max bridge index */
 
#define NUM_STRAND_PAIR   2 /* Paired strands */
 
#define NUM_BRIDGE_PAIR   2 /* Paired strands for bridge */
 
#define NUM_DIHED_DATA   3 /* number of dihedral data points */
 
#define RESTYPE_PROLINE
 
#define NUM_MC_ATOM_TYPES   6 /* number of M/C atom types */
 
#define ATOM_N   0 /* atom indexes */
 
#define ATOM_CA   1
 
#define ATOM_C   2
 
#define ATOM_O   3
 
#define ATOM_H   4
 
#define ATOM_CB   5
 
#define MAX_NUM_ANGLES   7 /* number of angles calculated */
 
#define NUM_STANDARD_DIHEDRALS   4 /* number of standard dihedrals */
 
#define DIHED_PHI   0 /* dihedral indexes */
 
#define DIHED_PSI   1
 
#define DIHED_OMEGA   2
 
#define DIHED_CHIRAL   3
 
#define DIHED_IMPLD   4
 
#define DIHED_KAPPA   5
 
#define DIHED_TCO   6
 
#define NUM_STRUC_SYMS   (11) /* number of structure symbols */
 
#define SECSTR_IDX_ALPHAH   0 /* Symbol indexes */
 
#define SECSTR_IDX_SHEET1   1
 
#define SECSTR_IDX_SHEET   2
 
#define SECSTR_IDX_BRIDGE   3
 
#define SECSTR_IDX_BRIDG1   4
 
#define SECSTR_IDX_BRIDG2   5
 
#define SECSTR_IDX_THRTNH   6
 
#define SECSTR_IDX_PIH   7
 
#define SECSTR_IDX_TURN   8
 
#define SECSTR_IDX_BEND   9
 
#define SECSTR_IDX_CHISGN   10
 
#define NUM_HELIX_TYPE   3 /* number of helix types */
 
#define HELIX_CHUNK_SIZE   4 /* Helices are made in chunks of this */
 
#define THREE_TEN_CHUNK_SIZE   3 /* 3_10 helices in chunks of this */
 
#define PIH_CHUNK_SIZE   5 /* Pi helices in chunks of this */
 
#define BRIDGE_SEP   2 /* bridge separation */
 
#define BULGE_SIZE_L   5
 
#define BULGE_SIZE_S   2
 
#define CST   0 /* Offsets to store HBond energies */
 
#define NST   2
 
#define NUM_TURN_TYPE   3 /* number of turn types */
 
#define RADIAN   (180.0/3.141592) /* constant to convert RADs to degrees */
 
#define NULLVAL   999.9 /* used as a NULL value */
 
#define MAX_PEPTIDE_BOND   2.5 /* maximum peptide bond length */
 
#define MAX_CA_DISTANCE   5.0 /* maximum CA-CA distance */
 
#define BEND_SIZE
 
#define MAX_HBOND_ENERGY   -0.5
 
#define HBOND_ENERGY_LIMIT   -9.9
 
#define HBOND_MAX_CA_DIST   8.0
 
#define HBOND_Q1   0.42
 
#define HBOND_Q2   0.2
 
#define HBOND_F   332
 
#define ACCURACY   0.0001
 
#define APPROXEQ(x, y)   (ABS((x)-(y)) < ACCURACY)
 
#define APPROXNE(x, y)   (ABS((x)-(y)) >= ACCURACY)
 
#define ATDIST(a, b)
 
#define ANINT(x)   ((REAL)(int)((x) + (((x) >= 0.0)?0.5:(-0.5))))
 
#define FREE_SECSTR_MEMORY
 

Functions

int blCalcSecStrucPDB (PDB *pdbStart, PDB *pdbStop, BOOL verbose)
 

Macro Definition Documentation

#define ACCURACY   0.0001

Definition at line 176 of file secstr.c.

#define ANINT (   x)    ((REAL)(int)((x) + (((x) >= 0.0)?0.5:(-0.5))))

Definition at line 187 of file secstr.c.

#define APPROXEQ (   x,
 
)    (ABS((x)-(y)) < ACCURACY)

Definition at line 177 of file secstr.c.

#define APPROXNE (   x,
 
)    (ABS((x)-(y)) >= ACCURACY)

Definition at line 178 of file secstr.c.

#define ATDIST (   a,
 
)
Value:
sqrt(((a)[0]-(b)[0])*((a)[0]-(b)[0]) + \
((a)[1]-(b)[1])*((a)[1]-(b)[1]) + \
((a)[2]-(b)[2])*((a)[2]-(b)[2]))

Definition at line 181 of file secstr.c.

#define ATOM_C   2

Definition at line 116 of file secstr.c.

#define ATOM_CA   1

Definition at line 115 of file secstr.c.

#define ATOM_CB   5

Definition at line 119 of file secstr.c.

#define ATOM_H   4

Definition at line 118 of file secstr.c.

#define ATOM_N   0 /* atom indexes */

Definition at line 114 of file secstr.c.

#define ATOM_O   3

Definition at line 117 of file secstr.c.

#define BEND_SIZE
Value:
70.0 /* mainchain atoms bent by more than this
angle are flagged as "bend" */

Definition at line 164 of file secstr.c.

#define BRIDGE_SEP   2 /* bridge separation */

Definition at line 149 of file secstr.c.

#define BULGE_SIZE_L   5

Definition at line 150 of file secstr.c.

#define BULGE_SIZE_S   2

Definition at line 151 of file secstr.c.

#define COORD_DIM   3 /* number of coord dimensions: x, y, z */

Definition at line 88 of file secstr.c.

#define CST   0 /* Offsets to store HBond energies */

Definition at line 153 of file secstr.c.

#define DIHED_CHIRAL   3

Definition at line 126 of file secstr.c.

#define DIHED_IMPLD   4

Definition at line 127 of file secstr.c.

#define DIHED_KAPPA   5

Definition at line 128 of file secstr.c.

#define DIHED_OMEGA   2

Definition at line 125 of file secstr.c.

#define DIHED_PHI   0 /* dihedral indexes */

Definition at line 123 of file secstr.c.

#define DIHED_PSI   1

Definition at line 124 of file secstr.c.

#define DIHED_TCO   6

Definition at line 129 of file secstr.c.

#define FREE_SECSTR_MEMORY
Value:
do { \
if(gotAtom != NULL) \
blFreeArray2D((char **)gotAtom, NUM_MC_ATOM_TYPES, seqlenMalloc); \
if(mcCoords != NULL) \
blFreeArray3D((char ***)mcCoords, NUM_MC_ATOM_TYPES, seqlenMalloc, \
if(hbondEnergy != NULL) \
blFreeArray2D((char **)hbondEnergy, seqlenMalloc, MAX_NUM_HBOND); \
if(mcAngles != NULL) \
blFreeArray2D((char **)mcAngles, MAX_NUM_ANGLES, seqlenMalloc); \
if(detailSS != NULL) free(detailSS); \
if(finalSS != NULL) free(finalSS); \
if(breakSymbol != NULL) free(breakSymbol); \
if(ssTable != NULL) \
blFreeArray2D((char **)ssTable, NUM_STRUC_SYMS, seqlenMalloc); \
if(residueID != NULL) \
blFreeArray2D((char **)residueID, seqlenMalloc, 16); \
if(residueTypes != NULL) free(residueTypes); \
if(hbond != NULL) \
blFreeArray2D((char **)hbond, seqlenMalloc, MAX_NUM_HBOND); \
if(bridgePoints != NULL) \
blFreeArray2D((char **)bridgePoints, NUM_BRIDGE_PAIR, \
seqlenMalloc); \
} while(0)
#define NULL
Definition: array2.c:99
#define MAX_NUM_HBOND
Definition: secstr.c:91
#define COORD_DIM
Definition: secstr.c:88
#define NUM_STRUC_SYMS
Definition: secstr.c:131
void blFreeArray2D(char **array, int dim1, int dim2)
Definition: array2.c:174
#define NUM_BRIDGE_PAIR
Definition: secstr.c:106
#define NUM_MC_ATOM_TYPES
Definition: secstr.c:113
#define MAX_NUM_ANGLES
Definition: secstr.c:121
void blFreeArray3D(char ***array, int dim1, int dim2, int dim3)
Definition: array3.c:182

Definition at line 190 of file secstr.c.

#define HBOND_ENERGY_LIMIT   -9.9

Definition at line 169 of file secstr.c.

#define HBOND_F   332

Definition at line 173 of file secstr.c.

#define HBOND_MAX_CA_DIST   8.0

Definition at line 170 of file secstr.c.

#define HBOND_Q1   0.42

Definition at line 171 of file secstr.c.

#define HBOND_Q2   0.2

Definition at line 172 of file secstr.c.

#define HELIX_CHUNK_SIZE   4 /* Helices are made in chunks of this */

Definition at line 145 of file secstr.c.

#define MAX_CA_DISTANCE   5.0 /* maximum CA-CA distance */

Definition at line 162 of file secstr.c.

#define MAX_HBOND_ENERGY   -0.5

Definition at line 168 of file secstr.c.

#define MAX_NUM_ANGLES   7 /* number of angles calculated */

Definition at line 121 of file secstr.c.

#define MAX_NUM_CHN
Value:
200 /* number of allowed 'chains'; the way
the code is used, it should be handled
an individual chain, but it can also
cope with (up to 50) multiple chains
and has to allow this to deal with
apparent chain breaks resulting from
missing residues */

Definition at line 92 of file secstr.c.

#define MAX_NUM_HBOND   4 /* number of allowed H-bonds */

Definition at line 91 of file secstr.c.

#define MAX_PEPTIDE_BOND   2.5 /* maximum peptide bond length */

Definition at line 161 of file secstr.c.

#define MAXBUFF   160

Secondary structure calculation.

secstruc.c

Version
V1.1
Date
10.07.15
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

Usage:

Revision History:

V1.0 19.05.99 Original, written while at Inpharmatica By: ACRM V1.1 10.07.15 Modified for BiopLib 17.02.16 xyz for coordinates now count from zero CalcDihedral() also now uses arrays that count from zero 18.02.16 NUM_MC_ATOM_TYPES now counts from zero MAX_NUM_ANGLES now counts from zero

Definition at line 87 of file secstr.c.

#define NRULES   3

Definition at line 101 of file secstr.c.

#define NST   2

Definition at line 154 of file secstr.c.

#define NULLVAL   999.9 /* used as a NULL value */

Definition at line 159 of file secstr.c.

#define NUM_BRIDGE   4 /* Max bridge index */

Definition at line 104 of file secstr.c.

#define NUM_BRIDGE_PAIR   2 /* Paired strands for bridge */

Definition at line 106 of file secstr.c.

#define NUM_DIHED_DATA   3 /* number of dihedral data points */

Definition at line 108 of file secstr.c.

#define NUM_HELIX_TYPE   3 /* number of helix types */

Definition at line 144 of file secstr.c.

#define NUM_MC_ATOM_TYPES   6 /* number of M/C atom types */

Definition at line 113 of file secstr.c.

#define NUM_STANDARD_DIHEDRALS   4 /* number of standard dihedrals */

Definition at line 122 of file secstr.c.

#define NUM_STRAND_CHARS
Value:
26 /* number of available strand characters
(the 26 letters of the alphabet) */

Definition at line 89 of file secstr.c.

#define NUM_STRAND_PAIR   2 /* Paired strands */

Definition at line 105 of file secstr.c.

#define NUM_STRUC_SYMS   (11) /* number of structure symbols */

Definition at line 131 of file secstr.c.

#define NUM_TURN_TYPE   3 /* number of turn types */

Definition at line 156 of file secstr.c.

#define PARLEL   1

Definition at line 102 of file secstr.c.

#define PIH_CHUNK_SIZE   5 /* Pi helices in chunks of this */

Definition at line 147 of file secstr.c.

#define RADIAN   (180.0/3.141592) /* constant to convert RADs to degrees */

Definition at line 158 of file secstr.c.

#define RESTYPE_PROLINE
Value:
15 /* residue type number for Proline - an
offset into the KnownResidueTypes
array */

Definition at line 109 of file secstr.c.

#define SECSTR_IDX_ALPHAH   0 /* Symbol indexes */

Definition at line 132 of file secstr.c.

#define SECSTR_IDX_BEND   9

Definition at line 141 of file secstr.c.

#define SECSTR_IDX_BRIDG1   4

Definition at line 136 of file secstr.c.

#define SECSTR_IDX_BRIDG2   5

Definition at line 137 of file secstr.c.

#define SECSTR_IDX_BRIDGE   3

Definition at line 135 of file secstr.c.

#define SECSTR_IDX_CHISGN   10

Definition at line 142 of file secstr.c.

#define SECSTR_IDX_PIH   7

Definition at line 139 of file secstr.c.

#define SECSTR_IDX_SHEET   2

Definition at line 134 of file secstr.c.

#define SECSTR_IDX_SHEET1   1

Definition at line 133 of file secstr.c.

#define SECSTR_IDX_THRTNH   6

Definition at line 138 of file secstr.c.

#define SECSTR_IDX_TURN   8

Definition at line 140 of file secstr.c.

#define TESTCODE   1

Definition at line 1 of file secstr.c.

#define THREE_TEN_CHUNK_SIZE   3 /* 3_10 helices in chunks of this */

Definition at line 146 of file secstr.c.

Function Documentation

int blCalcSecStrucPDB ( PDB pdbStart,
PDB pdbStop,
BOOL  verbose 
)
Parameters
[in]*pdbStartStart of PDB linked list
[in]*pdbStopEnd of PDB linked list (NULL or pointer to start of next chain)
[in]verboseProvide informational messages
Returns
0 - success -ve - error (See SECSTR_ERR_xxxxx)

Calculate secondary structure populating the ss field of the PDB structure.

  • 19.05.99 Original By: ACRM
  • 27.05.99 Standard format for messages
  • 09.06.99 Warning only issued if not quiet
  • 10.07.15 Modified for BiopLib
  • 09.03.16 Zero-basing
  • 10.08.16 Completed zero-basing

Definition at line 315 of file secstr.c.