The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
FindResidue.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file FindResidue.c
5 
6  \version V1.11
7  \date 07.07.14
8  \brief Parse a residue specification
9 
10  \copyright (c) UCL / Dr. Andrew C. R. Martin 1993-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 01.03.94 Original
50 - V1.1 07.07.95 Now non-destructive
51 - V1.2 17.07.95 Now checks that a number was specified as part of the
52  spec. and returns a BOOL
53 - V1.3 23.10.95 Moved FindResidueSpec() from PDBList.c
54 - V1.4 08.02.96 Added FindResidue() and changed FindResidueSpec() to
55  use it
56 - V1.5 23.07.96 Added AtomNameMatch() and LegalAtomSpec()
57 - V1.6 18.03.98 Added option to include a . to separate chain and
58  residue number so numeric chain names can be used
59 - V1.7 11.10.99 Allow a . to be used to start a number (such that the
60  default blank chain name is used). Allows negative
61  residue numbers
62 - V1.8 24.02.14 Added BiopFindResidue(). By: CTP
63 - V1.9 25.02.14 Added error message for FindResidue(). By: CTP
64 - V1.10 07.05.14 Moved FindResidue() to deprecated.h. By: CTP
65 - V1.11 07.07.14 Use bl prefix for functions By: CTP
66 
67 
68 *************************************************************************/
69 /* Doxygen
70  -------
71  #GROUP Handling PDB Data
72  #SUBGROUP Searching the PDB linked list
73  #FUNCTION blFindResidue()
74  Finds a pointer to the start of a residue in a PDB linked list.
75 */
76 /************************************************************************/
77 /* Includes
78 */
79 #include <ctype.h>
80 #include <stdio.h>
81 #include <string.h>
82 
83 #include "macros.h"
84 #include "SysDefs.h"
85 #include "pdb.h"
86 
87 /************************************************************************/
88 /* Defines and macros
89 */
90 
91 /************************************************************************/
92 /* Globals
93 */
94 
95 /************************************************************************/
96 /* Prototypes
97 */
98 
99 
100 /************************************************************************/
101 /*>PDB *blFindResidue(PDB *pdb, char *chain, int resnum, char *insert)
102  --------------------------------------------------------------------
103 *//**
104  \param[in] pdb PDB linked list
105  \param[in] chain Chain label
106  \param[in] resnum Residue number
107  \param[in] insert Insert code
108  \return Pointer to start of specified residue
109 
110  Finds a pointer to the start of a residue in a PDB linked list.
111  Uses string for chain and insert.
112 
113 - 24.02.14 Original By: CTP
114 - 07.07.14 Renamed to blFindResidue()
115  Use bl prefix for functions By: CTP
116 */
117 PDB *blFindResidue(PDB *pdb, char *chain, int resnum, char *insert)
118 {
119  PDB *p;
120 
121  for(p=pdb; p!=NULL; NEXT(p))
122  {
123  if((p->resnum == resnum) &&
124  !strcmp(p->insert,insert) &&
125  CHAINMATCH(p->chain,chain))
126  return(p);
127  }
128 
129  return(NULL);
130 }
Include file for PDB routines.
int resnum
Definition: pdb.h:310
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
#define NEXT(x)
Definition: macros.h:249
Useful macros.
PDB * blFindResidue(PDB *pdb, char *chain, int resnum, char *insert)
Definition: FindResidue.c:117
#define CHAINMATCH(chain1, chain2)
Definition: pdb.h:495
System-type variable type definitions.
char chain[blMAXCHAINLABEL]
Definition: pdb.h:321
char insert[8]
Definition: pdb.h:320