MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / nextPRTRow

Method nextPRTRow

src/openms/source/FORMAT/MzTab.cpp:2164–2255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2162 }
2163
2164 bool MzTab::IDMzTabStream::nextPRTRow(MzTabProteinSectionRow& row)
2165 {
2166 if (prot_ids_.empty()) return false;
2167
2168 // simple state machine to write out 1. all proteins, 2. all general groups and 3. all indistinguishable groups
2169state0:
2170 // done if all protein information is contained in run zero and we enter run 1
2171 if (first_run_inference_ && prt_run_id_ > 0) return false; // done
2172 if (prt_run_id_ >= prot_ids_.size()) return false; // done for the first_run_inference_ == false case
2173
2174 const ProteinIdentification& pid = *prot_ids_[prt_run_id_];
2175 const std::vector<ProteinHit>& protein_hits = pid.getHits();
2176
2177 // We only report quantitative data for indistinguishable groups (which may be composed of single proteins).
2178 // We skip the more extensive reporting of general groups with complex shared peptide relations.
2179 const std::vector<ProteinIdentification::ProteinGroup>& protein_groups2 = quant_study_variables_ == 0 ? pid.getProteinGroups() : std::vector<ProteinIdentification::ProteinGroup>();
2180 const std::vector<ProteinIdentification::ProteinGroup>& indist_groups2 = pid.getIndistinguishableProteins();
2181
2182 if (prt_hit_id_ == 0 && PRT_STATE_ == 0)
2183 { // Processing new protein identification run?
2184 // Map (indist.)protein groups to their protein hits (by index) in this run.
2185 ind2prot_ = MzTab::mapGroupsToProteins_(pid.getIndistinguishableProteins(), protein_hits);
2186 pg2prot_ = MzTab::mapGroupsToProteins_(pid.getProteinGroups(), protein_hits);
2187 }
2188
2189 if (PRT_STATE_ == 0) // write protein hits
2190 {
2191 if (prt_hit_id_ >= protein_hits.size())
2192 {
2193 prt_hit_id_ = 0;
2194 PRT_STATE_ = 1; // continue with next state (!)
2195 }
2196 else
2197 {
2198 const ProteinHit& protein = protein_hits[prt_hit_id_];
2199 auto prt_row = MzTab::proteinSectionRowFromProteinHit_(
2200 protein,
2201 db_,
2202 db_version_,
2203 protein_hit_user_value_keys_);
2204 ++prt_hit_id_;
2205 std::swap(row, prt_row);
2206 return true;
2207 }
2208 }
2209
2210 if (PRT_STATE_ == 1) // write general groups
2211 {
2212 if (prt_group_id_ >= protein_groups2.size())
2213 {
2214 prt_group_id_ = 0;
2215 PRT_STATE_ = 2;
2216 }
2217 else
2218 {
2219 const ProteinIdentification::ProteinGroup& group = protein_groups2[prt_group_id_];
2220 auto prt_row = MzTab::nextProteinSectionRowFromProteinGroup_(
2221 group,

Callers 3

storeMethod · 0.80

Calls 3

swapFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected