本文整理汇总了C++中FileManager::init_from_file方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::init_from_file方法的具体用法?C++ FileManager::init_from_file怎么用?C++ FileManager::init_from_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::init_from_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recalibrate_inspect_delta_scores
/***************************************************************************************
This function touches up inspect search results by rescoring the sequences returned by
inspect. The function produces a new inspect results file with the scores (and delta scores)
replaced.
****************************************************************************************/
void PeptideRankScorer::recalibrate_inspect_delta_scores(char *spectra_file,
char *inspect_res,
char *new_res_file) const
{
AllScoreModels* allScoreModels = static_cast<AllScoreModels*>(this->allScoreModelsPtr_);
Config *config = allScoreModels->get_config();
ifstream org_res(inspect_res);
if (! org_res.is_open() || ! org_res.good())
{
cout << "Error: couldn't open original inspect results file for reading:" << inspect_res << endl;
exit(1);
}
ofstream new_res(new_res_file);
if (! new_res.is_open() || ! new_res.good())
{
cout << "Error: couldn't open new inspect results file for writing:" << new_res << endl;
exit(1);
}
char line_buff[1024];
org_res.getline(line_buff,1024);
bool read_line = true;
vector<string> field_names;
if (line_buff[0] != '#')
{
read_line = false;
}
else
{
string header = string(line_buff);
split_string(header,field_names);
int i;
for (i=0; i<field_names.size(); i++)
cout << i << "\t" << field_names[i] << endl;
}
vector<ScanCandidateSet> cand_sets;
vector<int> scan_mapping;
cand_sets.clear();
scan_mapping.resize(100000,-1);
while (! org_res.eof())
{
vector<string> fields;
if (read_line)
{
org_res.getline(line_buff,1024);
if (org_res.gcount() < 5)
continue;
}
else
{
read_line = true;
}
split_string(line_buff,fields);
InspectResultsLine res;
res.parse_from_fields(config,fields);
if (cand_sets.size()==0 || ! cand_sets[cand_sets.size()-1].add_new_line(res))
{
ScanCandidateSet new_set;
new_set.add_new_line(res);
if (new_set.scan>=scan_mapping.size())
scan_mapping.resize(2*scan_mapping.size(),-1);
scan_mapping[new_set.scan]=cand_sets.size();
cand_sets.push_back(new_set);
}
}
org_res.close();
cout << "Read results for " << cand_sets.size() << " scans..." << endl;
FileManager fm;
FileSet fs;
fm.init_from_file(config,spectra_file);
fs.select_all_files(fm);
const vector<SingleSpectrumFile *>& all_ssfs = fs.get_ssf_pointers();
cout << "Read " << all_ssfs.size() << " spectra headers..." << endl;
BasicSpecReader bsr;
QCPeak *peaks = new QCPeak[5000];
vector<bool> spectrum_indicators;
//.........这里部分代码省略.........