OpenMS
FileTypes.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Stephan Aiche, Andreas Bertsch, Marc Sturm, Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/config.h>
13 
14 #include <vector>
15 
16 namespace OpenMS
17 {
26  struct OPENMS_DLLAPI FileTypes
27  {
28 
30  enum Type
31  {
33  DTA,
40  MGF,
41  INI,
44  MZML,
46  MS2,
50  QCML,
51  MZQC,
54  MSP,
57  PNG,
59  TSV,
65  EDTA,
66  CSV,
67  TXT,
68  OBO,
69  HTML,
71  XSD,
72  PSQ,
73  MRM,
75  PQP,
76  MS,
77  OSW,
78  PSMS,
79  PIN,
85  JSON,
86  RAW,
87  OMS,
88  EXE,
89  XML,
90  BZ2,
91  GZ,
92  SIZE_OF_TYPE
93  };
94 
95  enum class FileProperties
96  {
97  READABLE, // SOMETHING in OpenMS can read this (it doesn't have to be in FileHandler though)
98  WRITEABLE, // SOMETHING in OpenMS can write this (it doesn't have to be in FileHandler though)
99  PROVIDES_SPECTRUM, // All of the PROVIDES_x properties correspond to which FileHandlers are implemented for a file type.
100  PROVIDES_EXPERIMENT, //
101  PROVIDES_FEATURES, //
102  PROVIDES_CONSENSUSFEATURES, //
103  PROVIDES_IDENTIFICATIONS, //
104  PROVIDES_TRANSITIONS, //
105  PROVIDES_QUANTIFICATIONS, //
106  PROVIDES_TRANSFORMATIONS, //
107  PROVIDES_QC, //
108  SIZE_OF_FILEPROPERTIES // Not a property, just the number of 'em
109  };
110 
112  static String typeToName(Type type);
113 
118 
121  static Type nameToType(const String& name);
122 
124  static String typeToMZML(Type type);
125  };
126 
127  enum class FilterLayout
128  {
129  COMPACT,
130  ONE_BY_ONE,
131  BOTH
132  };
138  class OPENMS_DLLAPI FileTypeList
139  {
140  public:
141  FileTypeList(const std::vector<FileTypes::Type>& types);
142 
144  bool contains(const FileTypes::Type& type) const;
145 
146  const std::vector<FileTypes::Type>& getTypes() const
147  {
148  return type_list_;
149  }
150 
155  String toFileDialogFilter(const FilterLayout style, bool add_all_filter) const;
156 
171  FileTypes::Type fromFileDialogFilter(const String& filter, const FileTypes::Type fallback = FileTypes::Type::UNKNOWN) const;
172 
173 
181  static std::vector<FileTypes::Type> typesWithProperties(const std::vector<FileTypes::FileProperties> features);
182 
183  private:
186  {
187  std::vector<String> items;
188  std::vector<FileTypes::Type> types;
189  };
193  FilterElements_ asFilterElements_(const FilterLayout style, bool add_all_filter) const;
194 
195  std::vector<FileTypes::Type> type_list_;
196  };
197 
198 } // namespace OpenMS
199 
holds a vector of known file types, e.g. as a way to specify supported input formats
Definition: FileTypes.h:139
std::vector< FileTypes::Type > types
Definition: FileTypes.h:188
String toFileDialogFilter(const FilterLayout style, bool add_all_filter) const
std::vector< String > items
Definition: FileTypes.h:187
bool contains(const FileTypes::Type &type) const
check if type is contained in this array
FileTypes::Type fromFileDialogFilter(const String &filter, const FileTypes::Type fallback=FileTypes::Type::UNKNOWN) const
Convert a Qt filter back to a Type if possible.
std::vector< FileTypes::Type > type_list_
Definition: FileTypes.h:195
const std::vector< FileTypes::Type > & getTypes() const
Definition: FileTypes.h:146
FilterElements_ asFilterElements_(const FilterLayout style, bool add_all_filter) const
FileTypeList(const std::vector< FileTypes::Type > &types)
static std::vector< FileTypes::Type > typesWithProperties(const std::vector< FileTypes::FileProperties > features)
Get a std::vector<FileTypes::Type> with all fileTypes that support a set of features.
hold filter items (for Qt dialogs) along with their OpenMS type
Definition: FileTypes.h:186
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
FilterLayout
Definition: FileTypes.h:128
@ BOTH
combine COMPACT and ONE_BY_ONE
@ ONE_BY_ONE
list all types individually, e.g. 'mzML files (*.mzML);;mzXML files (*.mzXML);;'
@ COMPACT
make a single item, e.g. 'all readable files (*.mzML *.mzXML);;'
Centralizes the file types recognized by FileHandler.
Definition: FileTypes.h:27
static String typeToDescription(Type type)
Type
Actual file types enum.
Definition: FileTypes.h:31
@ PSMS
Percolator tab-delimited output (PSM level)
Definition: FileTypes.h:78
@ PIN
Percolator tab-delimited input (PSM level)
Definition: FileTypes.h:79
@ FASTA
FASTA file (.fasta)
Definition: FileTypes.h:64
@ TRAML
TraML (HUPO PSI format) for transitions (.traML)
Definition: FileTypes.h:53
@ MZIDENTML
mzIdentML (HUPO PSI AnalysisXML followup format) (.mzid)
Definition: FileTypes.h:49
@ SPLIB
SpectraST binary spectral library file (sptxt is the equivalent text-based format,...
Definition: FileTypes.h:81
@ QCML
qcML (will undergo standardisation maybe) (.qcml)
Definition: FileTypes.h:50
@ GZ
any Gzipped file
Definition: FileTypes.h:91
@ MGF
Mascot Generic Format (.mgf)
Definition: FileTypes.h:40
@ CSV
general comma separated files format (might also be tab or space separated!!!), data should be regula...
Definition: FileTypes.h:66
@ PARAMXML
internal format for writing and reading parameters (also used as part of CTD)
Definition: FileTypes.h:80
@ INI
OpenMS parameters file (.ini)
Definition: FileTypes.h:41
@ GELML
GelML (HUPO PSI format) (.gelML)
Definition: FileTypes.h:52
@ HARDKLOER
hardkloer file (.hardkloer)
Definition: FileTypes.h:62
@ NOVOR
Novor custom parameter file.
Definition: FileTypes.h:82
@ PSQ
NCBI binary blast db.
Definition: FileTypes.h:72
@ TXT
any text format, which has only loose definition of what it actually contains – thus it is usually ha...
Definition: FileTypes.h:67
@ MSP
NIST spectra library file format (.msp)
Definition: FileTypes.h:54
@ KROENIK
kroenik file (.kroenik)
Definition: FileTypes.h:63
@ XML
any XML format
Definition: FileTypes.h:89
@ DTA2D
DTA2D file (.dta2d)
Definition: FileTypes.h:34
@ UNKNOWN
Unknown file extension.
Definition: FileTypes.h:32
@ CONSENSUSXML
OpenMS consensus map format (.consensusXML)
Definition: FileTypes.h:39
@ FEATUREXML
OpenMS feature file (.featureXML)
Definition: FileTypes.h:37
@ MZTAB
mzTab file (.mzTab)
Definition: FileTypes.h:60
@ PQP
OpenSWATH Peptide Query Parameter (PQP) SQLite DB, see TransitionPQPFile.
Definition: FileTypes.h:75
@ PROTXML
TPP protXML file (.protXML)
Definition: FileTypes.h:48
@ XSD
XSD schema format.
Definition: FileTypes.h:71
@ PNG
Portable Network Graphics (.png)
Definition: FileTypes.h:57
@ PEPLIST
specArray file (.peplist)
Definition: FileTypes.h:61
@ XMASS
XMass Analysis file (fid)
Definition: FileTypes.h:58
@ PEPXML
TPP pepXML file (.pepXML)
Definition: FileTypes.h:47
@ BZ2
any BZ2 compressed file
Definition: FileTypes.h:90
@ TSV
any TSV file, for example msInspect file or OpenSWATH transition file (see TransitionTSVFile)
Definition: FileTypes.h:59
@ MZQC
mzQC (HUPO PSI format) (.mzQC)
Definition: FileTypes.h:51
@ SPECXML
xQuest XML file format for matched spectra for spectra visualization in the xQuest results manager (....
Definition: FileTypes.h:84
@ MS
SIRIUS file format (.ms)
Definition: FileTypes.h:76
@ TRANSFORMATIONXML
Transformation description file (.trafoXML)
Definition: FileTypes.h:43
@ JSON
JavaScript Object Notation file (.json)
Definition: FileTypes.h:85
@ OMSSAXML
OMSSA XML file format for peptide identifications (.xml)
Definition: FileTypes.h:55
@ IDXML
OpenMS identification format (.idXML)
Definition: FileTypes.h:38
@ MZML
MzML file (.mzML)
Definition: FileTypes.h:44
@ RAW
Thermo Raw File (.raw)
Definition: FileTypes.h:86
@ EDTA
enhanced comma separated files (RT, m/z, Intensity, [meta])
Definition: FileTypes.h:65
@ TOPPAS
OpenMS parameters file with workflow information (.toppas)
Definition: FileTypes.h:42
@ XQUESTXML
xQuest XML file format for protein-protein cross-link identifications (.xquest.xml)
Definition: FileTypes.h:83
@ MS2
MS2 file (.ms2)
Definition: FileTypes.h:46
@ SQMASS
SqLite format for mass and chromatograms, see SqMassFile.
Definition: FileTypes.h:74
@ HTML
any HTML format
Definition: FileTypes.h:69
@ ANALYSISXML
analysisXML format
Definition: FileTypes.h:70
@ DTA
DTA file (.dta)
Definition: FileTypes.h:33
@ MASCOTXML
Mascot XML file format for peptide identifications (.xml)
Definition: FileTypes.h:56
@ CACHEDMZML
CachedMzML file (.cachedmzML)
Definition: FileTypes.h:45
@ EXE
Executable (.exe)
Definition: FileTypes.h:88
@ MZDATA
MzData file (.mzData)
Definition: FileTypes.h:35
@ OSW
OpenSWATH OpenSWATH report (OSW) SQLite DB.
Definition: FileTypes.h:77
@ MZXML
MzXML file (.mzXML)
Definition: FileTypes.h:36
@ OMS
OpenMS database file.
Definition: FileTypes.h:87
@ OBO
Controlled Vocabulary format.
Definition: FileTypes.h:68
@ MRM
SpectraST MRM List.
Definition: FileTypes.h:73
static Type nameToType(const String &name)
FileProperties
Definition: FileTypes.h:96
static String typeToMZML(Type type)
Returns the mzML name (TODO: switch to accession since they are more stable!)
static String typeToName(Type type)
Returns the name/extension of the type.