本文整理汇总了C++中IProperties::getDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ IProperties::getDouble方法的具体用法?C++ IProperties::getDouble怎么用?C++ IProperties::getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProperties
的用法示例。
在下文中一共展示了IProperties::getDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char* argv[])
{
/** We create a command line parser. */
OptionsParser parser ("BankFilter");
parser.push_back (new OptionOneParam (STR_URI_INPUT, "bank input", true));
parser.push_back (new OptionOneParam (STR_FILTER_RATIO, "skip a sequence if 'good letters number / seq.len > X'", false, "0.8"));
try
{
/** We parse the user options. */
IProperties* options = parser.parse (argc, argv);
/** Shortcuts. */
double percentThreshold = options->getDouble(STR_FILTER_RATIO);
/** We open the input bank. */
IBank* inBank = Bank::open (options->getStr(STR_URI_INPUT));
LOCAL (inBank);
/** We create the output inBank. */
IBank* outBank = new BankFasta (options->getStr(STR_URI_INPUT) + "_filtered");
LOCAL (outBank);
/** We iterate the inBank. NOTE: WE USE A LAMBDA EXPRESSION HERE. */
inBank->iterate ([&] (Sequence& s)
{
/** Shortcut. */
char* data = s.getDataBuffer();
size_t nbOK = 0;
for (size_t i=0; i<s.getDataSize(); i++)
{
if (data[i]=='A' || data[i]=='C' || data[i]=='G' || data[i]=='T') { nbOK++; }
}
if ((double)nbOK / (double)s.getDataSize() > percentThreshold) { outBank->insert (s); }
});
/** We flush the output bank. */
outBank->flush();
}
catch (OptionFailure& e)
{
return e.displayErrors (cout);
}
catch (Exception& e)
{
cerr << "EXCEPTION: " << e.getMessage() << endl;
}
}