1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
|
#ifndef DYNAMITEcodonmapperHEADERFILE
#define DYNAMITEcodonmapperHEADERFILE
#ifdef _cplusplus
extern "C" {
#endif
#include "codon.h"
/* Object CodonMapper
*
* Descrip: CodonMapper holds a matrix of 125 by 26
* to provide a mapping between a probabilities
* calculated on amino acids to triplet codon
* probabilities. This mapping takes into account
* 3 things
* 1) The CodonTable
* 2) The distribution of synonmous codons (codon bias)
* 3) substitution errors
*
*
*/
struct Wise2_CodonMapper {
int dynamite_hard_link;
#ifdef PTHREAD
pthread_mutex_t dynamite_mutex;
#endif
CodonTable * ct; /* hard-linked! */
double codon_map[125][26];
} ;
/* CodonMapper defined */
#ifndef DYNAMITE_DEFINED_CodonMapper
typedef struct Wise2_CodonMapper Wise2_CodonMapper;
#define CodonMapper Wise2_CodonMapper
#define DYNAMITE_DEFINED_CodonMapper
#endif
/* Object CodonFrequency
*
* Descrip: CodonFrequency is a very much internal object for
* CodonMapper. It provides the frequency of synomous
* codons, ie, an amino acid with only one codon will
* have 1.0 in the frequency table
*
* Rarely used outside of CodonMapper construction
*
*
*/
struct Wise2_CodonFrequency {
int dynamite_hard_link;
#ifdef PTHREAD
pthread_mutex_t dynamite_mutex;
#endif
double freq[64];
} ;
/* CodonFrequency defined */
#ifndef DYNAMITE_DEFINED_CodonFrequency
typedef struct Wise2_CodonFrequency Wise2_CodonFrequency;
#define CodonFrequency Wise2_CodonFrequency
#define DYNAMITE_DEFINED_CodonFrequency
#endif
/***************************************************/
/* Callable functions */
/* These are the functions you are expected to use */
/***************************************************/
/* Function: CodonFrequence_from_raw_counts(codon,ct)
*
* Descrip: Builds a codon frequency from raw counts as just an array
*
*
* Arg: codon [UNKN ] Undocumented argument [double *]
* Arg: ct [UNKN ] Undocumented argument [CodonTable *]
*
* Return [UNKN ] Undocumented return value [CodonFrequency *]
*
*/
CodonFrequency * Wise2_CodonFrequence_from_raw_counts(double * codon,CodonTable * ct);
#define CodonFrequence_from_raw_counts Wise2_CodonFrequence_from_raw_counts
/* Function: show_CodonMapper(cm,ofp)
*
* Descrip: Shows codon mapper in vaguely human form
*
*
* Arg: cm [UNKN ] Undocumented argument [CodonMapper *]
* Arg: ofp [UNKN ] Undocumented argument [FILE *]
*
*/
void Wise2_show_CodonMapper(CodonMapper * cm,FILE * ofp);
#define show_CodonMapper Wise2_show_CodonMapper
/* Function: show_CodonFrequency(cf,ct,ofp)
*
* Descrip: Shows codon frequency in vaguely human form
*
*
* Arg: cf [UNKN ] Undocumented argument [CodonFrequency *]
* Arg: ct [UNKN ] Undocumented argument [CodonTable *]
* Arg: ofp [UNKN ] Undocumented argument [FILE *]
*
*/
void Wise2_show_CodonFrequency(CodonFrequency * cf,CodonTable * ct,FILE * ofp);
#define show_CodonFrequency Wise2_show_CodonFrequency
/* Function: flat_CodonMapper(ct)
*
* Descrip: Makes a CodonMapper with no codon bias
* or error possiblities from codon table
*
*
*
* Arg: ct [UNKN ] Codon Table giving codon->aa info [CodonTable *]
*
* Return [UNKN ] Undocumented return value [CodonMapper *]
*
*/
CodonMapper * Wise2_flat_CodonMapper(CodonTable * ct);
#define flat_CodonMapper Wise2_flat_CodonMapper
/* Function: flat_CodonFrequency(ct)
*
* Descrip: Makes a no-biased codon Frequency.
* Probabaly most used in /flat_CodonMapper
*
*
*
* Arg: ct [UNKN ] Undocumented argument [CodonTable *]
*
* Return [UNKN ] Undocumented return value [CodonFrequency *]
*
*/
CodonFrequency * Wise2_flat_CodonFrequency(CodonTable * ct);
#define flat_CodonFrequency Wise2_flat_CodonFrequency
/* Function: true_map_codon_array_CodonMapper(codon_array,protein_array,cm)
*
* Descrip: Takes an array of probabilities from 0-26 in protein array
* and writes into codon_array the adjusted probability from the
* codon mapper. Ie, maps a protein emission line to a codon emission
* line. This is the main use of CodonMapper.
*
*
*
* Arg: codon_array [WRITE] array (0-124) for the codon probabilities to be placed [double *]
* Arg: protein_array [READ ] array (0-25) for the protein probabilities to be read from [const double *]
* Arg: cm [UNKN ] Codon Mapper that provides the protein->codon mapping [CodonMapper *]
*
*/
void Wise2_true_map_codon_array_CodonMapper(double * codon_array,const double * protein_array,CodonMapper * cm);
#define true_map_codon_array_CodonMapper Wise2_true_map_codon_array_CodonMapper
/* Function: sprinkle_errors_over_CodonMapper(cm,error)
*
* Descrip: Takes a codon mapper and assummes that the majority of errors
* are due to a single base change in the codon at probability error.
* Therefore, for each codon it adds error * prob(codon) * 0.25 to each
* other codon one base away, taking away therefore the result.
*
*
*
* Arg: cm [READ ] CodonMapper to be sprinkled [CodonMapper *]
* Arg: error [UNKN ] substitution error rate [double]
*
*/
void Wise2_sprinkle_errors_over_CodonMapper(CodonMapper * cm,double error);
#define sprinkle_errors_over_CodonMapper Wise2_sprinkle_errors_over_CodonMapper
/* Function: new_CodonMapper(ct,cf)
*
* Descrip: The only way you should make a CodonMapper!
*
* Makes a codon mapper from CodonTable and frequency
*
*
* Arg: ct [UNKN ] Undocumented argument [CodonTable *]
* Arg: cf [UNKN ] Undocumented argument [CodonFrequency *]
*
* Return [UNKN ] Undocumented return value [CodonMapper *]
*
*/
CodonMapper * Wise2_new_CodonMapper(CodonTable * ct,CodonFrequency * cf);
#define new_CodonMapper Wise2_new_CodonMapper
/* Function: hard_link_CodonMapper(obj)
*
* Descrip: Bumps up the reference count of the object
* Meaning that multiple pointers can 'own' it
*
*
* Arg: obj [UNKN ] Object to be hard linked [CodonMapper *]
*
* Return [UNKN ] Undocumented return value [CodonMapper *]
*
*/
CodonMapper * Wise2_hard_link_CodonMapper(CodonMapper * obj);
#define hard_link_CodonMapper Wise2_hard_link_CodonMapper
/* Function: CodonMapper_alloc(void)
*
* Descrip: Allocates structure: assigns defaults if given
*
*
*
* Return [UNKN ] Undocumented return value [CodonMapper *]
*
*/
CodonMapper * Wise2_CodonMapper_alloc(void);
#define CodonMapper_alloc Wise2_CodonMapper_alloc
/* Function: free_CodonMapper(obj)
*
* Descrip: Free Function: removes the memory held by obj
* Will chain up to owned members and clear all lists
*
*
* Arg: obj [UNKN ] Object that is free'd [CodonMapper *]
*
* Return [UNKN ] Undocumented return value [CodonMapper *]
*
*/
CodonMapper * Wise2_free_CodonMapper(CodonMapper * obj);
#define free_CodonMapper Wise2_free_CodonMapper
/* Function: hard_link_CodonFrequency(obj)
*
* Descrip: Bumps up the reference count of the object
* Meaning that multiple pointers can 'own' it
*
*
* Arg: obj [UNKN ] Object to be hard linked [CodonFrequency *]
*
* Return [UNKN ] Undocumented return value [CodonFrequency *]
*
*/
CodonFrequency * Wise2_hard_link_CodonFrequency(CodonFrequency * obj);
#define hard_link_CodonFrequency Wise2_hard_link_CodonFrequency
/* Function: CodonFrequency_alloc(void)
*
* Descrip: Allocates structure: assigns defaults if given
*
*
*
* Return [UNKN ] Undocumented return value [CodonFrequency *]
*
*/
CodonFrequency * Wise2_CodonFrequency_alloc(void);
#define CodonFrequency_alloc Wise2_CodonFrequency_alloc
/* Function: free_CodonFrequency(obj)
*
* Descrip: Free Function: removes the memory held by obj
* Will chain up to owned members and clear all lists
*
*
* Arg: obj [UNKN ] Object that is free'd [CodonFrequency *]
*
* Return [UNKN ] Undocumented return value [CodonFrequency *]
*
*/
CodonFrequency * Wise2_free_CodonFrequency(CodonFrequency * obj);
#define free_CodonFrequency Wise2_free_CodonFrequency
/* Unplaced functions */
/* There has been no indication of the use of these functions */
/***************************************************/
/* Internal functions */
/* you are not expected to have to call these */
/***************************************************/
CodonTable * Wise2_access_ct_CodonMapper(CodonMapper * obj);
#define access_ct_CodonMapper Wise2_access_ct_CodonMapper
boolean Wise2_replace_ct_CodonMapper(CodonMapper * obj,CodonTable * ct);
#define replace_ct_CodonMapper Wise2_replace_ct_CodonMapper
void Wise2_construct_amino_number_array(int * number,CodonTable * ct);
#define construct_amino_number_array Wise2_construct_amino_number_array
void Wise2_map_codon_array_CodonMapper(double * codon_array,double * protein_array,double stop,CodonMapper * cm);
#define map_codon_array_CodonMapper Wise2_map_codon_array_CodonMapper
double Wise2_map_codon_CodonMapper(int codon,const double * protein_array,CodonMapper * cm);
#define map_codon_CodonMapper Wise2_map_codon_CodonMapper
#ifdef _cplusplus
}
#endif
#endif
|