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

Method updateProteinEntries_

src/openms_gui/source/VISUAL/SpectraIDViewTab.cpp:565–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563 }// namespace Detail
564
565 void SpectraIDViewTab::updateProteinEntries_(int selected_spec_row_idx)
566 {
567 //TODO Currently when switching to 2D view of the same dataset and then switching back to the fragment spectrum,
568 // the spectrum table (almost; annotations gone) correctly restores the row, while the proteins do not get newly
569 // refreshed. Check why and fix. It is not too bad though.
570 // no valid peak layer attached
571 if (!hasData(layer_) || layer_->getPeakData()->getProteinIdentifications().empty())
572 {
573 //clear(); this was done in updateEntries_() already.
574 return;
575 }
576
577 if (ignore_update)
578 {
579 return;
580 }
581
582 if (!isVisible())
583 {
584 return;
585 }
586
587 set<String> accs;
588 if(selected_spec_row_idx >= 0)
589 //TODO another option would be a "Filter proteins" checkbox that filters for proteins for this Hit
590 // only when checked, otherwise only highlights
591 {
592 int row = selected_spec_row_idx;
593 int spectrum_index = table_widget_->item(row, Clmn::SPEC_INDEX)->data(Qt::DisplayRole).toInt();
594 int num_id = table_widget_->item(row, Clmn::ID_NR)->data(Qt::DisplayRole).toInt();
595 int num_ph = table_widget_->item(row, Clmn::PEPHIT_NR)->data(Qt::DisplayRole).toInt();
596 const auto& spec = layer_->getPeakData()->operator[](spectrum_index);
597 const vector<PeptideIdentification>& pep_id = spec.getPeptideIdentifications();
598
599 if(!spec.getPeptideIdentifications().empty())
600 {
601 const vector<PeptideHit>& hits = pep_id[num_id].getHits();
602 if (!hits.empty()) accs = hits[num_ph].extractProteinAccessionsSet();
603 }
604 }
605
606 // create header labels (setting header labels must occur after fill)
607 QStringList headers = ProteinClmn::HEADER_NAMES;
608
609 protein_table_widget_->clear();
610 protein_table_widget_->setRowCount(0);
611 protein_table_widget_->setColumnCount(headers.size());
612 protein_table_widget_->setSortingEnabled(false);
613 protein_table_widget_->setUpdatesEnabled(false);
614 protein_table_widget_->blockSignals(true);
615
616 // generate flat list
617 int selected_row(-1);
618 // index i is needed, so iterate the old way...
619 for (Size i = 0; i < layer_->getPeakData()->getProteinIdentifications()[0].getHits().size(); ++i)
620 {
621 const auto& protein = layer_->getPeakData()->getProteinIdentifications()[0].getHits()[i];
622 if (accs.empty() || accs.find(protein.getAccession()) != accs.end())

Callers

nothing calls this directly

Calls 15

isVisibleFunction · 0.85
getPeakDataMethod · 0.80
toIntMethod · 0.80
getAccessionMethod · 0.80
rowCountMethod · 0.80
setAtBottomRowMethod · 0.80
getSequenceMethod · 0.80
getCoverageMethod · 0.80
setSelectedMethod · 0.80
emptyMethod · 0.45
operator[]Method · 0.45

Tested by

no test coverage detected