/usr/include/pbseq/alignment/simulator/OutputList.hpp is in libblasr-dev 0~20161219-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifndef _SIMULATOR_OUTPUT_LIST_HPP_
#define _SIMULATOR_OUTPUT_LIST_HPP_
#include <string>
#include <vector>
#include "CDFMap.hpp"
class Output {
public:
std::string output;
int count;
};
class OutputList {
public:
int totalCount;
std::vector<Output> outputs;
CDFMap<std::vector<Output>::iterator> cdf;
OutputList() {
totalCount = 0;
}
int AddOutput(std::string str, int count) {
outputs.resize(outputs.size()+1);
outputs[outputs.size()-1].output = str;
outputs[outputs.size()-1].count = count;
totalCount += count;
}
void StoreCumulativeCounts() {
int outputIndex;
int total = 0;
for (outputIndex = 0; outputIndex < outputs.size(); outputIndex++) {
total += outputs[outputIndex].count;
cdf.cdf.push_back(total);
cdf.data.push_back(outputs.begin() + outputIndex);
}
assert(total == totalCount);
}
int ReturnUniformRandomContextIt(std::vector<Output>::iterator &outputIt) {
return cdf.SelectRandomValue(outputIt);
}
int SelectRandomContect(std::string &outputContext) {
std::vector<Output>::iterator outIt;
ReturnUniformRandomContextIt(outIt);
outputContext = outIt->output;
return outIt - outputs.begin();
}
};
#endif
|