本文整理汇总了C++中ConsensusMap::getProteinIdentifications方法的典型用法代码示例。如果您正苦于以下问题:C++ ConsensusMap::getProteinIdentifications方法的具体用法?C++ ConsensusMap::getProteinIdentifications怎么用?C++ ConsensusMap::getProteinIdentifications使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsensusMap
的用法示例。
在下文中一共展示了ConsensusMap::getProteinIdentifications方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void QuantitativeExperimentalDesign::applyDesign2Quantifier(PeptideAndProteinQuant & quantifier, TextFile & file, StringList & file_paths)
{
// vector< pair<PeptideAndProteinQuant::PeptideData,PeptideAndProteinQuant::ProteinQuant> >& result)
//create mapping from experimental setting to all respective file names
map<String, StringList> design2FileBaseName;
mapFiles2Design_(design2FileBaseName, file);
//filter out all non-existing files
map<String, StringList> design2FilePath;
findRelevantFilePaths_(design2FileBaseName, design2FilePath, file_paths);
//determine wether we deal with idXML or featureXML
FileTypes::Type in_type = FileHandler::getType(file_paths.front());
if (in_type == FileTypes::FEATUREXML)
{
FeatureMap<> features;
for (map<String, StringList>::iterator iter = design2FilePath.begin(); iter != design2FilePath.end(); ++iter)
{
mergeFeatureMaps_(features, iter->first, iter->second);
}
LOG_INFO << "Number of proteinIdentifications: " << features.getProteinIdentifications().size() << endl;
ProteinIdentification & proteins = features.getProteinIdentifications()[0];
quantifier.quantifyPeptides(features);
quantifier.quantifyProteins(proteins);
}
else
{
ConsensusMap consensus;
for (map<String, StringList>::iterator iter = design2FilePath.begin(); iter != design2FilePath.end(); ++iter)
{
mergeConsensusMaps_(consensus, iter->first, iter->second);
}
LOG_INFO << "Number of proteinIdentifications: " << consensus.getProteinIdentifications().size() << endl;
ProteinIdentification & proteins = consensus.getProteinIdentifications()[0];
quantifier.quantifyPeptides(consensus);
quantifier.quantifyProteins(proteins);
}
}
示例2: group_
void FeatureGroupingAlgorithmQT::group_(const vector<MapType>& maps,
ConsensusMap& out)
{
// check that the number of maps is ok:
if (maps.size() < 2)
{
throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"At least two maps must be given!");
}
QTClusterFinder cluster_finder;
cluster_finder.setParameters(param_.copy("", true));
cluster_finder.run(maps, out);
StringList ms_run_locations;
// add protein IDs and unassigned peptide IDs to the result map here,
// to keep the same order as the input maps (useful for output later):
for (typename vector<MapType>::const_iterator map_it = maps.begin();
map_it != maps.end(); ++map_it)
{
// add protein identifications to result map:
out.getProteinIdentifications().insert(
out.getProteinIdentifications().end(),
map_it->getProteinIdentifications().begin(),
map_it->getProteinIdentifications().end());
// add unassigned peptide identifications to result map:
out.getUnassignedPeptideIdentifications().insert(
out.getUnassignedPeptideIdentifications().end(),
map_it->getUnassignedPeptideIdentifications().begin(),
map_it->getUnassignedPeptideIdentifications().end());
}
// canonical ordering for checking the results:
out.sortByQuality();
out.sortByMaps();
out.sortBySize();
return;
}
示例3: add
void MetaDataBrowser::add(ConsensusMap & map)
{
//identifier
add(static_cast<DocumentIdentifier &>(map));
// protein identifications
for (Size i = 0; i < map.getProteinIdentifications().size(); ++i)
{
add(map.getProteinIdentifications()[i]);
}
//unassigned peptide ids
for (Size i = 0; i < map.getUnassignedPeptideIdentifications().size(); ++i)
{
add(map.getUnassignedPeptideIdentifications()[i]);
}
add(static_cast<MetaInfoInterface &>(map));
treeview_->expandItem(treeview_->findItems(QString::number(0), Qt::MatchExactly, 1).first());
}
示例4: infer
void ProteinInference::infer(ConsensusMap & consensus_map, const UInt reference_map)
{
// we infer Proteins for every IdentificationRun separately. If you want this combined, then
// do that before calling this function
// Each ProteinIdentification will be augmented with the quantification (where possible)
for (size_t i = 0;
i < consensus_map.getProteinIdentifications().size();
++i)
{
infer_(consensus_map, i, reference_map);
}
}
示例5: annotate
void IDMapper::annotate(ConsensusMap & map, const std::vector<PeptideIdentification> & ids, const std::vector<ProteinIdentification> & protein_ids, bool measure_from_subelements)
{
// validate "RT" and "MZ" metavalues exist
checkHits_(ids);
//append protein identifications to Map
map.getProteinIdentifications().insert(map.getProteinIdentifications().end(), protein_ids.begin(), protein_ids.end());
//keep track of assigned/unassigned peptide identifications
std::map<Size, Size> assigned;
// store which peptides fit which feature (and avoid double entries)
// consensusMap -> {peptide_index}
std::vector<std::set<size_t> > mapping(map.size());
DoubleList mz_values;
DoubleReal rt_pep;
IntList charges;
//iterate over the peptide IDs
for (Size i = 0; i < ids.size(); ++i)
{
if (ids[i].getHits().empty())
continue;
getIDDetails_(ids[i], rt_pep, mz_values, charges);
//iterate over the features
for (Size cm_index = 0; cm_index < map.size(); ++cm_index)
{
// if set to TRUE, we leave the i_mz-loop as we added the whole ID with all hits
bool was_added = false; // was current pep-m/z matched?!
// iterate over m/z values of pepIds
for (Size i_mz = 0; i_mz < mz_values.size(); ++i_mz)
{
DoubleReal mz_pep = mz_values[i_mz];
// charge states to use for checking:
IntList current_charges;
if (!ignore_charge_)
{
// if "mz_ref." is "precursor", we have only one m/z value to check,
// but still one charge state per peptide hit that could match:
if (mz_values.size() == 1)
{
current_charges = charges;
}
else
{
current_charges.push_back(charges[i_mz]);
}
current_charges.push_back(0); // "not specified" always matches
}
//check if we compare distance from centroid or subelements
if (!measure_from_subelements)
{
if (isMatch_(rt_pep - map[cm_index].getRT(), mz_pep, map[cm_index].getMZ()) && (ignore_charge_ || ListUtils::contains(current_charges, map[cm_index].getCharge())))
{
was_added = true;
map[cm_index].getPeptideIdentifications().push_back(ids[i]);
++assigned[i];
}
}
else
{
for (ConsensusFeature::HandleSetType::const_iterator it_handle = map[cm_index].getFeatures().begin();
it_handle != map[cm_index].getFeatures().end();
++it_handle)
{
if (isMatch_(rt_pep - it_handle->getRT(), mz_pep, it_handle->getMZ()) && (ignore_charge_ || ListUtils::contains(current_charges, it_handle->getCharge())))
{
was_added = true;
if (mapping[cm_index].count(i) == 0)
{
map[cm_index].getPeptideIdentifications().push_back(ids[i]);
++assigned[i];
mapping[cm_index].insert(i);
}
break; // we added this peptide already.. no need to check other handles
}
}
// continue to here
}
if (was_added)
break;
} // m/z values to check
// break to here
} // features
} // Identifications
Size matches_none(0);
Size matches_single(0);
Size matches_multi(0);
//.........这里部分代码省略.........
示例6: main_
ExitCodes main_(int, const char **)
{
FeatureGroupingAlgorithmUnlabeled * algorithm = new FeatureGroupingAlgorithmUnlabeled();
//-------------------------------------------------------------
// parameter handling
//-------------------------------------------------------------
StringList ins;
ins = getStringList_("in");
String out = getStringOption_("out");
//-------------------------------------------------------------
// check for valid input
//-------------------------------------------------------------
// check if all input files have the correct type
FileTypes::Type file_type = FileHandler::getType(ins[0]);
for (Size i = 0; i < ins.size(); ++i)
{
if (FileHandler::getType(ins[i]) != file_type)
{
writeLog_("Error: All input files must be of the same type!");
return ILLEGAL_PARAMETERS;
}
}
//-------------------------------------------------------------
// set up algorithm
//-------------------------------------------------------------
Param algorithm_param = getParam_().copy("algorithm:", true);
writeDebug_("Used algorithm parameters", algorithm_param, 3);
algorithm->setParameters(algorithm_param);
Size reference_index(0);
//-------------------------------------------------------------
// perform grouping
//-------------------------------------------------------------
// load input
ConsensusMap out_map;
StringList ms_run_locations;
if (file_type == FileTypes::FEATUREXML)
{
// use map with highest number of features as reference:
Size max_count(0);
FeatureXMLFile f;
for (Size i = 0; i < ins.size(); ++i)
{
Size s = f.loadSize(ins[i]);
if (s > max_count)
{
max_count = s;
reference_index = i;
}
}
// Load reference map and input it to the algorithm
UInt64 ref_id;
Size ref_size;
std::vector<PeptideIdentification> ref_pepids;
std::vector<ProteinIdentification> ref_protids;
{
FeatureMap map_ref;
FeatureXMLFile f_fxml_tmp;
f_fxml_tmp.getOptions().setLoadConvexHull(false);
f_fxml_tmp.getOptions().setLoadSubordinates(false);
f_fxml_tmp.load(ins[reference_index], map_ref);
algorithm->setReference(reference_index, map_ref);
ref_id = map_ref.getUniqueId();
ref_size = map_ref.size();
ref_pepids = map_ref.getUnassignedPeptideIdentifications();
ref_protids = map_ref.getProteinIdentifications();
}
ConsensusMap dummy;
// go through all input files and add them to the result one by one
for (Size i = 0; i < ins.size(); ++i)
{
FeatureXMLFile f_fxml_tmp;
FeatureMap tmp_map;
f_fxml_tmp.getOptions().setLoadConvexHull(false);
f_fxml_tmp.getOptions().setLoadSubordinates(false);
f_fxml_tmp.load(ins[i], tmp_map);
// copy over information on the primary MS run
StringList ms_runs;
tmp_map.getPrimaryMSRunPath(ms_runs);
ms_run_locations.insert(ms_run_locations.end(), ms_runs.begin(), ms_runs.end());
if (i != reference_index)
{
algorithm->addToGroup(i, tmp_map);
// store some meta-data about the maps in the "dummy" object -> try to
// keep the same order as they were given in the input independent of
// which map is the reference.
dummy.getFileDescriptions()[i].filename = ins[i];
dummy.getFileDescriptions()[i].size = tmp_map.size();
dummy.getFileDescriptions()[i].unique_id = tmp_map.getUniqueId();
//.........这里部分代码省略.........
示例7: group
void FeatureGroupingAlgorithmUnlabeled::group(const std::vector<FeatureMap> & maps, ConsensusMap & out)
{
// check that the number of maps is ok
if (maps.size() < 2)
{
throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__, "At least two maps must be given!");
}
// define reference map (the one with most peaks)
Size reference_map_index = 0;
Size max_count = 0;
for (Size m = 0; m < maps.size(); ++m)
{
if (maps[m].size() > max_count)
{
max_count = maps[m].size();
reference_map_index = m;
}
}
std::vector<ConsensusMap> input(2);
// build a consensus map of the elements of the reference map (contains only singleton consensus elements)
MapConversion::convert(reference_map_index, maps[reference_map_index],
input[0]);
// loop over all other maps, extend the groups
StablePairFinder pair_finder;
pair_finder.setParameters(param_.copy("", true));
for (Size i = 0; i < maps.size(); ++i)
{
if (i != reference_map_index)
{
MapConversion::convert(i, maps[i], input[1]);
// compute the consensus of the reference map and map i
ConsensusMap result;
pair_finder.run(input, result);
input[0].swap(result);
}
}
// replace result with temporary map
out.swap(input[0]);
// copy back the input maps (they have been deleted while swapping)
out.getFileDescriptions() = input[0].getFileDescriptions();
// add protein IDs and unassigned peptide IDs to the result map here,
// to keep the same order as the input maps (useful for output later)
for (std::vector<FeatureMap>::const_iterator map_it = maps.begin();
map_it != maps.end(); ++map_it)
{
// add protein identifications to result map
out.getProteinIdentifications().insert(
out.getProteinIdentifications().end(),
map_it->getProteinIdentifications().begin(),
map_it->getProteinIdentifications().end());
// add unassigned peptide identifications to result map
out.getUnassignedPeptideIdentifications().insert(
out.getUnassignedPeptideIdentifications().end(),
map_it->getUnassignedPeptideIdentifications().begin(),
map_it->getUnassignedPeptideIdentifications().end());
}
// canonical ordering for checking the results, and the ids have no real meaning anyway
#if 1 // the way this was done in DelaunayPairFinder and StablePairFinder
out.sortByMZ();
#else
out.sortByQuality();
out.sortByMaps();
out.sortBySize();
#endif
return;
}
示例8: infer_
void ProteinInference::infer_(ConsensusMap & consensus_map,
const size_t protein_idenfication_index,
const UInt reference_map)
{
ProteinIdentification & protein_ident = consensus_map.getProteinIdentifications()[protein_idenfication_index];
for (size_t i = 0; i < protein_ident.getHits().size(); ++i)
{
// Protein Accession
String accession = protein_ident.getHits()[i].getAccession();
// consensus feature -> peptide hit
Map<size_t, PeptideHit> consensus_to_peptide;
// search for it in consensus elements:
for (size_t i_cm = 0; i_cm < consensus_map.size(); ++i_cm)
{
std::vector<PeptideHit> peptide_hits;
for (std::vector<PeptideIdentification>::iterator it_pepid = consensus_map[i_cm].getPeptideIdentifications().begin();
it_pepid != consensus_map[i_cm].getPeptideIdentifications().end();
++it_pepid)
{
// are Protein- and PeptideIdentification from the same search engine run?
if (it_pepid->getIdentifier() != protein_ident.getIdentifier())
continue;
std::vector<PeptideHit> peptide_hits_local;
it_pepid->getReferencingHits(accession, peptide_hits_local);
if (peptide_hits_local.empty())
continue;
if (sortByUnique_(peptide_hits_local, it_pepid->isHigherScoreBetter())) // we found a unique peptide
{
peptide_hits.push_back(peptide_hits_local[0]);
}
}
// if several PeptideIdentifications (==Spectra) were assigned to current ConsensusElement
// --> take the best (as above), e.g. in SILAC this could happen
// TODO: better idea?
if (!peptide_hits.empty())
{
if (sortByUnique_(peptide_hits, consensus_map[i_cm].getPeptideIdentifications()[0].isHigherScoreBetter())) //found a unique peptide for current ConsensusElement
{
consensus_to_peptide[i_cm] = peptide_hits[0];
#ifdef DEBUG_INFERENCE
std::cout << "assign peptide " << peptide_hits[0].getSequence() << " to Protein " << accession << std::endl;
#endif
}
}
} // ! ConsensusMap loop
// no peptides found that match current Protein
if (consensus_to_peptide.empty())
continue;
// Use all matching ConsensusElements to derive a quantitation for current protein
// build up ratios for every map vs reference
double coverage = 0;
Map<Size, std::vector<IntensityType> > ratios;
// number of unique peptides pointing to current protein
UInt coverage_count = (UInt)consensus_to_peptide.size();
for (Map<size_t, PeptideHit>::iterator it_pephits = consensus_to_peptide.begin();
it_pephits != consensus_to_peptide.end();
++it_pephits)
{
coverage += it_pephits->second.getSequence().size();
const ConsensusFeature::HandleSetType & handles = consensus_map[it_pephits->first].getFeatures();
//search if reference is present
ConsensusFeature::HandleSetType::const_iterator it_ref = handles.end();
for (ConsensusFeature::HandleSetType::const_iterator it = handles.begin();
it != handles.end();
++it)
{
if (it->getMapIndex() == reference_map)
{
it_ref = it;
break;
}
}
// did not find a reference
// TODO assume intensity==0 instead??
if (it_ref == handles.end())
continue;
for (ConsensusFeature::HandleSetType::const_iterator it = handles.begin();
it != handles.end();
++it)
{
ratios[it->getMapIndex()].push_back(it->getIntensity() / it_ref->getIntensity());
}
}
//.........这里部分代码省略.........
示例9: run
//.........这里部分代码省略.........
for (DoubleList::const_iterator dist_it = mz_pair_dists.begin(); dist_it != mz_pair_dists.end(); ++dist_it)
{
double mz_pair_dist = *dist_it;
RefMap::const_iterator it2 = lower_bound(model_ref.begin(), model_ref.end(), it->getRT() + rt_pair_dist - rt_dev_low, ConsensusFeature::RTLess());
while (it2 != model_ref.end() && it2->getRT() <= it->getRT() + rt_pair_dist + rt_dev_high)
{
// if in mrm mode, we need to compare precursor mass difference and fragment mass difference, charge remains the same
double prec_mz_diff(0);
if (mrm)
{
prec_mz_diff = fabs((double)it2->getMetaValue("MZ") - (double)it->getMetaValue("MZ"));
if (it->getCharge() != 0)
{
prec_mz_diff = fabs(prec_mz_diff - mz_pair_dist / it->getCharge());
}
else
{
prec_mz_diff = fabs(prec_mz_diff - mz_pair_dist);
}
}
bool mrm_correct_dist(false);
double frag_mz_diff = fabs(it->getMZ() - it2->getMZ());
//cerr << it->getRT() << " charge1=" << it->getCharge() << ", charge2=" << it2->getCharge() << ", prec_diff=" << prec_mz_diff << ", frag_diff=" << frag_mz_diff << endl;
if (mrm &&
it2->getCharge() == it->getCharge() &&
prec_mz_diff < mz_dev &&
(frag_mz_diff < mz_dev || fabs(frag_mz_diff - mz_pair_dist) < mz_dev))
{
mrm_correct_dist = true;
//cerr << "mrm_correct_dist" << endl;
}
if ((mrm && mrm_correct_dist) || (!mrm &&
it2->getCharge() == it->getCharge() &&
it2->getMZ() >= it->getMZ() + mz_pair_dist / it->getCharge() - mz_dev &&
it2->getMZ() <= it->getMZ() + mz_pair_dist / it->getCharge() + mz_dev
))
{
//cerr << "dist correct" << endl;
double score = sqrt(
PValue_(it2->getMZ() - it->getMZ(), mz_pair_dist / it->getCharge(), mz_dev, mz_dev) *
PValue_(it2->getRT() - it->getRT(), rt_pair_dist, rt_dev_low, rt_dev_high)
);
// Note: we used to copy the id from the light feature here, but that strategy does not generalize to more than two labels.
// We might want to report consensus features where the light one is missing but more than one heavier variant was found.
// Also, the old strategy is inconsistent with what was done in the unlabeled case. Thus now we assign a new unique id here.
matches.push_back(ConsensusFeature());
matches.back().setUniqueId();
matches.back().insert(light_index, *it);
matches.back().clearMetaInfo();
matches.back().insert(heavy_index, *it2);
matches.back().setQuality(score);
matches.back().setCharge(it->getCharge());
matches.back().computeMonoisotopicConsensus();
}
++it2;
}
}
}
//compute best pairs
// - sort matches by quality
// - take highest-quality matches first (greedy) and mark them as used
set<Size> used_features;
matches.sortByQuality(true);
for (ConsensusMap::const_iterator match = matches.begin(); match != matches.end(); ++match)
{
//check if features are not used yet
if (used_features.find(match->begin()->getUniqueId()) == used_features.end() &&
used_features.find(match->rbegin()->getUniqueId()) == used_features.end()
)
{
//if unused, add it to the final set of elements
result_map.push_back(*match);
used_features.insert(match->begin()->getUniqueId());
used_features.insert(match->rbegin()->getUniqueId());
}
}
//Add protein identifications to result map
for (Size i = 0; i < input_maps.size(); ++i)
{
result_map.getProteinIdentifications().insert(result_map.getProteinIdentifications().end(), input_maps[i].getProteinIdentifications().begin(), input_maps[i].getProteinIdentifications().end());
}
//Add unassigned peptide identifications to result map
for (Size i = 0; i < input_maps.size(); ++i)
{
result_map.getUnassignedPeptideIdentifications().insert(result_map.getUnassignedPeptideIdentifications().end(), input_maps[i].getUnassignedPeptideIdentifications().begin(), input_maps[i].getUnassignedPeptideIdentifications().end());
}
// Very useful for checking the results, and the ids have no real meaning anyway
result_map.sortByMZ();
}
示例10: store
void IBSpectraFile::store(const String& filename, const ConsensusMap& cm)
{
// typdefs for shorter code
typedef std::vector<ProteinHit>::iterator ProtHitIt;
// general settings .. do we need to expose these?
// ----------------------------------------------------------------------
/// Allow also non-unique peptides to be exported
bool allow_non_unique = true;
/// Intensities below this value will be set to 0.0 to avoid numerical problems when quantifying
double intensity_threshold = 0.00001;
// ----------------------------------------------------------------------
// guess experiment type
boost::shared_ptr<IsobaricQuantitationMethod> quantMethod = guessExperimentType_(cm);
// we need the protein identifications to reference the protein names
ProteinIdentification protIdent;
bool has_proteinIdentifications = false;
if (cm.getProteinIdentifications().size() > 0)
{
protIdent = cm.getProteinIdentifications()[0];
has_proteinIdentifications = true;
}
// start the file by adding the tsv header
TextFile textFile;
textFile.addLine(ListUtils::concatenate(constructHeader_(*quantMethod), "\t"));
for (ConsensusMap::ConstIterator cm_iter = cm.begin();
cm_iter != cm.end();
++cm_iter)
{
const ConsensusFeature& cFeature = *cm_iter;
std::vector<IdCSV> entries;
/// 1st we extract the identification information from the consensus feature
if (cFeature.getPeptideIdentifications().size() == 0 || !has_proteinIdentifications)
{
// we store unidentified hits anyway, because the iTRAQ quant is still helpful for normalization
entries.push_back(IdCSV());
}
else
{
// protein name:
const PeptideHit& peptide_hit = cFeature.getPeptideIdentifications()[0].getHits()[0];
std::set<String> protein_accessions = peptide_hit.extractProteinAccessions();
if (protein_accessions.size() != 1)
{
if (!allow_non_unique) continue; // we only want unique peptides
}
for (std::set<String>::const_iterator prot_ac = protein_accessions.begin(); prot_ac != protein_accessions.end(); ++prot_ac)
{
IdCSV entry;
entry.charge = cFeature.getPeptideIdentifications()[0].getHits()[0].getCharge();
entry.peptide = cFeature.getPeptideIdentifications()[0].getHits()[0].getSequence().toUnmodifiedString();
entry.theo_mass = cFeature.getPeptideIdentifications()[0].getHits()[0].getSequence().getMonoWeight(Residue::Full, cFeature.getPeptideIdentifications()[0].getHits()[0].getCharge());
// write modif
entry.modif = getModifString_(cFeature.getPeptideIdentifications()[0].getHits()[0].getSequence());
ProtHitIt proteinHit = protIdent.findHit(*prot_ac);
if (proteinHit == protIdent.getHits().end())
{
std::cerr << "Protein referenced in peptide not found...\n";
continue; // protein not found
}
entry.accession = proteinHit->getAccession();
entries.push_back(entry);
}
}
// 2nd we add the quantitative information of the channels
// .. skip features with 0 intensity
if (cFeature.getIntensity() == 0)
{
continue;
}
for (std::vector<IdCSV>::iterator entry = entries.begin();
entry != entries.end();
++entry)
{
// set parent intensity
entry->parent_intens = cFeature.getIntensity();
entry->retention_time = cFeature.getRT();
entry->spectrum = cFeature.getUniqueId();
entry->exp_mass = cFeature.getMZ();
// create output line
StringList currentLine;
// add entry to currentLine
entry->toStringList(currentLine);
// extract channel intensities and positions
//.........这里部分代码省略.........
示例11: main_
ExitCodes main_(int, const char **)
{
String in = getStringOption_("in"), out = getStringOption_("out"),
id_out = getStringOption_("id_out");
if (out.empty() && id_out.empty())
{
throw Exception::RequiredParameterNotGiven(__FILE__, __LINE__,
__PRETTY_FUNCTION__,
"out/id_out");
}
vector<ProteinIdentification> proteins;
vector<PeptideIdentification> peptides;
FileTypes::Type in_type = FileHandler::getType(in);
if (in_type == FileTypes::MZML)
{
MSExperiment<> experiment;
MzMLFile().load(in, experiment);
// what about unassigned peptide IDs?
for (MSExperiment<>::Iterator exp_it = experiment.begin();
exp_it != experiment.end(); ++exp_it)
{
peptides.insert(peptides.end(),
exp_it->getPeptideIdentifications().begin(),
exp_it->getPeptideIdentifications().end());
exp_it->getPeptideIdentifications().clear();
}
experiment.getProteinIdentifications().swap(proteins);
if (!out.empty())
{
addDataProcessing_(experiment,
getProcessingInfo_(DataProcessing::FILTERING));
MzMLFile().store(out, experiment);
}
}
else if (in_type == FileTypes::FEATUREXML)
{
FeatureMap features;
FeatureXMLFile().load(in, features);
features.getUnassignedPeptideIdentifications().swap(peptides);
for (FeatureMap::Iterator feat_it = features.begin();
feat_it != features.end(); ++feat_it)
{
peptides.insert(peptides.end(),
feat_it->getPeptideIdentifications().begin(),
feat_it->getPeptideIdentifications().end());
feat_it->getPeptideIdentifications().clear();
}
features.getProteinIdentifications().swap(proteins);
if (!out.empty())
{
addDataProcessing_(features,
getProcessingInfo_(DataProcessing::FILTERING));
FeatureXMLFile().store(out, features);
}
}
else // consensusXML
{
ConsensusMap consensus;
ConsensusXMLFile().load(in, consensus);
consensus.getUnassignedPeptideIdentifications().swap(peptides);
for (ConsensusMap::Iterator cons_it = consensus.begin();
cons_it != consensus.end(); ++cons_it)
{
peptides.insert(peptides.end(),
cons_it->getPeptideIdentifications().begin(),
cons_it->getPeptideIdentifications().end());
cons_it->getPeptideIdentifications().clear();
}
consensus.getProteinIdentifications().swap(proteins);
if (!out.empty())
{
addDataProcessing_(consensus,
getProcessingInfo_(DataProcessing::FILTERING));
ConsensusXMLFile().store(out, consensus);
}
}
if (!id_out.empty())
{
// IDMapper can match a peptide ID to several overlapping features,
// resulting in duplicates; this shouldn't be the case for peak data
if (in_type != FileTypes::MZML) removeDuplicates_(peptides);
IdXMLFile().store(id_out, proteins, peptides);
}
return EXECUTION_OK;
}
示例12: DataValue
TEST_EQUAL(map.getFileDescriptions()[1].getMetaValue("name5") == DataValue("value5"), true)
TEST_EQUAL(map.getFileDescriptions()[1].getMetaValue("name6") == DataValue(6.0), true)
//data processing
TEST_EQUAL(map.getDataProcessing().size(), 2)
TEST_STRING_EQUAL(map.getDataProcessing()[0].getSoftware().getName(), "Software1")
TEST_STRING_EQUAL(map.getDataProcessing()[0].getSoftware().getVersion(), "0.91a")
TEST_EQUAL(map.getDataProcessing()[0].getProcessingActions().size(), 1)
TEST_EQUAL(map.getDataProcessing()[0].getProcessingActions().count(DataProcessing::DEISOTOPING), 1)
TEST_STRING_EQUAL(map.getDataProcessing()[0].getMetaValue("name"), "dataProcessing")
TEST_STRING_EQUAL(map.getDataProcessing()[1].getSoftware().getName(), "Software2")
TEST_STRING_EQUAL(map.getDataProcessing()[1].getSoftware().getVersion(), "0.92a")
TEST_EQUAL(map.getDataProcessing()[1].getProcessingActions().size(), 2)
TEST_EQUAL(map.getDataProcessing()[1].getProcessingActions().count(DataProcessing::SMOOTHING), 1)
TEST_EQUAL(map.getDataProcessing()[1].getProcessingActions().count(DataProcessing::BASELINE_REDUCTION), 1)
//protein identifications
TEST_EQUAL(map.getProteinIdentifications().size(), 2)
TEST_EQUAL(map.getProteinIdentifications()[0].getHits().size(), 2)
TEST_EQUAL(map.getProteinIdentifications()[0].getHits()[0].getSequence(), "ABCDEFG")
TEST_EQUAL(map.getProteinIdentifications()[0].getHits()[1].getSequence(), "HIJKLMN")
TEST_EQUAL(map.getProteinIdentifications()[1].getHits().size(), 1)
TEST_EQUAL(map.getProteinIdentifications()[1].getHits()[0].getSequence(), "OPQREST")
//peptide identifications
TEST_EQUAL(map[0].getPeptideIdentifications().size(), 2)
TEST_EQUAL(map[0].getPeptideIdentifications()[0].getHits().size(), 1)
TEST_EQUAL(map[0].getPeptideIdentifications()[0].getHits()[0].getSequence(), "A")
TEST_EQUAL(map[0].getPeptideIdentifications()[1].getHits().size(), 2)
TEST_EQUAL(map[0].getPeptideIdentifications()[1].getHits()[0].getSequence(), "C")
TEST_EQUAL(map[0].getPeptideIdentifications()[1].getHits()[1].getSequence(), "D")
TEST_EQUAL(map[1].getPeptideIdentifications().size(), 1)
TEST_EQUAL(map[1].getPeptideIdentifications()[0].getHits().size(), 1)
TEST_EQUAL(map[1].getPeptideIdentifications()[0].getHits()[0].getSequence(), "E")