OpenMS
LayerData1DPeak Class Reference

#include <OpenMS/VISUAL/LayerData1DPeak.h>

Inheritance diagram for LayerData1DPeak:
[legend]
Collaboration diagram for LayerData1DPeak:
[legend]

Public Member Functions

 LayerData1DPeak ()
 
 LayerData1DPeak (const LayerDataPeak &base)
 
std::unique_ptr< LayerStoreDatastoreVisibleData (const RangeAllType &visible_range, const DataFilters &layer_filters) const override
 Returns a visitor which contains the current visible data and can write the data to disk. More...
 
std::unique_ptr< LayerStoreDatastoreFullData () const override
 Returns a visitor which contains the the full data of the layer and can write the data to disk in the appropriate format (e.g. mzML) More...
 
std::unique_ptr< Painter1DBasegetPainter1D () const override
 Obtain a painter which can draw the layer on a canvas. More...
 
bool hasIndex (Size index) const override
 Does the layer have at least index items (e.g. spectra, chroms, etc), so a call to setCurrentIndex() is valid? More...
 
RangeAllType getRangeForArea (const RangeAllType partial_range) const override
 Given a partial_range for the current 1D layer (e.g. an m/z range), fill in the other dimensions (usually intensity) from all data points which are within the input range. More...
 
const ExperimentType::SpectrumTypegetCurrentSpectrum () const
 
void updateRanges () override
 Update ranges of the underlying data. More...
 
RangeAllType getRange1D () const override
 
QMenu * getContextMenuAnnotation (Annotation1DItem *annot_item, bool &need_repaint) override
 Get a context menu (with lambda actions included) for this 1D layer, when a Annotation1DItem was right-clicked. More...
 
PeakIndex findClosestDataPoint (const RangeAllType &area) const override
 Find the closest datapoint within the given range and return a proxy to that datapoint. More...
 
Annotation1DItemaddPeakAnnotation (const PeakIndex &peak_index, const QString &text, const QColor &color) override
 Add a Annotation1DPeakItem to getCurrentAnnotations(). The specific type is determined by the derived class (e.g. Peak1D, ChromatogramPeak1D, etc) More...
 
void synchronizePeakAnnotations ()
 
void removePeakAnnotationsFromPeptideHit (const std::vector< Annotation1DItem * > &selected_annotations)
 remove peak annotations in the given list from the currently active PeptideHit More...
 
void updatePeptideHitAnnotations_ (PeptideHit &hit)
 updates the PeakAnnotations in the current PeptideHit with manually changed annotations More...
 
- Public Member Functions inherited from LayerDataPeak
 LayerDataPeak ()
 Default constructor. More...
 
 LayerDataPeak (const LayerDataPeak &ld)=default
 Copy-ctor. More...
 
LayerDataPeakoperator= (const LayerDataPeak &ld)=delete
 no assignment operator (should not be needed) More...
 
std::unique_ptr< Painter2DBasegetPainter2D () const override
 Obtain a painter which can draw the layer on a 2D canvas. More...
 
std::unique_ptr< LayerData1DBaseto1DLayer () const override
 Create a shallow copy (i.e. shared experimental data using shared_ptr) of the current layer, and make it 1D (i.e. support showing a single spec/chrom etc) More...
 
std::unique_ptr< LayerStoreDatastoreVisibleData (const RangeAllType &visible_range, const DataFilters &layer_filters) const override
 Returns a visitor which contains the current visible data and can write the data to disk. More...
 
std::unique_ptr< LayerStoreDatastoreFullData () const override
 Returns a visitor which contains the the full data of the layer and can write the data to disk in the appropriate format (e.g. mzML) More...
 
ProjectionData getProjection (const DIM_UNIT unit_x, const DIM_UNIT unit_y, const RangeAllType &area) const override
 
PeakIndex findHighestDataPoint (const RangeAllType &area) const override
 Find the datapoint with the highest intensity within the given range and return a proxy to that datapoint. More...
 
void updateRanges () override
 Update ranges of the underlying data. More...
 
RangeAllType getRange () const override
 
PointXYType peakIndexToXY (const PeakIndex &peak, const DimMapper< 2 > &mapper) const override
 Convert a PeakIndex to a XY coordinate (via mapper). More...
 
String getDataArrayDescription (const PeakIndex &peak_index) override
 Get name and value of all data-arrays corresponding to the given datapoint. More...
 
std::unique_ptr< LayerStatisticsgetStats () const override
 Compute layer statistics (via visitor) More...
 
bool annotate (const std::vector< PeptideIdentification > &identifications, const std::vector< ProteinIdentification > &protein_identifications) override
 
const ExperimentType::SpectrumTypegetSpectrum (Size spectrum_idx) const
 
const ConstExperimentSharedPtrType getPeakData () const
 Returns a const reference to the current in-memory peak data. More...
 
const ExperimentSharedPtrTypegetPeakDataMuteable ()
 Returns a mutable reference to the current in-memory peak data. More...
 
void setPeakData (ExperimentSharedPtrType p)
 Set the current in-memory peak data. More...
 
void setOnDiscPeakData (ODExperimentSharedPtrType p)
 Set the current on-disc data. More...
 
const ODExperimentSharedPtrTypegetOnDiscPeakData () const
 Returns a mutable reference to the on-disc data. More...
 
bool isIonMobilityData () const
 Check whether the current layer should be represented as ion mobility. More...
 
void labelAsIonMobilityData () const
 
bool isDIAData () const
 Check whether the current layer contains DIA (SWATH-MS) data. More...
 
void labelAsDIAData ()
 Label the current layer as DIA (SWATH-MS) data. More...
 
bool chromatogram_flag_set () const
 Check whether the current layer is a chromatogram. More...
 
void set_chromatogram_flag ()
 set the chromatogram flag More...
 
void remove_chromatogram_flag ()
 remove the chromatogram flag More...
 
- Public Member Functions inherited from LayerDataBase
 LayerDataBase ()=delete
 Default constructor (for virtual inheritance) More...
 
 LayerDataBase (const DataType type)
 C'tor for child classes. More...
 
 LayerDataBase (const LayerDataBase &ld)=default
 Copy-C'tor. More...
 
LayerDataBaseoperator= (const LayerDataBase &ld)=delete
 Assignment operator. More...
 
 LayerDataBase (LayerDataBase &&ld)=delete
 
LayerDataBaseoperator= (LayerDataBase &&ld)=delete
 Move assignment – deleted, by same argument as for move c'tor. More...
 
virtual ~LayerDataBase ()=default
 D'tor. More...
 
float getMinIntensity () const
 Returns the minimum intensity of the internal data, depending on type. More...
 
float getMaxIntensity () const
 Returns the maximum intensity of the internal data, depending on type. More...
 
const StringgetName () const
 The name of the layer, usually the basename of the file. More...
 
void setName (const String &new_name)
 Set the name of the layer, usually the basename of the file. More...
 
const StringgetNameSuffix () const
 get the extra annotation to the layers name, e.g. '[39]' for which chromatogram index is currently shown in 1D More...
 
void setNameSuffix (const String &decorator)
 set an extra annotation as suffix to the layers name, e.g. '[39]' for which chromatogram index is currently shown in 1D More...
 
- Public Member Functions inherited from LayerData1DBase
String getDecoratedName () const override
 get name augmented with attributes, e.g. '*' if modified More...
 
const Annotations1DContainergetCurrentAnnotations () const
 Returns a const reference to the annotations of the current spectrum (1D view) More...
 
Annotations1DContainergetCurrentAnnotations ()
 Returns a mutable reference to the annotations of the current spectrum (1D view) More...
 
const Annotations1DContainergetAnnotations (Size spectrum_index) const
 Returns a const reference to the annotations of the spectrum_index's spectrum (1D view) More...
 
Annotations1DContainergetAnnotations (Size spectrum_index)
 Returns a mutable reference to the annotations of the spectrum_index's spectrum (1D view) More...
 
Size getCurrentIndex () const
 Get the index of the current spectrum (1D view) More...
 
void setCurrentIndex (Size index)
 Set the index of the current spectrum (1D view) – and prepares annotations. More...
 

Additional Inherited Members

- Public Types inherited from LayerDataPeak
using SpectrumType = ExperimentType::SpectrumType
 
using PeakType = SpectrumType::PeakType
 
- Public Types inherited from LayerDataBase
using RangeAllType = RangeManager< RangeRT, RangeMZ, RangeIntensity, RangeMobility >
 
- Public Types inherited from LayerDataDefs
enum  DataType {
  DT_PEAK , DT_CHROMATOGRAM , DT_FEATURE , DT_CONSENSUS ,
  DT_IDENT , DT_UNKNOWN
}
 
enum  Flags {
  F_HULL , F_HULLS , F_UNASSIGNED , P_PRECURSORS ,
  P_PROJECTIONS , C_ELEMENTS , I_PEPTIDEMZ , I_LABELS ,
  SIZE_OF_FLAGS
}
 Flags that determine which information is shown. More...
 
enum  LabelType {
  L_NONE , L_INDEX , L_META_LABEL , L_ID ,
  L_ID_ALL , SIZE_OF_LABEL_TYPE
}
 Label used in visualization. More...
 
typedef FeatureMap FeatureMapType
 Features. More...
 
typedef boost::shared_ptr< FeatureMapFeatureMapSharedPtrType
 SharedPtr on feature map. More...
 
typedef ConsensusMap ConsensusMapType
 consensus features More...
 
typedef boost::shared_ptr< ConsensusMapConsensusMapSharedPtrType
 SharedPtr on consensus features. More...
 
typedef PeakMap ExperimentType
 Main data type (experiment) More...
 
typedef boost::shared_ptr< ExperimentTypeExperimentSharedPtrType
 SharedPtr on MSExperiment. More...
 
typedef boost::shared_ptr< const ExperimentTypeConstExperimentSharedPtrType
 
typedef boost::shared_ptr< OnDiscMSExperimentODExperimentSharedPtrType
 SharedPtr on On-Disc MSExperiment. More...
 
typedef boost::shared_ptr< OSWDataOSWDataSharedPtrType
 SharedPtr on OSWData. More...
 
- Public Attributes inherited from LayerDataBase
std::bitset< SIZE_OF_FLAGSflags
 Actual state of each flag. More...
 
bool visible = true
 if this layer is visible More...
 
DataType type = DT_UNKNOWN
 data type (peak or feature data, etc) More...
 
String filename
 file name of the file the data comes from (if available) More...
 
Param param
 Layer parameters. More...
 
MultiGradient gradient
 Gradient for 2D and 3D views. More...
 
DataFilters filters
 Filters to apply before painting. More...
 
bool modifiable = false
 Flag that indicates if the layer data can be modified (so far used for features only) More...
 
bool modified = false
 Flag that indicates that the layer data was modified since loading it. More...
 
LabelType label = L_NONE
 Label type. More...
 
int peptide_id_index = -1
 Selected peptide id and hit index (-1 if none is selected) More...
 
int peptide_hit_index = -1
 
- Public Attributes inherited from LayerData1DBase
bool flipped = false
 if this layer is flipped (1d mirror view) More...
 
std::vector< QColor > peak_colors_1d
 Peak colors of the currently shown spectrum. More...
 
- Static Public Attributes inherited from LayerDataDefs
static const std::string NamesOfLabelType [SIZE_OF_LABEL_TYPE]
 Label names. More...
 
- Protected Attributes inherited from LayerDataPeak
ExperimentSharedPtrType peak_map_ = ExperimentSharedPtrType(new ExperimentType())
 peak data More...
 
ODExperimentSharedPtrType on_disc_peaks_ = ODExperimentSharedPtrType(new OnDiscMSExperiment())
 on disc peak data More...
 
- Protected Attributes inherited from LayerData1DBase
Size current_idx_ = 0
 Index of the current spectrum/chromatogram etc (by default, show the first one) More...
 
std::vector< Annotations1DContainerannotations_1d_ = std::vector<Annotations1DContainer>(1)
 Annotations of all spectra of the experiment (1D view) More...
 

Constructor & Destructor Documentation

◆ LayerData1DPeak() [1/2]

LayerData1DPeak ( )
inline

◆ LayerData1DPeak() [2/2]

LayerData1DPeak ( const LayerDataPeak base)
inline

Member Function Documentation

◆ addPeakAnnotation()

Annotation1DItem* addPeakAnnotation ( const PeakIndex peak_index,
const QString &  text,
const QColor &  color 
)
overridevirtual

Add a Annotation1DPeakItem to getCurrentAnnotations(). The specific type is determined by the derived class (e.g. Peak1D, ChromatogramPeak1D, etc)

Parameters
peak_indexWhich peak should be annotated?
textText to annotate with
colorColor of the text
Returns
The item that was created

Implements LayerData1DBase.

◆ findClosestDataPoint()

PeakIndex findClosestDataPoint ( const RangeAllType ) const
overridevirtual

Find the closest datapoint within the given range and return a proxy to that datapoint.

Parameters
areaRange to search in. Only dimensions used in the canvas are populated.
Returns
A proxy (e.g. scan + peak index in an MSExperiment) which points to the data

Reimplemented from LayerDataBase.

◆ getContextMenuAnnotation()

QMenu* getContextMenuAnnotation ( Annotation1DItem annot_item,
bool &  need_repaint 
)
overridevirtual

Get a context menu (with lambda actions included) for this 1D layer, when a Annotation1DItem was right-clicked.

Parameters
annot_itemThe annotation item clicked on
need_repaintReference of bool in calling function, which must know if the action requires repainting the canvas
Returns
A context menu to embed into the generic menu

Implements LayerData1DBase.

◆ getCurrentSpectrum()

const ExperimentType::SpectrumType& getCurrentSpectrum ( ) const
inline

◆ getPainter1D()

std::unique_ptr<Painter1DBase> getPainter1D ( ) const
overridevirtual

Obtain a painter which can draw the layer on a canvas.

Returns
A painter

Implements LayerData1DBase.

◆ getRange1D()

RangeAllType getRange1D ( ) const
inlineoverridevirtual

Returns the data range in all known dimensions for the data of the currently active index (i.e. only a single spec/chrom/etc). If a layer does not support the dimension (or the layer is empty) the dimension will be empty If you need the data range for the whole layer (i.e. all specs/chroms/etc), call 'LayerDataBase::getRange()'

Implements LayerData1DBase.

References RangeManager< RangeBases >::assign().

◆ getRangeForArea()

RangeAllType getRangeForArea ( const RangeAllType  partial_range) const
inlineoverridevirtual

Given a partial_range for the current 1D layer (e.g. an m/z range), fill in the other dimensions (usually intensity) from all data points which are within the input range.

Parameters
partial_rangeRange with at least one dimension populated (which is used to filter the current spectrum/chrom/...)
Returns
Range of the data points within the input range (e.g. for spectra: m/z and intensity; or chroms: RT and intensity, etc)

Implements LayerData1DBase.

References RangeManager< RangeBases >::assign().

◆ hasIndex()

bool hasIndex ( Size  index) const
inlineoverridevirtual

Does the layer have at least index items (e.g. spectra, chroms, etc), so a call to setCurrentIndex() is valid?

Implements LayerData1DBase.

◆ removePeakAnnotationsFromPeptideHit()

void removePeakAnnotationsFromPeptideHit ( const std::vector< Annotation1DItem * > &  selected_annotations)

remove peak annotations in the given list from the currently active PeptideHit

◆ storeFullData()

std::unique_ptr<LayerStoreData> storeFullData ( ) const
overridevirtual

Returns a visitor which contains the the full data of the layer and can write the data to disk in the appropriate format (e.g. mzML)

Reimplemented from LayerDataBase.

◆ storeVisibleData()

std::unique_ptr<LayerStoreData> storeVisibleData ( const RangeAllType ,
const DataFilters  
) const
overridevirtual

Returns a visitor which contains the current visible data and can write the data to disk.

Reimplemented from LayerDataBase.

◆ synchronizePeakAnnotations()

void synchronizePeakAnnotations ( )

updates the PeakAnnotations in the current PeptideHit with manually changed annotations if no PeptideIdentification or PeptideHit for the spectrum exist, it is generated

◆ updatePeptideHitAnnotations_()

void updatePeptideHitAnnotations_ ( PeptideHit hit)

updates the PeakAnnotations in the current PeptideHit with manually changed annotations

◆ updateRanges()

void updateRanges ( )
inlineoverridevirtual

Update ranges of the underlying data.

Implements LayerDataBase.

References LayerDataPeak::updateRanges().