1 #ifndef DYNAMITEdnamatrixHEADERFILE 2 #define DYNAMITEdnamatrixHEADERFILE 3 #ifdef _cplusplus 4 extern "C" { 5 #endif 6 #include "dyna.h" 7 8 typedef enum NMaskType { 9 NMaskType_BASE, 10 NMaskType_VARIABLE, 11 NMaskType_EXCLUDED, 12 NMaskType_BANNED 13 } NMaskType; 14 15 #define DnaMatrix_MATCH(mat,one,two) (mat->score[one][two]) 16 17 struct Wise2_DnaProbMatrix { 18 int dynamite_hard_link; 19 #ifdef PTHREAD 20 pthread_mutex_t dynamite_mutex; 21 #endif 22 Probability prob[5][5]; 23 } ; 24 /* DnaProbMatrix defined */ 25 #ifndef DYNAMITE_DEFINED_DnaProbMatrix 26 typedef struct Wise2_DnaProbMatrix Wise2_DnaProbMatrix; 27 #define DnaProbMatrix Wise2_DnaProbMatrix 28 #define DYNAMITE_DEFINED_DnaProbMatrix 29 #endif 30 31 32 struct Wise2_DnaMatrix { 33 int dynamite_hard_link; 34 #ifdef PTHREAD 35 pthread_mutex_t dynamite_mutex; 36 #endif 37 Score score[5][5]; 38 } ; 39 /* DnaMatrix defined */ 40 #ifndef DYNAMITE_DEFINED_DnaMatrix 41 typedef struct Wise2_DnaMatrix Wise2_DnaMatrix; 42 #define DnaMatrix Wise2_DnaMatrix 43 #define DYNAMITE_DEFINED_DnaMatrix 44 #endif 45 46 47 48 49 /***************************************************/ 50 /* Callable functions */ 51 /* These are the functions you are expected to use */ 52 /***************************************************/ 53 54 55 56 /* Function: new_CompMat_from_DnaMatrix_flat(dm) 57 * 58 * Descrip: Builds a CompMat mapping of a DnaMatrix 59 * 60 * 61 * Arg: dm [UNKN ] Undocumented argument [DnaMatrix *] 62 * 63 * Return [UNKN ] Undocumented return value [CompMat *] 64 * 65 */ 66 CompMat * Wise2_new_CompMat_from_DnaMatrix_flat(DnaMatrix * dm); 67 #define new_CompMat_from_DnaMatrix_flat Wise2_new_CompMat_from_DnaMatrix_flat 68 69 70 /* Function: DnaProbMatrix_from_match(match,nmask_type) 71 * 72 * Descrip: Makes a probability matrix from simple match/mismatch 73 * probabilities. 74 * 75 * 76 * 77 * Arg: match [UNKN ] Undocumented argument [Probability] 78 * Arg: nmask_type [UNKN ] Undocumented argument [int] 79 * 80 * Return [UNKN ] Undocumented return value [DnaProbMatrix *] 81 * 82 */ 83 DnaProbMatrix * Wise2_DnaProbMatrix_from_match(Probability match,int nmask_type); 84 #define DnaProbMatrix_from_match Wise2_DnaProbMatrix_from_match 85 86 87 /* Function: flat_null_DnaProbMatrix(dpm) 88 * 89 * Descrip: makes a odds of dpm via a 0.25 factor 90 * into each base. 91 * 92 * 93 * Arg: dpm [UNKN ] Undocumented argument [DnaProbMatrix *] 94 * 95 */ 96 void Wise2_flat_null_DnaProbMatrix(DnaProbMatrix * dpm); 97 #define flat_null_DnaProbMatrix Wise2_flat_null_DnaProbMatrix 98 99 100 /* Function: DnaMatrix_from_DnaProbMatrix(dpm) 101 * 102 * Descrip: Maps probabilities to scores 103 * 104 * 105 * Arg: dpm [UNKN ] Undocumented argument [DnaProbMatrix *] 106 * 107 * Return [UNKN ] Undocumented return value [DnaMatrix *] 108 * 109 */ 110 DnaMatrix * Wise2_DnaMatrix_from_DnaProbMatrix(DnaProbMatrix * dpm); 111 #define DnaMatrix_from_DnaProbMatrix Wise2_DnaMatrix_from_DnaProbMatrix 112 113 114 /* Function: show_DnaMatrix(dcm,ofp) 115 * 116 * Descrip: Simple view of DnaMatrix 117 * 118 * 119 * Arg: dcm [UNKN ] Undocumented argument [DnaMatrix *] 120 * Arg: ofp [UNKN ] Undocumented argument [FILE *] 121 * 122 */ 123 void Wise2_show_DnaMatrix(DnaMatrix * dcm,FILE * ofp); 124 #define show_DnaMatrix Wise2_show_DnaMatrix 125 126 127 /* Function: show_DnaProbMatrix(dpm,ofp) 128 * 129 * Descrip: Simple view of DnaProbMatrix 130 * 131 * 132 * Arg: dpm [UNKN ] Undocumented argument [DnaProbMatrix *] 133 * Arg: ofp [UNKN ] Undocumented argument [FILE *] 134 * 135 */ 136 void Wise2_show_DnaProbMatrix(DnaProbMatrix * dpm,FILE * ofp); 137 #define show_DnaProbMatrix Wise2_show_DnaProbMatrix 138 139 140 /* Function: fail_safe_DnaMatrix_access(dm,one,two) 141 * 142 * Descrip: Run-time checked that one and two are ok to pass 143 * into dm as bases 144 * 145 * 146 * 147 * Arg: dm [UNKN ] DnaMatrix to get score from [DnaMatrix *] 148 * Arg: one [UNKN ] base of one sequence [base] 149 * Arg: two [UNKN ] base of the other sequence [base] 150 * 151 * Return [UNKN ] Undocumented return value [Score] 152 * 153 */ 154 Score Wise2_fail_safe_DnaMatrix_access(DnaMatrix * dm,base one,base two); 155 #define fail_safe_DnaMatrix_access Wise2_fail_safe_DnaMatrix_access 156 157 158 /* Function: identity_DnaMatrix(id_score,mismatch) 159 * 160 * Descrip: makes an idenity matrix wth id_score on the leading 161 * diagonal and mismatch elsewhere. 162 * 163 * 164 * 165 * Arg: id_score [UNKN ] score of idenities [Score] 166 * Arg: mismatch [UNKN ] score of mistmatches [Score] 167 * 168 * Return [UNKN ] Undocumented return value [DnaMatrix *] 169 * 170 */ 171 DnaMatrix * Wise2_identity_DnaMatrix(Score id_score,Score mismatch); 172 #define identity_DnaMatrix Wise2_identity_DnaMatrix 173 174 175 /* Function: hard_link_DnaProbMatrix(obj) 176 * 177 * Descrip: Bumps up the reference count of the object 178 * Meaning that multiple pointers can 'own' it 179 * 180 * 181 * Arg: obj [UNKN ] Object to be hard linked [DnaProbMatrix *] 182 * 183 * Return [UNKN ] Undocumented return value [DnaProbMatrix *] 184 * 185 */ 186 DnaProbMatrix * Wise2_hard_link_DnaProbMatrix(DnaProbMatrix * obj); 187 #define hard_link_DnaProbMatrix Wise2_hard_link_DnaProbMatrix 188 189 190 /* Function: DnaProbMatrix_alloc(void) 191 * 192 * Descrip: Allocates structure: assigns defaults if given 193 * 194 * 195 * 196 * Return [UNKN ] Undocumented return value [DnaProbMatrix *] 197 * 198 */ 199 DnaProbMatrix * Wise2_DnaProbMatrix_alloc(void); 200 #define DnaProbMatrix_alloc Wise2_DnaProbMatrix_alloc 201 202 203 /* Function: free_DnaProbMatrix(obj) 204 * 205 * Descrip: Free Function: removes the memory held by obj 206 * Will chain up to owned members and clear all lists 207 * 208 * 209 * Arg: obj [UNKN ] Object that is free'd [DnaProbMatrix *] 210 * 211 * Return [UNKN ] Undocumented return value [DnaProbMatrix *] 212 * 213 */ 214 DnaProbMatrix * Wise2_free_DnaProbMatrix(DnaProbMatrix * obj); 215 #define free_DnaProbMatrix Wise2_free_DnaProbMatrix 216 217 218 /* Function: hard_link_DnaMatrix(obj) 219 * 220 * Descrip: Bumps up the reference count of the object 221 * Meaning that multiple pointers can 'own' it 222 * 223 * 224 * Arg: obj [UNKN ] Object to be hard linked [DnaMatrix *] 225 * 226 * Return [UNKN ] Undocumented return value [DnaMatrix *] 227 * 228 */ 229 DnaMatrix * Wise2_hard_link_DnaMatrix(DnaMatrix * obj); 230 #define hard_link_DnaMatrix Wise2_hard_link_DnaMatrix 231 232 233 /* Function: DnaMatrix_alloc(void) 234 * 235 * Descrip: Allocates structure: assigns defaults if given 236 * 237 * 238 * 239 * Return [UNKN ] Undocumented return value [DnaMatrix *] 240 * 241 */ 242 DnaMatrix * Wise2_DnaMatrix_alloc(void); 243 #define DnaMatrix_alloc Wise2_DnaMatrix_alloc 244 245 246 /* Function: free_DnaMatrix(obj) 247 * 248 * Descrip: Free Function: removes the memory held by obj 249 * Will chain up to owned members and clear all lists 250 * 251 * 252 * Arg: obj [UNKN ] Object that is free'd [DnaMatrix *] 253 * 254 * Return [UNKN ] Undocumented return value [DnaMatrix *] 255 * 256 */ 257 DnaMatrix * Wise2_free_DnaMatrix(DnaMatrix * obj); 258 #define free_DnaMatrix Wise2_free_DnaMatrix 259 260 261 /* Unplaced functions */ 262 /* There has been no indication of the use of these functions */ 263 264 265 /***************************************************/ 266 /* Internal functions */ 267 /* you are not expected to have to call these */ 268 /***************************************************/ 269 270 #ifdef _cplusplus 271 } 272 #endif 273 274 #endif 275