cawlign 0.0.1
Codon-aware pairwise sequence alignment
Loading...
Searching...
No Matches
scoring.hpp
1#ifndef SCORING_H
2#define SCORING_H
3
4#include <iostream>
5#include "alignment.h"
6#include "argparse.hpp"
7#include "tn93_shared.h"
8
9using namespace std;
10using namespace argparse;
11
12
14 public:
16 const char * _alphabet,
17 const cawlign_fp * _scoring_matrix,
18 const cawlign_fp _open_gap_reference,
19 const cawlign_fp _open_gap_query,
20 const cawlign_fp _extend_gap_reference,
21 const cawlign_fp _extend_gap_query
22 );
23
25 CawalignSimpleScores (void) {D=0;};
26 virtual ~CawalignSimpleScores (void) {};
27
28 StringBuffer alphabet;
29 /*
30 ordered characters that are included in the scoring matrix
31 */
32 unsigned int D;
33 // the number of characters in the string
34
35 long char_map [255];
36 /*
37 for each ASCII character, this will map the character to the corresping entry the scoring matrix
38 all characters NOT in `alphabet` get mapped to index D (the 'not defined' character)
39 */
40
41 VectorFP scoring_matrix;
42 /*
43 A (D+1)x(D+1) scoring matrix where element (i,j) gives the score of matching (or mis-matching)
44 the D-th row/column is for matchign a character NOT in the alphabet
45 While generally symmetric, an asymmetric matrix can also be meaningful if there is some reason to have
46 substitutions in reference/query weigted differently
47 */
48
49 cawlign_fp open_gap_reference,
50 open_gap_query,
51 extend_gap_query,
52 extend_gap_reference;
53
54 char gap_char;
55 /* gap open and extend character*/
56
57 void _init_alphabet (long not_found = -1);
58
59};
60
62 public:
63
65 virtual ~CawalignCodonScores (void) {};
66
67 // compute how many nucleotides are different between the two codons encoded as 0-63 integers
68 static int nucleotide_diff (long, long);
69
70 Vector translation_table,
71 // codon (0-63 index) to single letter amino-acid code translation table
72 resolutions;
73 // an linear array of resolutions for ambiguous nucleotides
74 // if char_map[i] < -1, then indexing into this array using (-char_map[i]-2)*4 index will
75 // return a four integer map, with 0 indicating that the corresponding character is not in the resolution, and 1 - that it is
76
77 // partial score tables
78 VectorFP s3x1,
79 s3x2,
80 s3x4,
81 s3x5;
82
83 // the cost of introducing frameshits
84 cawlign_fp frameshift_cost,
85 // the penalty for synonymous substitutions, per nucleotide change
86 synonymous_penalty;
87
88 // ordered amino-acid scoring tables
89 StringBuffer amino_acids;
90
91 int stop_codon_index;
92 int mismatch_index;
93
94
95
96};
97
98
99extern const char kNucleotideAlphabet[];
100extern const cawlign_fp kNucScoring[];
101
102#endif
CawalignCodonScores(ConfigParser *, ConfigParser *)
Definition scoring.cpp:154
static int nucleotide_diff(long, long)
Definition scoring.cpp:128
CawalignSimpleScores(const char *_alphabet, const cawlign_fp *_scoring_matrix, const cawlign_fp _open_gap_reference, const cawlign_fp _open_gap_query, const cawlign_fp _extend_gap_reference, const cawlign_fp _extend_gap_query)
Definition scoring.cpp:52
void _init_alphabet(long not_found=-1)
Definition scoring.cpp:30
Definition configparser.hpp:32
A simple string buffer class that allows for dynamic resizing.
Definition stringBuffer.h:12
A simple vector class for floating point numbers that allows for dynamic resizing.
Definition stringBuffer.h:116
A simple vector class for long integers that allows for dynamic resizing.
Definition stringBuffer.h:189