13#include "vitmatrix.hh"
24#define SHIFT_SIZE (sizeof (signed char)*8)
25#define SHIFT_LEFT(x) ((x) << SHIFT_SIZE)
26#define SHIFT_RIGHT(x) ((x) >> SHIFT_SIZE)
27#define MAX_STATECOUNT SHIFT_LEFT(1)
38 return SHIFT_LEFT (substate.fullId()) + state;
40inline void getStatePair(
int fullState,
int& state,
SubstateId& substate) {
41 state = (
signed char)(fullState);
42 substate.set(SHIFT_RIGHT(fullState -state));
52 Ancestor(
int newpos=0,
Double newval=0.0) : pos(newpos), val(newval) {}
72 virtual void registerPars(
Parameters* parameters) {}
73 virtual void buildModel(
const AnnoSequence* annoseq,
int parIndex) =0;
74 virtual void printProbabilities(
int zusNumber=1,
BaseCount *bc = NULL,
const char* suffix = NULL) =0;
75 virtual StateType getStateType()
const = 0;
78 virtual Double emiProbUnderModel(
int ,
int)
const = 0;
80 virtual void updateToLocalGCEach(
Matrix<Double>& trans,
int cur) { };
86 static void determineShortPatterns(
const vector<Integer>& patcounts,
int k,
int minCount);
87 static void makeProbsFromCounts(vector<Double > &patprobs ,
const vector<Integer > &patcounts,
88 int k,
Double pseudocount, Boolean shorten =
false);
89 static void computeEmiFromPat(
const vector<Double>& patprobs, vector<Double>& emiprobs, Integer k);
90 static void prepareViterbi(
const char* dna,
int len,
const vector<StateType> &stateMap);
91 static void readProbabilities(
int);
92 static void resetPars();
94 static void updateToLocalGC(
int idx,
int from = -1,
int to = -1);
95 static void readAllParameters();
96 static void storeGCPars(
int);
97 static void resetModelCounts();
98 static bool isPossibleDSS(
int pos) {
99 return pos >= 1 && pos <= dnalen-2 &&
100 (onGenDSS(sequence + pos) ||
101 seqFeatColl->isHintedDSS(pos, plusstrand));
103 static bool isPossibleRDSS(
int pos) {
104 return pos >= 1 && pos <= dnalen-2 &&
105 (onGenRDSS(sequence + pos -1) ||
106 seqFeatColl->isHintedDSS(pos, minusstrand));
108 static bool isPossibleASS(
int pos) {
109 return pos >= 1 && pos <= dnalen-2 &&
110 (onASS(sequence + pos -1) ||
111 seqFeatColl->isHintedASS(pos, plusstrand));
113 static bool isPossibleRASS(
int pos) {
114 return pos >= 1 && pos <= dnalen-2 &&
115 (onRASS(sequence + pos) ||
116 seqFeatColl->isHintedASS(pos, minusstrand));
124 static void setCountRegion(
int from,
int to){countStart = from; countEnd = to;}
125 static int getActiveWindowStart(
int);
126 static void setGCIdx(
int idx) {gcIdx = idx;}
127 static void setContentStairs(
ContentStairs *stairs) {cs = stairs;}
128 static int getGCIdx(
int at){
if (cs)
return cs->idx[at];
else return -1;}
131 vector<Ancestor> ancestor;
134 static const vector<StateType>* stateMap;
135 static const char* sequence;
138 static vector<Boolean>* shortpattern;
140 static int countStart, countEnd;
141 static int activeWinLen;
172 Double getProb(
int base,
int &partlen);
184 SnippetProbs(
const char* dna,
int k,
bool forwardStrand=
true){
187 this->forwardStrand = forwardStrand;
193 for (
int i=0; i<n; i++)
194 snippetlist[i] = NULL;
196 Double getSeqProb(
int base,
int len);
199 for (
int i=0; i<n; i++) {
201 delete snippetlist[i]->first;
202 delete snippetlist[i];
205 delete [] snippetlist;
208 void setEmiProbs(vector<Double> *emiprobs) {
209 this->emiprobs = emiprobs;
212 void addProb(
int base,
int len,
Double p);
217 vector<Double> *emiprobs;
222 Double getElemSeqProb(
int base,
int len);
234 SegProbs(
const char* dna,
int k,
bool forwardStrand=
true) : s2i(k+1) {
237 this->forwardStrand = forwardStrand;
242 cumProds =
new Double[n+1];
245 void setEmiProbs(vector<Double> *emiprobs,
int from = -1,
int to = -1);
246 Double getSeqProb(
int from,
int to);
247 int getN() {
return n; }
253 vector<Double> *emiprobs;
268 void clear() { possibleEndOfPreds.clear(); }
270 eopit = possibleEndOfPreds.begin();
273 void decrement(
int &endOfPred);
274 void update(
int endOfPred);
275 list<int> possibleEndOfPreds;
276 list<int>::iterator eopit;
holds the stepwise constant function of GC content class indices
Definition motif.hh:152
data structure to store possible endOfPred positions to iterate directly only over those endOfPred po...
Definition statemodel.hh:266
This class implements a double object with a very large range.
Definition lldouble.hh:31
A simple matrix class. Base class for all mathematical matrix objects.
Definition matrix.hh:27
Options lists are used for sampling; items also in backtracking.
Definition vitmatrix.hh:748
Definition merkmal.hh:148
another class for caching probabilities of sequence segments
Definition statemodel.hh:232
a class for converting sequence into integer replacing Base4Int
Definition geneticcode.hh:163
holds all extrinsic feature information for one sequence
Definition extrinsicinfo.hh:86
intelligently store and retrieve the sequence emission probabilities of the sequence from a to b for ...
Definition statemodel.hh:154
Definition statemodel.hh:170
Definition statemodel.hh:182
This is the base interface class common to all state model classes (ExonModel, IntronModel,...
Definition statemodel.hh:65
static StateModel * newStateModelPtr(const char *path)
Definition statemodel.cc:72
An array of Viterbi columns.
Definition vitmatrix.hh:687
Predecessor in the state transition Graph.
Definition statemodel.hh:51
Definition pp_scoring.hh:136
Definition vitmatrix.hh:33