1 /* @include embprop ***********************************************************
2 **
3 ** Residue/sequence properties
4 **
5 ** @author Copyright (c) 1999 Alan Bleasby
6 ** @version $Revision: 1.28 $
7 ** @modified 24 Nov 1999 - GWW - Added embPropProtGaps and embPropProt1to3
8 ** @modified 1 Sept 2000 - GWW - Added embPropTransition embPropTranversion
9 ** @modified 4 July 2001 - DMAM - Modified embPropAminoRead embPropCalcMolwt
10 ** @modified 4 July 2001 - DMAM - Added embPropCalcMolwtMod
11 ** @modified 1 July 2008 - JISON - Added embPropGet* functions
12 ** @modified $Date: 2011/10/18 14:24:25 $ by $Author: rice $
13 ** @@
14 **
15 ** This library is free software; you can redistribute it and/or
16 ** modify it under the terms of the GNU Lesser General Public
17 ** License as published by the Free Software Foundation; either
18 ** version 2.1 of the License, or (at your option) any later version.
19 **
20 ** This library is distributed in the hope that it will be useful,
21 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 ** Lesser General Public License for more details.
24 **
25 ** You should have received a copy of the GNU Lesser General Public
26 ** License along with this library; if not, write to the Free Software
27 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
28 ** MA  02110-1301,  USA.
29 **
30 ******************************************************************************/
31 
32 #ifndef EMBPROP_H
33 #define EMBPROP_H
34 
35 /* ========================================================================= */
36 /* ============================= include files ============================= */
37 /* ========================================================================= */
38 
39 #include "ajdefine.h"
40 #include "ajstr.h"
41 #include "ajfile.h"
42 #include "ajlist.h"
43 #include "ajseqdata.h"
44 
45 AJ_BEGIN_DECLS
46 
47 
48 
49 
50 /* ========================================================================= */
51 /* =============================== constants =============================== */
52 /* ========================================================================= */
53 
54 
55 
56 
57 #define EMBPROPSIZE 29
58 #define EMBPROPMOLWT      0
59 #define EMBEMBPROPTINY    1
60 #define EMBPROPSMALL      2
61 #define EMBPROPALIPHATIC  3
62 #define EMBPROPAROMATIC   4
63 #define EMBPROPNONPOLAR   5
64 #define EMBPROPPOLAR      6
65 #define EMBPROPCHARGE     7
66 #define EMBPROPPOSITIVE   8
67 #define EMBPROPNEGATIVE   9
68 #define EMBPROPABSORBANCE 10
69 
70 #define EMBPROPHINDEX 26
71 #define EMBPROPOINDEX 27
72 #define EMBPROPWINDEX 28
73 
74 /* define monoisotopic masses for common N- and C- terminal modifications
75 **
76 **Values from Expasy
77 **
78 **http://www.expasy.org/tools/findmod/findmod_masses.html
79 */
80 
81 #define EMBPROPMSTN_H       1.00783
82 #define EMBPROPMSTN_FORMYL 29.01823
83 #define EMBPROPMSTN_ACETYL 43.04013
84 
85 #define EMBPROPMSTC_OH     17.00274
86 #define EMBPROPMSTC_AMIDE  16.01804
87 
88 
89 
90 
91 /* ========================================================================= */
92 /* ============================== public data ============================== */
93 /* ========================================================================= */
94 
95 
96 
97 
98 /* @data EmbPPropAmino ********************************************************
99 **
100 ** Amino acid properties
101 **
102 ** @attr tiny [ajint] tiny
103 ** @attr sm_all [ajint] small
104 ** @attr aliphatic [ajint] aliphatic
105 ** @attr aromatic [ajint] aromatic
106 ** @attr nonpolar [ajint] non-polar
107 ** @attr polar [ajint] polar
108 ** @attr charge [float] charge
109 ** @attr pve [ajint] positive
110 ** @attr nve [ajint] negative
111 ** @attr extcoeff [ajint] extinction coefficient
112 ** @attr Padding [char[4]] padding to alignment boundary
113 ** @@
114 ******************************************************************************/
115 
116 typedef struct EmbSPropAmino
117 {
118     ajint     tiny;
119     ajint     sm_all;
120     ajint     aliphatic;
121     ajint     aromatic;
122     ajint     nonpolar;
123     ajint     polar;
124     float     charge;
125     ajint     pve;
126     ajint     nve;
127     ajint     extcoeff;
128     char      Padding[4];
129 } EmbOPropAmino;
130 #define EmbPPropAmino EmbOPropAmino*
131 
132 
133 
134 
135 /* @data EmbPPropMolwt ********************************************************
136 **
137 ** Molecular weights
138 **
139 ** @attr average [double] average molwt
140 ** @attr mono [double] monoisotopic molwt
141 ** @@
142 ******************************************************************************/
143 
144 typedef struct EmbSPropMolwt
145 {
146     double average;
147     double mono;
148 } EmbOPropMolwt;
149 #define EmbPPropMolwt EmbOPropMolwt*
150 
151 
152 
153 
154 typedef struct EmbSPropFrag	/* Enzyme digestion structure */
155 {
156     ajint     start;
157     ajint     end;
158     double    molwt;
159     AjBool    isfrag;
160     char      Padding[4];
161 } EmbOPropFrag;
162 #define EmbPPropFrag EmbOPropFrag*
163 
164 
165 
166 
167 /* ========================================================================= */
168 /* =========================== public functions ============================ */
169 /* ========================================================================= */
170 
171 
172 
173 /*
174 ** Prototype definitions
175 */
176 
177 EmbPPropAmino *embPropEaminoRead(AjPFile fp);
178 EmbPPropMolwt *embPropEmolwtRead(AjPFile fp);
179 void          embPropAminoDel(EmbPPropAmino **thys);
180 void          embPropMolwtDel(EmbPPropMolwt **thys);
181 
182 float embPropMolwtGetMolwt(const EmbPPropMolwt prop);
183 float embPropGetCharge(const EmbPPropAmino prop);
184 AjBool embPropGetProperties(const EmbPPropAmino prop, AjPStr* Pstr);
185 ajint embPropGetTiny(const EmbPPropAmino prop);
186 ajint embPropGetSmall(const EmbPPropAmino prop);
187 ajint embPropGetAliphatic(const EmbPPropAmino prop);
188 ajint embPropGetAromatic(const EmbPPropAmino prop);
189 ajint embPropGetNonpolar(const EmbPPropAmino prop);
190 ajint embPropGetPolar(const EmbPPropAmino prop);
191 ajint embPropGetPve(const EmbPPropAmino prop);
192 ajint embPropGetNve(const EmbPPropAmino prop);
193 ajint embPropGetExtcoeff(const EmbPPropAmino prop);
194 
195 
196 
197 /* void    embPropAminoRead (void); */
198 void 	embPropCalcFragments (const char *s, ajint n,
199 			      AjPList *l, AjPList *pa,
200 			      AjBool unfavoured, AjBool overlap,
201 			      AjBool allpartials, ajint *ncomp, ajint *npart,
202 			      AjPStr *rname, AjBool nterm, AjBool cterm,
203 			      AjBool dorag, EmbPPropMolwt const  *mwdata,
204 			      AjBool mono);
205 double  embPropCalcMolextcoeff(const char *s, ajint start, ajint end,
206 			       AjBool cystine, EmbPPropAmino const *aadata);
207 double  embPropCalcMolwt (const char *s, ajint start, ajint end,
208 			  EmbPPropMolwt const *mwdata, AjBool mono);
209 /* new method for chemically modified ends */
210 double  embPropCalcMolwtMod (const char *s, ajint start, ajint end,
211 			     EmbPPropMolwt const *mwdata, AjBool mono,
212 			     double nmass, double cmass);
213 const char*   embPropCharToThree (char c);
214 
215 void    embPropFixF(float matrix[], float missing);
216 const char*   embPropIntToThree (ajint c);
217 void    embPropNormalF(float matrix[], float missing);
218 AjPStr  embPropProtGaps (AjPSeq seq, ajint pad);
219 AjPStr  embPropProt1to3 (AjPSeq seq, ajint pad);
220 AjPStr  embPropProt1to3Rev (AjPSeq seq, ajint pad);
221 AjBool  embPropPurine (char base);
222 AjBool  embPropPyrimidine (char base);
223 AjBool  embPropTransversion (char base1, char base2);
224 AjBool  embPropTransition (char base1, char base2);
225 
226 /*
227 ** End of prototype definitions
228 */
229 
230 AJ_END_DECLS
231 
232 #endif  /* !EMBPROP_H */
233