本文整理汇总了C++中Alphabet::getStateCodingSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Alphabet::getStateCodingSize方法的具体用法?C++ Alphabet::getStateCodingSize怎么用?C++ Alphabet::getStateCodingSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alphabet
的用法示例。
在下文中一共展示了Alphabet::getStateCodingSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// Now perform the smoothing:
size_t i;
for (i = 0; i < phase; ++i)
{
cs[i] = 0;
sps[i] = 0;
}
for ( ; i + wsize <= cs.size(); i += wsize)
{
// First compute minimum criterion:
int csmin = 1;
double spsmin = 1;
for (size_t j = i; j < i + wsize; ++j)
{
if (cs[j] < csmin)
csmin = cs[j];
if (sps[j] < spsmin)
spsmin = sps[j];
}
// Assign min to all positions in word:
for (size_t j = i; j < i + wsize; ++j)
{
cs[j] = csmin;
sps[j] = spsmin;
}
}
for ( ; i < cs.size(); ++i)
{
cs[i] = 0;
sps[i] = 0;
}
}
// Output scores to file:
string outputScores = ApplicationTools::getAFilePath("output.scores", bppalnscore.getParams(), false, false);
if (outputScores != "none")
{
ApplicationTools::displayResult("Output scores to", outputScores);
ofstream output(outputScores.c_str(), ios::out);
output << "Site\tColumnScore\tSumOfPairsScore" << endl;
for (size_t i = 0; i < cs.size(); ++i)
{
output << sitesTest->getSite(i).getPosition() << "\t" << cs[i] << "\t" << sps[i] << endl;
}
output.close();
}
// Create a sequence filter:
string outputFilter = ApplicationTools::getAFilePath("output.mase", bppalnscore.getParams(), false, false);
if (outputFilter != "none")
{
ApplicationTools::displayResult("Output mase with site filter to", outputFilter);
double spsThreshold = ApplicationTools::getDoubleParameter("output.sps_thresholds", bppalnscore.getParams(), 0.8);
ApplicationTools::displayResult("Threshold for SPS", spsThreshold);
MultiRange<size_t> csRanges;
MultiRange<size_t> spsRanges;
size_t csBeg = 0, spsBeg = 0, csEnd = 0, spsEnd = 0;
size_t s = alphabet->getStateCodingSize();
for (size_t i = 0; i < cs.size(); ++i)
{
if (cs[i] == 1 && i > 0 && cs[i-1] != 1)
csBeg = i;
if (cs[i] != 1 && i > 0 && cs[i-1] == 1) {
csEnd = i;
csRanges.addRange(Range<size_t>(csBeg * s, csEnd * s));
}
if (sps[i] >= spsThreshold && i > 0 && sps[i-1] < spsThreshold)
spsBeg = i;
if (sps[i] < spsThreshold && i > 0 && sps[i-1] >= spsThreshold) {
spsEnd = i;
spsRanges.addRange(Range<size_t>(spsBeg * s, spsEnd * s));
}
}
//Add the last range if any:
if (cs.back() == 1)
csRanges.addRange(Range<size_t>(csBeg * s, cs.size() * s));
if (sps.back() >= spsThreshold)
spsRanges.addRange(Range<size_t>(spsBeg * s, sps.size() * s));
MaseHeader header;
header.setSiteSelection("CS", csRanges);
header.setSiteSelection("SPS", spsRanges);
Mase writer;
writer.writeMeta(outputFilter, *sitesTest, header);
}
// We're done!
bppalnscore.done();
}
catch (exception& e)
{
cout << e.what() << endl;
return 1;
}
return 0;
}