The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
TermPDB.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file TermPDB.c
5 
6  \version V1.12
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 04.02.14 Use CHAINMATCH macro. By: CTP
61 - V1.12 07.07.14 Use bl prefix for functions By: CTP
62 
63 *************************************************************************/
64 /* Doxygen
65  -------
66  #GROUP Handling PDB Data
67  #SUBGROUP Manipulating the PDB linked list
68  #FUNCTION blTermPDB()
69  Terminate a PDB linked list after length residues, returning a pointer
70  to the next residue.
71 */
72 /************************************************************************/
73 /* Includes
74 */
75 #include "pdb.h"
76 #include "macros.h"
77 
78 /************************************************************************/
79 /* Defines and macros
80 */
81 
82 /************************************************************************/
83 /* Globals
84 */
85 
86 /************************************************************************/
87 /* Prototypes
88 */
89 
90 
91 /************************************************************************/
92 /*>PDB *blTermPDB(PDB *pdb, int length)
93  ----------------------------------
94 *//**
95 
96  \param[in] *pdb PDB linked list
97  \param[in] length Number of residues after which to terminate
98  \return Pointer to next residue after terminated
99  list. NULL if not enough residues in linked
100  list.
101 
102  Terminate a PDB linked list after length residues, returning a pointer
103  to the next residue.
104 
105  Note that the number of residues may cross chain boundaries.
106 
107 - 06.07.95 Original By: ACRM
108 - 26.09.95 Corrected update of resnum etc to use p-> not pdb-> (!!)
109 - 04.02.14 Use CHAINMATCH macro. By: CTP
110 - 07.07.14 Use bl prefix for functions By: CTP
111 */
112 PDB *blTermPDB(PDB *pdb, int length)
113 {
114  int resnum,
115  count;
116  char insert,
117  chain[8];
118  PDB *p,
119  *prev = NULL;
120 
121  resnum = pdb->resnum;
122  insert = pdb->insert[0];
123  strcpy(chain,pdb->chain);
124 
125  for(p=pdb, count=1; p!=NULL; NEXT(p))
126  {
127  if((p->resnum != resnum) ||
128  !CHAINMATCH(p->chain,chain) ||
129  (p->insert[0] != insert))
130  {
131  if(++count > length)
132  {
133  prev->next = NULL;
134  return(p);
135  }
136 
137  resnum = p->resnum;
138  insert = p->insert[0];
139  strcpy(chain,p->chain);
140  }
141  prev = p;
142  }
143 
144  return(NULL);
145 }
146 
147 
Include file for PDB routines.
int resnum
Definition: pdb.h:310
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
int length
Definition: safemem.c:117
struct _memlist * prev
Definition: safemem.c:115
#define NEXT(x)
Definition: macros.h:249
Useful macros.
PDB * blTermPDB(PDB *pdb, int length)
Definition: TermPDB.c:112
#define CHAINMATCH(chain1, chain2)
Definition: pdb.h:495
struct pdb_entry * next
Definition: pdb.h:307
char chain[blMAXCHAINLABEL]
Definition: pdb.h:321
char insert[8]
Definition: pdb.h:320