Repository navigation
Expand file tree
/
Copy pathFileTypes.cpp
More file actions
375 lines (341 loc) · 20.5 KB
/
Copy pathFileTypes.cpp
File metadata and controls
375 lines (341 loc) · 20.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
// SPDX-License-Identifier: BSD-3-Clause
//
// --------------------------------------------------------------------------
// $Maintainer: Timo Sachsenberg $
// $Authors: Stephan Aiche, Andreas Bertsch, Marc Sturm, Chris Bielow $
// --------------------------------------------------------------------------
#include <OpenMS/FORMAT/FileTypes.h>
#include <OpenMS/CONCEPT/Exception.h>
#include <OpenMS/DATASTRUCTURES/ListUtils.h>
#include <array>
#include <cctype>
#include <list>
#include <utility>
#include <cassert>
namespace OpenMS
{
/// connect the type to some other information
/// We could also use paired arrays, but this way, its less likely to have mismatches if a new type is added
struct TypeNameBinding
{
FileTypes::Type type;
std::string name;
std::string description;
std::vector<FileTypes::FileProperties> features;
/// additional extensions accepted for this type, besides 'name' (which stays the preferred one)
std::vector<std::string> aliases;
TypeNameBinding(FileTypes::Type ptype, std::string pname, std::string pdescription, std::vector<FileTypes::FileProperties> pfeatures, std::vector<std::string> paliases = {})
: type(ptype), name(std::move(pname)), description(std::move(pdescription)), features(pfeatures), aliases(std::move(paliases))
{
// Check that there are no double-spaces in the description, since Qt will replace " " with " " in filters supplied to QFileDialog::getSaveFileName.
// And if you later ask for the selected filter, you will get a different string back.
assert(!description.contains(" "));
}
};
using PROP = FileTypes::FileProperties; // shorten our syntax a bit
/// Maps the FileType::Type to its preferred extension plus any additional accepted extensions.
/// The preferred extension is what typeToName() returns and what we write; the aliases are only ever accepted on input.
/// An alias must be unique across all types (FileTypes_test enforces this), and must not be a suffix that other formats
/// also use (e.g. a plain 'xml' alias would make 'pepXML' and 'mzML' ambiguous).
/// when adding new types, be sure to update the FileTypes_test typesWithProperties test to match the new files
static const std::array<TypeNameBinding, FileTypes::SIZE_OF_TYPE> type_with_annotation__ =
{
TypeNameBinding(FileTypes::UNKNOWN, "unknown", "unknown file extension", {}),
TypeNameBinding(FileTypes::DTA, "dta", "dta raw data file", {PROP::PROVIDES_EXPERIMENT, PROP::PROVIDES_SPECTRUM, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::DTA2D, "dta2d", "dta2d raw data file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::MZDATA, "mzData", "mzData raw data file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
TypeNameBinding(FileTypes::MZXML, "mzXML", "mzXML raw data file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
TypeNameBinding(FileTypes::FEATUREXML, "featureXML", "OpenMS feature map", {PROP::PROVIDES_FEATURES, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
TypeNameBinding(FileTypes::IDXML, "idXML", "OpenMS peptide identification file", {PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::CONSENSUSXML, "consensusXML", "OpenMS consensus feature map", {PROP::PROVIDES_CONSENSUSFEATURES, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
TypeNameBinding(FileTypes::MGF, "mgf", "mascot generic format file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::INI, "ini", "OpenMS parameter file", {PROP::READABLE, PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::TOPPAS, "toppas", "OpenMS TOPPAS pipeline", {PROP::READABLE, PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::TRANSFORMATIONXML, "trafoXML", "RT transformation file", {PROP::PROVIDES_TRANSFORMATIONS, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::MZML, "mzML", "mzML raw data file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
//TODO: Add support for cachedMZML as a first class file type
TypeNameBinding(FileTypes::CACHEDMZML, "cachedMzML", "cachedMzML raw data file", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::MS2, "ms2", "ms2 file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE}),
TypeNameBinding(FileTypes::PEPXML, "pepXML", "pepXML file", {PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE}, {"pep.xml"}), //Supported for loading and storing identifications but TODO integrate this into fileHandler
TypeNameBinding(FileTypes::PROTXML, "protXML", "protXML file", {PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::COMPRESSED_READABLE}, {"prot.xml"}),
TypeNameBinding(FileTypes::MZIDENTML, "mzid", "mzIdentML file", {PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
TypeNameBinding(FileTypes::MZQC, "mzqc", "quality control file in json format", {PROP::PROVIDES_QC, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::GELML, "gelML", "gelML file", {}),
TypeNameBinding(FileTypes::TRAML, "traML", "transition file", {PROP::PROVIDES_TRANSITIONS, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
TypeNameBinding(FileTypes::MSP, "msp", "NIST spectra library file format", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::OMSSAXML, "omssaXML", "omssaXML file", {PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::MASCOTXML, "mascotXML", "mascotXML file", {PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::PNG, "png", "portable network graphics file", {}),
TypeNameBinding(FileTypes::XMASS, "fid", "XMass analysis file", {PROP::PROVIDES_EXPERIMENT, PROP::PROVIDES_SPECTRUM, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::TSV, "tsv", "tab-separated file", {PROP::PROVIDES_FEATURES, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::MZTAB, "mzTab", "mzTab file", {}), //TODO add filehandler support for MZTAB
TypeNameBinding(FileTypes::PEPLIST, "peplist", "SpecArray file", {PROP::PROVIDES_FEATURES, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::HARDKLOER, "hardkloer", "hardkloer file", {}),
TypeNameBinding(FileTypes::KROENIK, "kroenik", "kroenik file", {PROP::PROVIDES_FEATURES, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::BEDRMOD, "bedrmod", "bedRMod file", {}, {"bedmethyl"}),
TypeNameBinding(FileTypes::FASTA, "fasta", "FASTA file", {PROP::READABLE, PROP::WRITEABLE}, {"fa", "faa"}),
TypeNameBinding(FileTypes::PEFF, "peff", "PEFF protein file", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::EDTA, "edta", "enhanced dta file", {PROP::PROVIDES_FEATURES, PROP::PROVIDES_CONSENSUSFEATURES, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::CSV, "csv", "comma-separated values file", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::TXT, "txt", "generic text file", {}),
TypeNameBinding(FileTypes::OBO, "obo", "controlled vocabulary file", {}),
TypeNameBinding(FileTypes::HTML, "html", "any HTML file", {}),
TypeNameBinding(FileTypes::ANALYSISXML, "analysisXML", "analysisXML file", {}),
TypeNameBinding(FileTypes::XSD, "xsd", "XSD schema format", {}),
TypeNameBinding(FileTypes::PSQ, "psq", "NCBI binary blast db", {}),
TypeNameBinding(FileTypes::MRM, "mrm", "SpectraST MRM list", {PROP::READABLE}),
TypeNameBinding(FileTypes::SQMASS, "sqMass", "SQLite format for mass and chromatograms", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::PQP, "pqp", "pqp file", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::OSWPQ, "oswpq", "OpenSwath Parquet bundle", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::MS, "ms", "SIRIUS file", {}),
TypeNameBinding(FileTypes::OSW, "osw", "OpenSwath output files", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::CHROMPARQUET, "xic", "OpenSwath Parquet chromatogram output", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::MOBILPARQUET, "xim", "OpenSwath Parquet mobilogram output", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::PEAKMAPPARQUET, "xipm", "OpenSwath Parquet peak-map output", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::PSMS, "psms", "Percolator tab-delimited output (PSM level)", {PROP::READABLE}),
TypeNameBinding(FileTypes::PIN, "pin", "Percolator tab-delimited input (PSM level)", {}),
TypeNameBinding(FileTypes::PARAMXML, "paramXML", "OpenMS internal XML file", {PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::SPLIB, "splib", "SpectraST binary spectral library file", {}),
TypeNameBinding(FileTypes::NOVOR, "novor", "Novor custom parameter file", {}),
TypeNameBinding(FileTypes::XQUESTXML, "xquest.xml", "xquest.xml file", {PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE, PROP::COMPRESSED_WRITEABLE}),
TypeNameBinding(FileTypes::SPECXML, "spec.xml", "spec.xml file", {}),
TypeNameBinding(FileTypes::JSON, "json", "JavaScript Object Notation file", {PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::RAW, "raw", "(Thermo) Raw data file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::COMPRESSED_READABLE}), // .raw.zip via ZipArchiveFile
TypeNameBinding(FileTypes::OMS, "oms", "OpenMS SQLite file", {PROP::PROVIDES_IDENTIFICATIONS, PROP::PROVIDES_FEATURES, PROP::PROVIDES_CONSENSUSFEATURES}),
TypeNameBinding(FileTypes::EXE, "exe", "Windows executable", {}),
TypeNameBinding(FileTypes::BZ2, "bz2", "bzip2 compressed file", {PROP::READABLE}),
TypeNameBinding(FileTypes::GZ, "gz", "gzip compressed file", {PROP::READABLE}),
TypeNameBinding(FileTypes::ZIP, "zip", "ZIP compressed file", {PROP::READABLE}),
TypeNameBinding(FileTypes::PARQUET, "parquet", "Apache Parquet file", {PROP::READABLE, PROP::WRITEABLE}, {"pqt"}),
TypeNameBinding(FileTypes::IDPARQUET, "idparquet", "OpenMS identification parquet bundle (directory)", {PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::FEATUREPARQUET, "featureparquet", "OpenMS feature map parquet bundle (directory)", {PROP::PROVIDES_FEATURES, PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::CONSENSUSPARQUET, "consensusparquet", "OpenMS consensus map parquet bundle (directory)", {PROP::PROVIDES_CONSENSUSFEATURES, PROP::PROVIDES_IDENTIFICATIONS, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::BRUKER_TDF, "d", "Bruker TDF", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::COMPRESSED_READABLE}), // .d.zip via ZipArchiveFile
TypeNameBinding(FileTypes::IMZML, "imzML", "imzML mass spectrometry imaging file", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE, PROP::COMPRESSED_READABLE}),
TypeNameBinding(FileTypes::YAML, "yaml", "YAML file", {PROP::WRITEABLE}),
TypeNameBinding(FileTypes::MZPEAK, "mzpeak", "mzPeak raw data file (HUPO-PSI, Parquet in a ZIP archive or a directory)", {PROP::PROVIDES_EXPERIMENT, PROP::READABLE, PROP::WRITEABLE}),
TypeNameBinding(FileTypes::XML, "xml", "any XML file", {PROP::READABLE, PROP::COMPRESSED_READABLE}), // make sure this comes last, since the name is a suffix of other formats and should only be matched last
};
FileTypeList::FileTypeList(const std::vector<FileTypes::Type>& types)
: type_list_(types)
{
}
bool FileTypeList::contains(const FileTypes::Type& type) const
{
for (const auto& t : type_list_)
{
if (t == type)
{
return true;
}
}
return false;
}
std::string FileTypeList::toFileDialogFilter(const FilterLayout style, bool add_all_filter) const
{
return ListUtils::concatenate(asFilterElements_(style, add_all_filter).items, ";;");
}
FileTypes::Type FileTypeList::fromFileDialogFilter(const std::string& filter, const FileTypes::Type fallback) const
{
auto candidates = asFilterElements_(FilterLayout::BOTH, true); // may add more filters than needed, but that's fine
auto where = std::find(candidates.items.begin(), candidates.items.end(), filter);
if (where == candidates.items.end())
{
throw Exception::ElementNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filter);
}
const FileTypes::Type r = candidates.types[where - candidates.items.begin()];
return r == FileTypes::Type::UNKNOWN ? fallback : r;
}
std::vector<FileTypes::Type> FileTypeList::typesWithProperties(std::vector<FileTypes::FileProperties> haveFeatures)
{
std::vector<FileTypes::Type> compatible;
std::vector<TypeNameBinding> good_types(type_with_annotation__.begin(), type_with_annotation__.end());
// for each feature we are looking for
for (auto i : haveFeatures)
{
// Remove any types that lack the feature
good_types.erase(std::remove_if(good_types.begin(), good_types.end(),[i](auto j) { return (std::find(j.features.begin(),j.features.end(),i) == j.features.end()); }), good_types.end());
}
for (const auto& t : good_types)
{
compatible.push_back(t.type);
}
return compatible;
}
FileTypeList::FilterElements_ FileTypeList::asFilterElements_(const FilterLayout style, bool add_all_filter) const
{
FilterElements_ result;
if (style == FilterLayout::COMPACT || style == FilterLayout::BOTH)
{
StringList items;
for (const auto& t : type_list_)
{
for (const auto& ext : FileTypes::typeToExtensions(t))
{
const std::string pattern = "*." + ext;
// the same alias can only belong to one type, but a type may appear twice in type_list_
if (!ListUtils::contains(items, pattern)) items.push_back(pattern);
}
}
result.items.emplace_back("all readable files (" + ListUtils::concatenate(items, " ") + ")");
result.types.push_back(FileTypes::Type::UNKNOWN); // cannot associate a single type to a collection
}
if (style == FilterLayout::ONE_BY_ONE || style == FilterLayout::BOTH)
{
for (const auto& t : type_list_)
{
// e.g. 'FASTA file (*.fasta *.fa *.faa)'; the preferred extension comes first, which is the one
// Qt appends when this filter is picked in a save dialog
StringList patterns;
for (const auto& ext : FileTypes::typeToExtensions(t)) patterns.push_back("*." + ext);
result.items.push_back(FileTypes::typeToDescription(t) + " (" + ListUtils::concatenate(patterns, " ") + ")");
result.types.push_back(t);
}
}
if (add_all_filter)
{
result.items.emplace_back("all files (*)");
result.types.push_back(FileTypes::Type::UNKNOWN); // cannot associate a single type to a collection
}
return result;
}
std::string FileTypes::typeToName(FileTypes::Type type)
{
for (const auto& t_info : type_with_annotation__)
{
if (t_info.type == type)
{
return t_info.name;
}
}
throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Invalid type: Type has no name!",StringUtils::toStr(type));
}
std::string FileTypes::typeToDescription(Type type)
{
for (const auto& t_info : type_with_annotation__)
{
if (t_info.type == type) return t_info.description;
}
throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Invalid type: Type has no description!",StringUtils::toStr(type));
}
std::vector<std::string> FileTypes::typeToExtensions(Type type)
{
for (const auto& t_info : type_with_annotation__)
{
if (t_info.type == type)
{
std::vector<std::string> result {t_info.name}; // preferred extension first
result.insert(result.end(), t_info.aliases.begin(), t_info.aliases.end());
return result;
}
}
throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Invalid type: Type has no extensions!", StringUtils::toStr(type));
}
namespace
{
/// Case-insensitive equality without allocating a converted copy of either side.
/// nameToType() runs this over the whole registry and sits in TOPPAS' per-file edge checks.
bool equalsCaseInsensitive(const std::string& lhs, const std::string& rhs)
{
return lhs.size() == rhs.size()
&& std::equal(lhs.begin(), lhs.end(), rhs.begin(),
[](char a, char b) { return std::toupper(static_cast<unsigned char>(a)) == std::toupper(static_cast<unsigned char>(b)); });
}
}
FileTypes::Type FileTypes::nameToType(const std::string& name)
{
// preferred extensions take precedence over aliases, so an alias can never shadow another type's canonical name
for (const auto& t_info : type_with_annotation__)
{
if (equalsCaseInsensitive(t_info.name, name)) return t_info.type;
}
for (const auto& t_info : type_with_annotation__)
{
for (const auto& alias : t_info.aliases)
{
if (equalsCaseInsensitive(alias, name)) return t_info.type;
}
}
return FileTypes::UNKNOWN;
}
bool FileTypes::supportsCompressedReading(Type type, Type compression)
{
if (compression != FileTypes::GZ && compression != FileTypes::BZ2 && compression != FileTypes::ZIP)
{
return false;
}
// Bruker's '.d.zip' and Thermo's '.raw.zip' are unpacked by their readers (BrukerTimsFile, ThermoRawFile), not by
// XMLFile, and only for ZIP
if (type == FileTypes::BRUKER_TDF || type == FileTypes::RAW)
{
return compression == FileTypes::ZIP;
}
for (const auto& t_info : type_with_annotation__)
{
if (t_info.type == type)
{
return std::find(t_info.features.begin(), t_info.features.end(), PROP::COMPRESSED_READABLE) != t_info.features.end();
}
}
return false;
}
bool FileTypes::supportsCompressedWriting(Type type, Type compression)
{
// OSWPQ writers store a ZIP archive whatever the name, so only '.oswpq.zip' describes the result
if (type == FileTypes::OSWPQ)
{
return compression == FileTypes::ZIP;
}
// XMLFile::save_ writes gzip or bzip2 but no ZIP archive
if (compression != FileTypes::GZ && compression != FileTypes::BZ2)
{
return false;
}
for (const auto& t_info : type_with_annotation__)
{
if (t_info.type == type)
{
return std::find(t_info.features.begin(), t_info.features.end(), PROP::COMPRESSED_WRITEABLE) != t_info.features.end();
}
}
return false;
}
bool FileTypes::sameFormat(const std::string& lhs, const std::string& rhs)
{
const FileTypes::Type lhs_type = nameToType(lhs);
const FileTypes::Type rhs_type = nameToType(rhs);
if (lhs_type != FileTypes::UNKNOWN && rhs_type != FileTypes::UNKNOWN)
{
return lhs_type == rhs_type; // 'fasta' and 'fa' are the same format
}
// at least one side is a custom/unknown extension: two of those are only equal if they are spelled the same,
// otherwise every unrecognized format would match every other one through UNKNOWN
return equalsCaseInsensitive(lhs, rhs);
}
bool FileTypes::isDirectoryType(Type type)
{
return type == FileTypes::BRUKER_TDF
|| type == FileTypes::IDPARQUET
|| type == FileTypes::FEATUREPARQUET
|| type == FileTypes::CONSENSUSPARQUET;
}
std::string FileTypes::typeToMZML(FileTypes::Type type)
{
switch (type)
{
case FileTypes::DTA: return "DTA file";
case FileTypes::DTA2D: return "DTA file"; // technically not correct, but closer than just a random CV term (currently mzData) - entry cannot be left empty
case FileTypes::MZML: return "mzML file";
case FileTypes::IMZML: return "mzML file"; // imzML is mzML 1.1 + IMS; reuse mzML source file term
case FileTypes::MZDATA: return "PSI mzData file";
case FileTypes::MZXML: return "ISB mzXML file";
case FileTypes::MGF: return "Mascot MGF file";
case FileTypes::XMASS: return "Bruker FID file";
case FileTypes::BRUKER_TDF: return "Bruker TDF format";
case FileTypes::RAW: return "Thermo RAW format";
case FileTypes::MZPEAK: return "mzPeak format";
default: return "";
}
}
}