OpenMS  3.0.0
SpectraIDViewTab.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2022.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
41 
42 #include <QtWidgets>
43 #include <QLineEdit>
44 #include <QComboBox>
45 #include <QTableWidget>
46 #include <QCheckBox>
47 #include <QWidget>
48 
49 #include <unordered_map>
50 #include <vector>
51 
52 namespace OpenMS
53 {
59  class OPENMS_GUI_DLLAPI SpectraIDViewTab :
60  public QWidget,
61  public DefaultParamHandler,
62  public DataTabBase
63  {
64  Q_OBJECT
65  public:
67  SpectraIDViewTab(const Param& preferences, QWidget* parent = nullptr);
69  ~SpectraIDViewTab() override = default;
70 
71  // docu in base class
72  bool hasData(const LayerDataBase* layer) override;
73 
75  void updateEntries(LayerDataBase* model) override;
77  LayerDataBase* getLayer();
78 
80  void clear() override;
81 
83  bool ignore_update = false;
84 
85  protected slots:
87  void updateEntries_();
89  void updateProteinEntries_(int spec_cell_row_idx);
91  void switchOrientation_();
92  signals:
94  void spectrumSelected(int spectrum_index, int pep_id_index, int pep_hit_index);
96  void spectrumDeselected(int spectrum_index);
98  void requestVisibleArea1D(double lower_mz, double upper_mz);
99 
100  private:
102  void fillRow_(const MSSpectrum& spectrum, const int spec_index, const QColor& background_color);
104  static QString extractNumFromAccession_(const QString& listItem);
106  void openUniProtSiteWithAccession_(const QString& accession);
107 
109  {
110  void resizeEvent(QResizeEvent * event) override;
111  };
112 
113  LayerDataBase* layer_ = nullptr;
114  QCheckBox* hide_no_identification_ = nullptr;
115  QCheckBox* create_rows_for_commmon_metavalue_ = nullptr;
116  TableView* table_widget_ = nullptr;
117  TableView* protein_table_widget_ = nullptr;
118  QTableWidget* fragment_window_ = nullptr;
119  QSplitter* tables_splitter_ = nullptr;
120  bool is_first_time_loading_ = true;
121  std::unordered_map<String, std::vector<const PeptideIdentification*>> protein_to_peptide_id_map;
122 
123  private slots:
125  void saveIDs_();
127  void updatedSingleCell_(QTableWidgetItem* item);
129  void currentCellChanged_(int row, int column, int old_row, int old_column);
130 
132  void createProteinToPeptideIDMap_();
133 
135  void currentSpectraSelectionChanged_();
136 
138  void updatedSingleProteinCell_(QTableWidgetItem* /*item*/);
140  void proteinCellClicked_(int row, int column);
141  };
142 }
LogStream.h
DefaultParamHandler.h
OpenMS::MSPFile::store
void store(const String &filename, const PeakMap &exp) const
Stores a map in a MSPFile file.
OpenMS::PeptideHit::getCharge
Int getCharge() const
returns the charge of the peptide
OpenMS::TableView
A better QTable for TOPPView, which supports exporting to TSV and conveniently adding data to cells a...
Definition: TableView.h:46
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
OpenMS::Residue::getModificationName
const String & getModificationName() const
returns the name (ID) of the modification, or an empty string if none is set
OpenMS::StringUtils::toInt
static Int toInt(const String &this_s)
Definition: StringUtils.h:206
FileHandler.h
FileTypes.h
OpenMS::SqrtMower
Scales the intensity of peaks to the sqrt.
Definition: SqrtMower.h:51
OpenMS::FileTypes::MZDATA
MzData file (.mzData)
Definition: FileTypes.h:61
OpenMS::MzDataFile
File adapter for MzData files.
Definition: MzDataFile.h:53
Size
OpenMS::Normalizer
Normalizes the peak intensities spectrum-wise.
Definition: Normalizer.h:57
BernNorm.h
OpenMS::Exception::IllegalArgument
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
OpenMS::IdXMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &protein_ids, const std::vector< PeptideIdentification > &peptide_ids, const String &document_id="")
Stores the data in an idXML file.
OpenMS::NLargest::filterPeakMap
void filterPeakMap(PeakMap &exp)
OpenMS::Factory
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct.
Definition: Factory.h:61
OpenMS::PeptideIdentification::insertHit
void insertHit(const PeptideHit &hit)
Appends a peptide hit.
SqrtMower.h
OpenMS::ProteinIdentification::PeakMassType
PeakMassType
Peak mass type.
Definition: ProteinIdentification.h:247
OpenMS::BinnedSpectrum
This is a binned representation of a PeakSpectrum.
Definition: BinnedSpectrum.h:80
OpenMS::PeptideIdentification::setIdentifier
void setIdentifier(const String &id)
sets the identifier which links this PI to its corresponding ProteinIdentification
OpenMS::WindowMower
WindowMower augments the highest peaks in a sliding or jumping window.
Definition: WindowMower.h:54
OpenMS::SqrtMower::filterPeakMap
void filterPeakMap(PeakMap &exp)
OpenMS::MzMLFile::store
void store(const String &filename, const PeakMap &map) const
Stores a map in an MzML file.
OpenMS::Peak1D::setMZ
void setMZ(CoordinateType mz)
Mutable access to m/z.
Definition: Peak1D.h:119
OpenMS::Constants::k
const double k
Definition: Constants.h:153
OpenMS::FileTypes::MZXML
MzXML file (.mzXML)
Definition: FileTypes.h:62
OpenMS::ProteinIdentification::setSearchEngineVersion
void setSearchEngineVersion(const String &search_engine_version)
Sets the search engine version.
OpenMS::MzMLFile
File adapter for MzML files.
Definition: MzMLFile.h:57
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::MSExperiment::begin
Iterator begin()
Definition: MSExperiment.h:150
OpenMS::Residue::getOneLetterCode
const String & getOneLetterCode() const
returns the name as one letter code (String of size 1)
OpenMS::PeptideEvidence::setProteinAccession
void setProteinAccession(const String &s)
set the protein accession the peptide matches to. If not available set to empty string.
OpenMS::String::trim
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
MzMLFile.h
Int
OpenMS::String::removeWhitespaces
String & removeWhitespaces()
removes whitespaces (space, tab, line feed, carriage return)
OpenMS::PeptideIdentification::setRT
void setRT(double rt)
sets the RT of the MS2 spectrum where the identification occurred
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
OpenMS::SpectrumSettings::getPrecursors
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
IdXMLFile.h
OpenMS::ProteinHit
Representation of a protein hit.
Definition: ProteinHit.h:58
OpenMS::MSSpectrum::getRT
double getRT() const
ZhangSimilarityScore.h
OpenMS::ProteinIdentification::MONOISOTOPIC
Definition: ProteinIdentification.h:249
OpenMS::MzDataFile::load
void load(const String &filename, MapType &map)
Loads a map from a MzData file.
OpenMS::Peak1D::setIntensity
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: Peak1D.h:110
OpenMS::ModificationsDB
database which holds all residue modifications from UniMod
Definition: ModificationsDB.h:75
OpenMS::MzXMLFile
File adapter for MzXML 3.1 files.
Definition: MzXMLFile.h:52
OpenMS::IntList
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:55
QTableWidget
OpenMS::MSExperiment::const_iterator
Base::const_iterator const_iterator
Definition: MSExperiment.h:118
OpenMS::SpectrumSettings::getPeptideIdentifications
const std::vector< PeptideIdentification > & getPeptideIdentifications() const
returns a const reference to the PeptideIdentification vector
BinnedSpectrum.h
OpenMS::MSExperiment::clearMetaDataArrays
bool clearMetaDataArrays()
Clears the meta data arrays of all contained spectra (float, integer and string arrays)
OpenMS::FileTypes::UNKNOWN
Unknown file extension.
Definition: FileTypes.h:58
QWidget
OpenMS::ProteinIdentification
Representation of a protein identification run.
Definition: ProteinIdentification.h:70
OpenMS::SpectraIDViewTab::protein_to_peptide_id_map
std::unordered_map< String, std::vector< const PeptideIdentification * > > protein_to_peptide_id_map
Definition: SpectraIDViewTab.h:121
OpenMS::String::hasSubstring
bool hasSubstring(const String &string) const
true if String contains the string, false otherwise
OpenMS::ParentPeakMower
ParentPeakMower gets rid of high peaks that could stem from unfragmented precursor ions.
Definition: ParentPeakMower.h:54
OpenMS::MSExperiment::size
Size size() const
Definition: MSExperiment.h:120
OpenMS::NLargest
NLargest removes all but the n largest peaks.
Definition: NLargest.h:54
OpenMS::PeptideIdentification::setHits
void setHits(const std::vector< PeptideHit > &hits)
Sets the peptide hits.
TableView.h
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS::PeptideIdentification::getHits
const std::vector< PeptideHit > & getHits() const
returns the peptide hits as const
OpenMS::DateTime::now
static DateTime now()
Returns the current date and time.
OpenMS::ModificationsDB::getInstance
static ModificationsDB * getInstance()
Returns a pointer to the modifications DB (singleton)
OpenMS::DIM_UNIT::MZ
m/z
WindowMower.h
OpenMS::ProteinIdentification::SearchParameters::charges
String charges
The allowed charges for the search.
Definition: ProteinIdentification.h:264
OpenMS::ProteinHit::setAccession
void setAccession(const String &accession)
sets the accession of the protein
OpenMS::SpectraIDViewTab
Tabular visualization / selection of identified spectra.
Definition: SpectraIDViewTab.h:59
OpenMS::ProteinHit::getAccession
const String & getAccession() const
returns the accession of the protein
OpenMS::DataTabBase
all tabs need to implement this interface
Definition: DataSelectionTabs.h:56
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::MSExperiment::Iterator
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:104
OpenMS::PeptideHit::addPeptideEvidence
void addPeptideEvidence(const PeptideEvidence &peptide_evidence)
adds information on a peptide that is (potentially) identified by this PSM
OpenMS::MSExperiment::addSpectrum
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
OpenMS::Normalizer::filterPeakMap
void filterPeakMap(PeakMap &exp) const
OpenMS::ProteinIdentification::SearchParameters::variable_modifications
std::vector< String > variable_modifications
Allowed variable modifications.
Definition: ProteinIdentification.h:267
OpenMS::ProteinIdentification::SearchParameters::mass_type
PeakMassType mass_type
Mass type of the peaks.
Definition: ProteinIdentification.h:265
OpenMS::ResidueModification::getOrigin
char getOrigin() const
Returns the origin (i.e. modified amino acid)
OpenMS::PeptideIdentification::sort
void sort()
Sorts the hits by score.
OpenMS::MetaInfoInterface::setMetaValue
void setMetaValue(const String &name, const DataValue &value)
Sets the DataValue corresponding to a name.
OpenMS::Residue
Representation of an amino acid residue.
Definition: Residue.h:62
OpenMS::DataValue
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:58
OpenMS::MzMLFile::load
void load(const String &filename, PeakMap &map)
Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled u...
OpenMS::MSSpectrum::sortByIntensity
void sortByIntensity(bool reverse=false)
Lexicographically sorts the peaks by their intensity.
OpenMS::ProteinIdentification::setScoreType
void setScoreType(const String &type)
Sets the protein score type.
OpenMS::MzXMLFile::store
void store(const String &filename, const MapType &map) const
Stores a map in a MzXML file.
OpenMS::StringUtils::toLower
static String & toLower(String &this_s)
Definition: StringUtilsSimple.h:572
OpenMS::ProteinIdentification::SearchParameters::db
String db
The used database.
Definition: ProteinIdentification.h:261
OpenMS::FileHandler
Facilitates file handling by file type recognition.
Definition: FileHandler.h:66
OpenMS::AASequence::getResidue
const Residue & getResidue(Size index) const
returns a pointer to the residue at position index
MzXMLFile.h
OpenMS::FileTypes::Type
Type
Actual file types enum.
Definition: FileTypes.h:56
OpenMS::PeptideEvidence
Representation of a peptide evidence.
Definition: PeptideEvidence.h:50
MathFunctions.h
OpenMS::MarkerMower
MarkerMower uses PeakMarker to find peaks, those that are not marked get removed.
Definition: MarkerMower.h:54
OpenMS::AASequence::size
Size size() const
returns the number of residues
OpenMS::PeptideIdentification::setHigherScoreBetter
void setHigherScoreBetter(bool value)
sets the peptide score orientation
OpenMS::FileHandler::getType
static FileTypes::Type getType(const String &filename)
Tries to determine the file type (by name or content)
OpenMS::Peak1D::setPosition
void setPosition(PositionType const &position)
Mutable access to the position.
Definition: Peak1D.h:149
OpenMS::SpectrumSettings::setPrecursors
void setPrecursors(const std::vector< Precursor > &precursors)
sets the precursors
LayerDataBase.h
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::MSSpectrum::setMSLevel
void setMSLevel(UInt ms_level)
Sets the MS level.
OpenMS::String::EMPTY
static const String EMPTY
Empty string for comparisons.
Definition: String.h:64
Normalizer.h
OpenMS::PeptideHit::setCharge
void setCharge(Int charge)
sets the charge of the peptide
CsvFile.h
OpenMS::AASequence::isModified
bool isModified() const
returns true if any of the residues or termini are modified
OpenMS::DefaultParamHandler::getParameters
const Param & getParameters() const
Non-mutable access to the parameters.
OpenMS::ProteinIdentification::setSearchParameters
void setSearchParameters(const SearchParameters &search_parameters)
Sets the search parameters.
OpenMS::Peak1D
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:53
OpenMS::ParentPeakMower::filterPeakMap
void filterPeakMap(PeakMap &exp)
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::MSSpectrum::sortByPosition
void sortByPosition()
Lexicographically sorts the peaks by their position.
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::PeptideHit::setSequence
void setSequence(const AASequence &sequence)
sets the peptide sequence
OpenMS::ProteinIdentification::SearchParameters::fixed_modifications
std::vector< String > fixed_modifications
Used fixed modifications.
Definition: ProteinIdentification.h:266
ParentPeakMower.h
OpenMS::Scaler::filterPeakMap
void filterPeakMap(PeakMap &exp)
ModificationsDB.h
OpenMS::CsvFile
This class handles csv files. Currently only loading is implemented.
Definition: CsvFile.h:49
NLargest.h
OpenMS::ProteinIdentification::insertHit
void insertHit(const ProteinHit &input)
Appends a protein hit.
OpenMS::WindowMower::filterPeakMap
void filterPeakMap(PeakMap &exp)
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
Scaler.h
MSExperiment.h
OpenMS::ProteinIdentification::SearchParameters::precursor_mass_tolerance
double precursor_mass_tolerance
Mass tolerance of precursor ions (Dalton or ppm)
Definition: ProteinIdentification.h:271
OpenMS::Constants::UserParam::ISOTOPE_ERROR
const std::string ISOTOPE_ERROR
Definition: Constants.h:327
OpenMS::Exception::RequiredParameterNotGiven
A required parameter was not given.
Definition: TOPPBase.h:114
OpenMS::MSPFile::load
void load(const String &filename, std::vector< PeptideIdentification > &ids, PeakMap &exp)
Loads a map from a MSPFile file.
OpenMS::MarkerMower::filterPeakMap
void filterPeakMap(PeakMap &exp)
OpenMS::PeptideIdentification
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63
AASequence.h
OpenMS::ThresholdMower::filterPeakMap
void filterPeakMap(PeakMap &exp)
OpenMS::Param::copy
Param copy(const std::string &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
OpenMS::MSExperiment::end
Iterator end()
Definition: MSExperiment.h:160
OpenMS::PeakSpectrumCompareFunctor::registerChildren
static void registerChildren()
registers all derived products
OpenMS::Scaler
Scaler scales the peak by ranking the peaks and assigning intensity according to rank.
Definition: Scaler.h:51
OpenMS::MzXMLFile::load
void load(const String &filename, MapType &map)
Loads a map from a MzXML file.
OpenMS::ThresholdMower
ThresholdMower removes all peaks below a threshold.
Definition: ThresholdMower.h:51
OpenMS::SpectraIDViewTab::SelfResizingTableView_
Definition: SpectraIDViewTab.h:108
OpenMS::BernNorm::filterPeakMap
void filterPeakMap(PeakMap &exp)
OpenMS::ModificationsDB::getAllSearchModifications
void getAllSearchModifications(std::vector< String > &modifications) const
Collects all modifications that can be used for identification searches.
OpenMS::MzDataFile::store
void store(const String &filename, const MapType &map) const
Stores a map in a MzData file.
OpenMS::ProteinIdentification::setDateTime
void setDateTime(const DateTime &date)
Sets the date of the protein identification run.
MzDataFile.h
OpenMS::ProteinIdentification::SearchParameters::precursor_mass_tolerance_ppm
bool precursor_mass_tolerance_ppm
Mass tolerance unit of precursor ions (true: ppm, false: Dalton)
Definition: ProteinIdentification.h:272
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::Peak1D::setPos
void setPos(CoordinateType pos)
Alias for setMZ()
Definition: Peak1D.h:131
OpenMS::AASequence
Representation of a peptide/protein sequence.
Definition: AASequence.h:111
OpenMS::LayerDataBase
Class that stores the data for one layer.
Definition: LayerDataBase.h:97
OpenMS::BernNorm
BernNorm scales the peaks by ranking them and then scaling them according to rank.
Definition: BernNorm.h:56
OpenMS::AASequence::fromString
static AASequence fromString(const String &s, bool permissive=true)
create AASequence object by parsing an OpenMS string
MarkerMower.h
OpenMS::MSPFile
File adapter for MSP files (NIST spectra library)
Definition: MSPFile.h:53
OpenMS::SpectrumSettings::setPeptideIdentifications
void setPeptideIdentifications(const std::vector< PeptideIdentification > &identifications)
sets the PeptideIdentification vector
OPENMS_LOG_INFO
#define OPENMS_LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:465
OpenMS::ProteinIdentification::setIdentifier
void setIdentifier(const String &id)
Sets the identifier.
OpenMS::Constants::C13C12_MASSDIFF_U
const double C13C12_MASSDIFF_U
Definition: Constants.h:121
PeptideIdentification.h
DataSelectionTabs.h
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
MSPFile.h
OpenMS::ProteinIdentification::SearchParameters
Search parameters of the DB search.
Definition: ProteinIdentification.h:258
OpenMS::DataProcessing::FILTERING
Data filtering or extraction.
Definition: DataProcessing.h:71
OpenMS::PeptideIdentification::setMZ
void setMZ(double mz)
sets the MZ of the MS2 spectrum
OpenMS::MSSpectrum::setRT
void setRT(double rt)
Sets the absolute retention time (in seconds)
OpenMS::DIM_UNIT::RT
RT in seconds.
Factory.h
OpenMS::Peak1D::getIntensity
IntensityType getIntensity() const
Definition: Peak1D.h:108
OpenMS::ModificationsDB::getModification
const ResidueModification * getModification(Size index) const
Returns the modification with the given index. note: out-of-bounds check is only performed in debug m...
OpenMS::ProgressLogger::setLogType
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
TOPPBase.h
OpenMS::PeptideIdentification::setScoreType
void setScoreType(const String &type)
sets the peptide score type
SpectraSTSimilarityScore.h
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:68
ThresholdMower.h
OpenMS::MSExperiment::getMinRT
CoordinateType getMinRT() const
returns the minimal retention time value
OpenMS::PeptideIdentification::empty
bool empty() const
Returns if this PeptideIdentification result is empty.
OpenMS::PeptideHit::setScore
void setScore(double score)
sets the PSM score
OpenMS::PeptideHit
Representation of a peptide hit.
Definition: PeptideHit.h:55