OpenMS
PeptideIndexing.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-2023.
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: Chris Bielow $
32 // $Authors: Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
46 
47 namespace OpenMS
48 {
49 
113  class OPENMS_DLLAPI PeptideIndexing :
114  public DefaultParamHandler, public ProgressLogger
115  {
116 public:
118  static char const* const AUTO_MODE; /* = 'auto' */
119 
122  {
127  UNEXPECTED_RESULT
128  };
129 
131  enum class Unmatched
132  {
133  IS_ERROR,
134  WARN,
135  REMOVE,
136  SIZE_OF_UNMATCHED
137  };
138  static const std::array<std::string, (Size)Unmatched::SIZE_OF_UNMATCHED> names_of_unmatched;
139 
140  enum class MissingDecoy
141  {
142  IS_ERROR,
143  WARN,
144  SILENT,
145  SIZE_OF_MISSING_DECOY
146  };
147  static const std::array<std::string, (Size)MissingDecoy::SIZE_OF_MISSING_DECOY> names_of_missing_decoy;
148 
151 
153  ~PeptideIndexing() override;
154 
156  ExitCodes run(std::vector<FASTAFile::FASTAEntry>& proteins, std::vector<ProteinIdentification>& prot_ids, std::vector<PeptideIdentification>& pep_ids);
157 
193  ExitCodes run(FASTAContainer<TFI_File>& proteins, std::vector<ProteinIdentification>& prot_ids, std::vector<PeptideIdentification>& pep_ids);
194 
196  ExitCodes run(FASTAContainer<TFI_Vector>& proteins, std::vector<ProteinIdentification>& prot_ids, std::vector<PeptideIdentification>& pep_ids);
197 
199  const String& getDecoyString() const;
200 
202  bool isPrefix() const;
203 
204  protected:
205  void updateMembers_() override;
206 
207  template<typename T> ExitCodes run_(FASTAContainer<T>& proteins, std::vector<ProteinIdentification>& prot_ids, std::vector<PeptideIdentification>& pep_ids);
208 
209  String decoy_string_{};
210  bool prefix_{ false };
211  MissingDecoy missing_decoy_action_ = MissingDecoy::IS_ERROR;
212  String enzyme_name_{};
213  String enzyme_specificity_{};
214 
215  bool write_protein_sequence_{ false };
216  bool write_protein_description_{ false };
217  bool keep_unreferenced_proteins_{ false };
218  Unmatched unmatched_action_ = Unmatched::IS_ERROR;
219  bool IL_equivalent_{ false };
220  bool allow_nterm_protein_cleavage_{ true };
221 
222  Int aaa_max_{0};
223  Int mm_max_{0};
224  };
225 }
226 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
FASTAContainer<TFI_File> will make FASTA entries available chunk-wise from start to end by loading it...
Definition: FASTAContainer.h:94
FASTAContainer<TFI_Vector> simply takes an existing vector of FASTAEntries and provides the same inte...
Definition: FASTAContainer.h:246
Refreshes the protein references for all peptide hits in a vector of PeptideIdentifications and adds ...
Definition: PeptideIndexing.h:115
const String & getDecoyString() const
Which string is used to determine if a protein is a decoy or not.
Unmatched
Action to take when peptide hits could not be matched.
Definition: PeptideIndexing.h:132
bool isPrefix() const
Is the decoy string position a prefix or suffix?
ExitCodes run_(FASTAContainer< T > &proteins, std::vector< ProteinIdentification > &prot_ids, std::vector< PeptideIdentification > &pep_ids)
ExitCodes run(FASTAContainer< TFI_Vector > &proteins, std::vector< ProteinIdentification > &prot_ids, std::vector< PeptideIdentification > &pep_ids)
Same as run() with TFI_File, but for proteins which are already in memory.
MissingDecoy
Definition: PeptideIndexing.h:141
static char const *const AUTO_MODE
name of enzyme/specificity which signals that the enzyme/specificity should be taken from meta inform...
Definition: PeptideIndexing.h:118
ExitCodes run(std::vector< FASTAFile::FASTAEntry > &proteins, std::vector< ProteinIdentification > &prot_ids, std::vector< PeptideIdentification > &pep_ids)
forward for old interface and pyOpenMS; use other run() methods for more control
~PeptideIndexing() override
Default destructor.
ExitCodes run(FASTAContainer< TFI_File > &proteins, std::vector< ProteinIdentification > &prot_ids, std::vector< PeptideIdentification > &pep_ids)
Re-index peptide identifications honoring enzyme cutting rules, ambiguous amino acids and target/deco...
PeptideIndexing()
Default constructor.
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
ExitCodes
Exit codes.
Definition: PeptideIndexing.h:122
@ PEPTIDE_IDS_EMPTY
Definition: PeptideIndexing.h:125
@ ILLEGAL_PARAMETERS
Definition: PeptideIndexing.h:126
@ DATABASE_EMPTY
Definition: PeptideIndexing.h:124
@ EXECUTION_OK
Definition: PeptideIndexing.h:123
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:53
A more convenient string class.
Definition: String.h:60
int Int
Signed integer type.
Definition: Types.h:102
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
template parameter for vector-based FASTA access
Definition: FASTAContainer.h:82