Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
KillSidechain.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file KillSidechain.c
5 
6  \version V1.11
7  \date 07.07.14
8  \brief
9 
10  \copyright (c) UCL / Dr. Andrew C. R. Martin 1992-2014
11  \author Dr. Andrew C. R. Martin
12  \par
13  Institute of Structural & Molecular Biology,
14  University College London,
15  Gower Street,
16  London.
17  WC1E 6BT.
18  \par
19  andrew@bioinf.org.uk
20  andrew.martin@ucl.ac.uk
21 
22 **************************************************************************
23 
24  This code is NOT IN THE PUBLIC DOMAIN, but it may be copied
25  according to the conditions laid out in the accompanying file
26  COPYING.DOC.
27 
28  The code may be modified as required, but any modifications must be
29  documented so that the person responsible can be identified.
30 
31  The code may not be sold commercially or included as part of a
32  commercial product except as described in the file COPYING.DOC.
33 
34 **************************************************************************
35 
36  Description:
37  ============
38 
39 
40 **************************************************************************
41 
42  Usage:
43  ======
44 
45 **************************************************************************
46 
47  Revision History:
48  =================
49 - V1.0 22.02.94 Original release
50 - V1.1 23.05.94 Added FindNextChainPDB()
51 - V1.2 05.10.94 KillSidechain() uses BOOL rather than int
52 - V1.3 24.07.95 Added TermPDB()
53 - V1.4 25.07.95 Added GetPDBChainLabels()
54 - V1.5 26.09.95 Fixed bug in TermPDB()
55 - V1.6 12.10.95 Added DupePDB(), CopyPDBCoords()
56 - V1.7 23.10.95 Moved FindResidueSpec() to ParseRes.c
57 - V1.8 10.01.96 Added ExtractZonePDB()
58 - V1.9 14.03.96 Added FindAtomInRes()
59 - V1.10 08.10.99 Initialised some variables
60 - V1.11 07.07.14 Use bl prefix for functions By: CTP
61 
62 *************************************************************************/
63 /* Doxygen
64  -------
65  #GROUP Handling PDB Data
66  #SUBGROUP Modifying the structure
67  #FUNCTION blKillSidechain()
68  Remove sidechain atoms, optionally removing the CBeta
69 */
70 /************************************************************************/
71 /* Includes
72 */
73 #include <stdlib.h>
74 
75 #include "SysDefs.h"
76 #include "pdb.h"
77 #include "macros.h"
78 
79 /************************************************************************/
80 /* Defines and macros
81 */
82 
83 /************************************************************************/
84 /* Globals
85 */
86 
87 /************************************************************************/
88 /* Prototypes
89 */
90 
91 
92 /************************************************************************/
93 /*>BOOL blKillSidechain(PDB *ResStart, PDB *NextRes, BOOL doCB)
94  ------------------------------------------------------------
95 *//**
96 
97  \param[in] *ResStart Start of a residue in linked list
98  \param[in] *NextRes Start of next residue
99  \param[in] doCB Flag to kill CB as part of s/c
100  \return Success?
101 
102  Kills sidechains by calls to KillPDB() for residues between ResStart
103  and NextRes. If doCB is set, will kill the CB.
104 
105  N.B. At least 1 backbone atom must occur in the linked list before the
106  sidechain.
107 
108 - 12.05.92 Original
109 - 05.10.94 doCB is now a BOOL as is the return
110 */
111 BOOL blKillSidechain(PDB *ResStart, /* Pointer to start of residue */
112  PDB *NextRes, /* Pointer to start if next residue */
113  BOOL doCB) /* Flag to kill the CB */
114 {
115  PDB *p,
116  *prev = NULL;
117 
118  for(p=ResStart; p && p!=NextRes; NEXT(p))
119  {
120  if(strcmp(p->atnam, "N ") &&
121  strcmp(p->atnam, "CA ") &&
122  strcmp(p->atnam, "C ") &&
123  strcmp(p->atnam, "O ") &&
124  strcmp(p->atnam, "CB "))
125  {
126  if(prev == NULL) return(FALSE); /* No b/b atom before s/c */
127 
128  /* blKillPDB() returns the next in list, so exit if list ended */
129  if(blKillPDB(p, prev) == NULL) break;
130  p = prev;
131  }
132 
133  /* Kill the CB if required */
134  if(doCB && !strcmp(p->atnam,"CB "))
135  {
136  if(prev == NULL) return(FALSE); /* No b/b atom before s/c */
137 
138  /* blKillPDB() returns the next in list, so exit if list ended */
139  if(blKillPDB(p, prev) == NULL) break;
140  p = prev;
141  }
142 
143  prev = p;
144  }
145  return(TRUE);
146 }
147 
PDB * blKillPDB(PDB *pdb, PDB *prev)
Definition: KillPDB.c:214
Include file for PDB routines.
short BOOL
Definition: SysDefs.h:64
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
#define FALSE
Definition: macros.h:223
#define NEXT(x)
Definition: macros.h:249
Useful macros.
char atnam[8]
Definition: pdb.h:316
#define TRUE
Definition: macros.h:219
BOOL blKillSidechain(PDB *ResStart, PDB *NextRes, BOOL doCB)
System-type variable type definitions.