Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
FindAtomWildcardInRes.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file FindAtomWildcardInRes.c
5 
6  \version V1.1
7  \date 07.07.14
8  \brief Find an atom within a residue allowing wild cards
9 
10  \copyright (c) Dr. Andrew C. R. Martin, UCL, 1996-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 27.08.96 Original moved from mutmodel By: ACRM
50 - V1.1 07.07.14 Use bl prefix for functions By: CTP
51 
52 
53 *************************************************************************/
54 /* Doxygen
55  -------
56  #GROUP Handling PDB Data
57  #SUBGROUP Searching the PDB linked list
58  #FUNCTION blFindAtomWildcardInRes()
59  Finds an atom within the residue given as a PDB pointer. Allows
60  single character wildcards. Thus ?G? maybe used for any atom at the
61  gamma position.
62 */
63 /************************************************************************/
64 /* Includes
65 */
66 #include "pdb.h"
67 #include "macros.h"
68 
69 /************************************************************************/
70 /* Defines and macros
71 */
72 
73 /************************************************************************/
74 /* Globals
75 */
76 
77 /************************************************************************/
78 /* Prototypes
79 */
80 
81 /************************************************************************/
82 /*>PDB *blFindAtomWildcardInRes(PDB *pdb, char *pattern)
83  -----------------------------------------------------
84 *//**
85 
86  \param[in] *pdb Pointer to start of a residue
87  \param[in] *pattern Atom name pattern to find
88  \return Pointer to requested atom or NULL if not
89  found.
90 
91  Finds an atom within the residue given as a PDB pointer. Allows
92  single character wildcards. Thus ?G? maybe used for any atom at the
93  gamma position.
94 
95  Returns the first atom which matches
96 
97 - 27.08.96 Original By: ACRM
98 - 07.07.14 Use bl prefix for functions By: CTP
99 */
100 PDB *blFindAtomWildcardInRes(PDB *pdb, char *pattern)
101 {
102  PDB *p, *pNext;
103  int i;
104  BOOL ok;
105 
106  pNext = blFindNextResidue(pdb);
107 
108  for(p=pdb; p!=pNext; NEXT(p))
109  {
110  if(!strncmp(p->atnam,pattern,4))
111  return(p);
112  ok = TRUE;
113  for(i=0; i<4; i++)
114  {
115  if((pattern[i] != p->atnam[i]) && pattern[i] != '?')
116  {
117  ok = FALSE;
118  break;
119  }
120  }
121  if(ok)
122  return(p);
123  }
124  return(NULL);
125 }
126 
127 
128 
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
PDB * blFindAtomWildcardInRes(PDB *pdb, char *pattern)
#define TRUE
Definition: macros.h:219
PDB * blFindNextResidue(PDB *pdb)