| 284 | } |
| 285 | |
| 286 | void IDBoostGraph::buildGraphWithRunInfo_(ProteinIdentification& proteins, |
| 287 | ConsensusMap& cmap, |
| 288 | Size use_top_psms, |
| 289 | bool use_unassigned_ids, |
| 290 | const ExperimentalDesign& ed) |
| 291 | { |
| 292 | unordered_map<unsigned, unsigned> indexToPrefractionationGroup; |
| 293 | |
| 294 | { |
| 295 | // TODO check that the files in the ProteinID run are all in the Exp. Design |
| 296 | //StringList files; |
| 297 | //proteins.getPrimaryMSRunPath(files); // files merged in the protein identification run to be inferred |
| 298 | const ConsensusMap::ColumnHeaders& colHeaders = cmap.getColumnHeaders(); // all possible files and labels in the experiment |
| 299 | //TODO use exp. design to merge fractions |
| 300 | map<pair<String, unsigned>, unsigned> fileLabelToPrefractionationGroup = ed.getPathLabelToPrefractionationMapping(false); |
| 301 | nrPrefractionationGroups_ = fileLabelToPrefractionationGroup.size(); |
| 302 | indexToPrefractionationGroup = convertMap_(fileLabelToPrefractionationGroup, colHeaders, cmap.getExperimentType()); // convert to index in the peptide ids |
| 303 | } |
| 304 | |
| 305 | //TODO is this vertex_map really necessary. I think PSMs are always unique in our datastructures and could be |
| 306 | // added without lookup. |
| 307 | // And for the proteins we could add the vertex ID to the accession_map here and use that for lookup |
| 308 | unordered_map<IDPointer, vertex_t, boost::hash<IDPointer>> vertex_map{}; |
| 309 | unordered_map<std::string, ProteinHit*> accession_map{}; |
| 310 | |
| 311 | for (auto& prot : proteins.getHits()) |
| 312 | { |
| 313 | accession_map[prot.getAccession()] = &prot; |
| 314 | } |
| 315 | |
| 316 | ProgressLogger pl; |
| 317 | Size roughNrIds = cmap.size(); |
| 318 | if (use_unassigned_ids) roughNrIds += cmap.getUnassignedPeptideIdentifications().size(); |
| 319 | pl.setLogType(ProgressLogger::CMD); |
| 320 | pl.startProgress(0, roughNrIds, "Building graph with run information..."); |
| 321 | const String& protRun = proteins.getIdentifier(); |
| 322 | for (auto& feat : cmap) |
| 323 | { |
| 324 | for (auto& spectrum : feat.getPeptideIdentifications()) |
| 325 | { |
| 326 | if (spectrum.getIdentifier() == protRun) |
| 327 | { |
| 328 | addPeptideAndAssociatedProteinsWithRunInfo_(spectrum, indexToPrefractionationGroup, |
| 329 | vertex_map, accession_map, use_top_psms); |
| 330 | } |
| 331 | } |
| 332 | pl.nextProgress(); |
| 333 | } |
| 334 | |
| 335 | if (use_unassigned_ids) |
| 336 | { |
| 337 | for (auto& id : cmap.getUnassignedPeptideIdentifications()) |
| 338 | { |
| 339 | if (id.getIdentifier() == protRun) |
| 340 | { |
| 341 | addPeptideAndAssociatedProteinsWithRunInfo_(id, indexToPrefractionationGroup, |
| 342 | vertex_map, accession_map, use_top_psms); |
| 343 | } |
nothing calls this directly
no test coverage detected