OpenMS  3.0.0
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-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: 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 
150  PeptideIndexing();
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 
DefaultParamHandler.h
OpenMS::PeptideIndexing::MissingDecoy
MissingDecoy
Definition: PeptideIndexing.h:140
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
FileHandler.h
Size
OpenMS::PeptideIndexing::PEPTIDE_IDS_EMPTY
Definition: PeptideIndexing.h:125
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.
StringUtilsSimple.h
OpenMS::String
A more convenient string class.
Definition: String.h:58
FASTAContainer.h
OpenMS::PeptideIndexing::Unmatched
Unmatched
Action to take when peptide hits could not be matched.
Definition: PeptideIndexing.h:131
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
IdXMLFile.h
OpenMS::PeptideIndexing::run
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
OpenMS::ParamValue::toBool
bool toBool() const
Conversion to bool.
OpenMS::PeptideIndexing::UNEXPECTED_RESULT
Definition: PeptideIndexing.h:127
ListUtils.h
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS::IdXMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &protein_ids, std::vector< PeptideIdentification > &peptide_ids)
Loads the identifications of an idXML file without identifier.
OpenMS::Exception::InvalidParameter
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:339
OpenMS::Int
int Int
Signed integer type.
Definition: Types.h:102
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
ProgressLogger.h
FASTAFile.h
OpenMS::FASTAContainer< TFI_Vector >
FASTAContainer<TFI_Vector> simply takes an existing vector of FASTAEntries and provides the same inte...
Definition: FASTAContainer.h:245
ProteinIdentification.h
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::DefaultParamHandler::getParameters
const Param & getParameters() const
Non-mutable access to the parameters.
OpenMS::PeptideIndexing::ExitCodes
ExitCodes
Exit codes.
Definition: PeptideIndexing.h:121
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
OpenMS::Param::update
bool update(const Param &p_outdated, const bool add_unknown=false)
Rescue parameter values from p_outdated to current param.
OpenMS::PeptideIndexing::AUTO_MODE
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
OpenMS::OpenMS_Log_debug
Logger::LogStream OpenMS_Log_debug
Global static instance of a LogStream to capture messages classified as debug output....
OpenMS::File::findDatabase
static String findDatabase(const String &db_name)
OpenMS::PeptideIndexing::DATABASE_EMPTY
Definition: PeptideIndexing.h:124
OpenMS::PeptideIndexing
Refreshes the protein references for all peptide hits in a vector of PeptideIdentifications and adds ...
Definition: PeptideIndexing.h:113
OpenMS::File::readable
static bool readable(const String &file)
Return true if the file exists and is readable.
PeptideIndexing.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OPENMS_LOG_INFO
#define OPENMS_LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:465
OpenMS::PeptideIndexing::EXECUTION_OK
Definition: PeptideIndexing.h:123
PeptideIdentification.h
OpenMS::PeptideIndexing::ILLEGAL_PARAMETERS
Definition: PeptideIndexing.h:126
OpenMS::Param::getValue
const ParamValue & getValue(const std::string &key) const
Returns a value of a parameter.
StandardTypes.h
File.h
OpenMS::ProgressLogger::setLogType
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
OpenMS::FASTAContainer
template parameter for vector-based FASTA access
Definition: FASTAContainer.h:82
TOPPBase.h
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:68
OpenMS::FASTAContainer< TFI_File >
FASTAContainer<TFI_File> will make FASTA entries available chunk-wise from start to end by loading it...
Definition: FASTAContainer.h:93