FeatureMapSim BaseLabeler::mergeProteinIdentificationsMaps_(const FeatureMapSimVector & maps) { // we do not have any features yet (or at least we ignore them), so simply iterate over the protein // identifications std::map<String, ProteinHit> prot_hits; Size channel_index = 1; for (FeatureMapSimVector::const_iterator maps_iterator = maps.begin(); maps_iterator != maps.end(); ++maps_iterator) { if (maps_iterator->getProteinIdentifications().size() == 0) continue; for (std::vector<ProteinHit>::const_iterator protein_hit = (*maps_iterator).getProteinIdentifications()[0].getHits().begin(); protein_hit != (*maps_iterator).getProteinIdentifications()[0].getHits().end(); ++protein_hit) { if (prot_hits.count((*protein_hit).getSequence())) // we already know this protein -- sum up abundances { SimIntensityType new_intensity = prot_hits[(*protein_hit).getSequence()].getMetaValue("intensity"); // remember channel intensity prot_hits[(*protein_hit).getSequence()].setMetaValue("intensity_" + String(channel_index), new_intensity); new_intensity += static_cast<SimIntensityType>((*protein_hit).getMetaValue("intensity")); prot_hits[(*protein_hit).getSequence()].setMetaValue("intensity", new_intensity); } else // new protein hit .. remember { ProteinHit protHit(*protein_hit); protHit.setMetaValue("intensity_" + String(channel_index), protHit.getMetaValue("intensity")); prot_hits.insert(std::pair<String, ProteinHit>((*protein_hit).getSequence(), protHit)); } } ++channel_index; } FeatureMapSim final_map; ProteinIdentification protIdent; for (std::map<String, ProteinHit>::iterator prot_hit_iter = prot_hits.begin(); prot_hit_iter != prot_hits.end(); ++prot_hit_iter) { protIdent.insertHit(prot_hit_iter->second); } std::vector<ProteinIdentification> protIdents; protIdents.push_back(protIdent); final_map.setProteinIdentifications(protIdents); return final_map; }
void MSSim::createFeatureMap_(const SimTypes::SampleProteins& proteins, SimTypes::FeatureMapSim& feature_map, Size map_index) { // clear feature map feature_map.clear(true); ProteinIdentification protIdent; for (SimTypes::SampleProteins::const_iterator it = proteins.begin(); it != proteins.end(); ++it) { // add new ProteinHit to ProteinIdentification ProteinHit protHit(0.0, 1, (it->entry).identifier, (it->entry).sequence); // copy all meta values from FASTA file parsing protHit = (it->meta); // additional meta values: protHit.setMetaValue("description", it->entry.description); protHit.setMetaValue("map_index", map_index); protIdent.insertHit(protHit); } vector<ProteinIdentification> vec_protIdent; vec_protIdent.push_back(protIdent); feature_map.setProteinIdentifications(vec_protIdent); }