当前位置: 首页>>代码示例>>C++>>正文


C++ TextFile::end方法代码示例

本文整理汇总了C++中TextFile::end方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::end方法的具体用法?C++ TextFile::end怎么用?C++ TextFile::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextFile的用法示例。


在下文中一共展示了TextFile::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void QuantitativeExperimentalDesign::mapFiles2Design_(map<String, StringList> & experiments, TextFile & file)
{
    // get the defined separator from the parameter setting
    String separator;
    getSeparator_(separator);

    // read the header and split according separator
    StringList header;
    TextFile::Iterator iter = file.begin();
    iter->split(separator, header);
    ++iter;

    // define the column of file name and experimental setting
    UInt expCol = -1;
    UInt fileCol = -1;
    analyzeHeader_(expCol, fileCol, header);

    // read rest of the file, each row is already split according to separator
    vector<StringList> rows;
    for (; iter != file.end(); ++iter)
    {
        StringList column;
        iter->split(separator, column);
        rows.push_back(column);
    }

    // map all file names to the respective experimental setting
    map<String, StringList>::iterator it;

    for (vector<StringList>::iterator iter = rows.begin(); iter != rows.end(); ++iter)
    {
        // get experimental setting and file name
        String experiment = iter->at(expCol);
        String fileName = iter->at(fileCol);

        // search for experimental setting
        it = experiments.find(experiment);

        // if experimental setting is already present, add file name
        if (it != experiments.end())
        {
            StringList & list = it->second;
            list.push_back(fileName);
        }
        // otherwise create new list
        else
        {
            StringList newList;
            newList.push_back(fileName);
            experiments.insert(make_pair(experiment, newList));
        }
    }

    LOG_INFO << "\n Statistics: \n";
    for (it = experiments.begin(); it != experiments.end(); ++it)
    {
        LOG_INFO << "Experiment: " << it->first << ", number datasets: " << it->second.size() << endl;
    }
}
开发者ID:hroest,项目名称:flaming-archer,代码行数:59,代码来源:QuantitativeExperimentalDesign.C

示例2: HeaderInfo

  explicit HeaderInfo(const String& filename)
  {
    header_description = "-- empty --";
    TextFile tf;
    tf.load(filename);
    String content;
    content.concatenate(tf.begin(), tf.end(), ";");

    String search = "$$ Sample Description:";
    Size pos = content.find(search);
    if (pos != std::string::npos)
    {
      pos += search.size();
      Size pos_end = content.find("$$", pos);
      if (pos_end != std::string::npos)
      {
        String tmp = content.substr(pos, pos_end - pos - 1);
        if (!tmp.trim().empty()) header_description = tmp;
        //std::cerr << "Header info is: " << header_description << std::endl;
      }
    }
  }
开发者ID:BioinformaticsArchive,项目名称:OpenMS,代码行数:22,代码来源:EICExtractor.cpp

示例3: ParseError

EnzymaticDigestionLogModel::EnzymaticDigestionLogModel() :
    enzyme_(*EnzymesDB::getInstance()->getEnzyme("Trypsin")),
    log_model_threshold_(0.25),
    model_data_()
{
    // load the cleavage model from disk (might throw exceptions)
    TextFile tf;
    tf.load(File::find("./CHEMISTRY/MissedCleavage.model"), true);
    for (TextFile::ConstIterator it = tf.begin(); it != tf.end(); ++it)
    {
        String tmp = *it;
        if (tmp.trim().hasPrefix("#")) continue;  // skip comments
        StringList components;
        tmp.split(' ', components);
        if (components.size() != 4)
        {
            throw Exception::ParseError(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("split(' ',") + tmp + ")", String("Got ") + components.size() + " columns, expected 4!");
        }
        BindingSite_ bs(components[0].toInt(), components[1].trim());
        CleavageModel_ cl(components[2].toDouble(), components[3].toDouble());
        model_data_[bs] = cl;
    }
}
开发者ID:,项目名称:,代码行数:23,代码来源:


注:本文中的TextFile::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。