You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow multiple file endings for a FileType [490] #490
Currently we have a 1:1 mapping between file type and file endings (except some special cases), but for some file types more then one file ending is regularly used (e.g., csv vs tsv or fasta and fa).
The question is how this should be handled by OpenMS.
introduce a 1:N mapping
register the different endings as individual file types
both solutions have their individual downsides. The 1:N mapping for instance would make CSV and TSV completely equal, which is not always the case. Introducing a new file type for each ending would make the code more complex since we need to handle more types.
This is still only partially implemented in current develop. We have special cases for .pep.xml, .prot.xml and .pqt, but no central alias list. File-dialog filters still use the canonical extension, and TOPPAS checks literal suffixes. See FileTypes.cpp, FileHandler.cpp and TOPPASEdge.cpp.
I suggest keeping one FileTypes::Type per format, with one preferred extension and a list of accepted aliases. CSV and TSV remain separate types; having multiple extensions does not imply merging different formats.
Add a central extension registry. Extend the existing type annotations with aliases and expose an API such as FileTypes::typeToExtensions(Type), returning the preferred extension first. Keep enum values and typeToName() results unchanged. Make nameToType() recognize aliases case-insensitively. Start with fasta/fa/faa, pepXML/pep.xml, protXML/prot.xml and parquet/pqt. Reject duplicate aliases across types; do not make ambiguous suffixes such as generic .xml aliases for specific XML formats.
Use the registry for filename handling. Replace the scattered extension special cases with a shared matcher that checks dot-delimited suffixes on the basename and chooses the longest match, so .pep.xml wins over .xml. Preserve xquest.xml/spec.xml, extensionless fid, directory formats and existing .gz/.bz2/.zip handling. Filename-only detection must remain usable for output files that do not exist. Keep content detection as a separate fallback for inputs. Return the matched suffix span so stripExtension() and swapExtension() remove the actual extension, including compound and compression suffixes, instead of searching the path for the canonical type name.
Apply aliases consistently during validation. Use the shared matching logic in TOPPBase and TOPPAS, including file lists and tool-to-tool connections. Compare recognized formats by type. Preserve explicitly declared custom extensions and wildcard behavior; two unrecognized strings must not become equivalent just because both map to UNKNOWN. Keep unknown-format handling explicit for each caller. Compression suffixes must not by themselves imply compatibility with every input type, and recognizing a compressed filename must not advertise decompression support that a reader lacks.
Include aliases in filters and parameter metadata. Generate GUI patterns such as FASTA file (*.fasta *.fa *.faa) and expand supported file formats for single-file and file-list parameters in INI/CTD metadata. Deduplicate patterns and keep their order stable. Keep preferred output suffixes and canonical format choices in in_type/out_type unchanged. Check save-dialog filter-to-type round trips and preserve explicitly chosen valid output aliases.
Add regression coverage. Cover canonical names and aliases, mixed case, compound-suffix precedence, existing compressed-name behavior, dotted directories/stems, extension stripping/swapping, and unchanged handling of custom/unknown formats. Add integration checks for CLI single-file/list validation, TOPPAS connections, GUI filters and exported metadata. Verify that genuine mismatches still fail and CSV/TSV remain distinct.
Suggested split: one PR for the registry and filename helpers, followed by a PR for validation, GUI and workflow integration. The issue is complete when aliases work consistently across these paths while existing canonical names and output defaults remain compatible.
Status: boxes 1–4 are done and merged — #10188 (registry and filename helpers) and #10191 (validation, filters, CTD metadata).
Regression coverage is left unticked because one item in it is genuinely outstanding. Unit coverage is in place (aliases, mixed case, compound-suffix precedence, compressed names, dotted directories/stems, stripping/swapping, custom/unknown formats, CSV≠TSV), as are integration checks for CLI validation (TOPP_SimpleSearchEngine_3_fasta_alias and _4_wrong_format), GUI filters (exact filter strings plus the filter-to-type round trip) and exported metadata. TOPPAS connections have no automated test: the repository has no TOPPAS test harness to hook into, so TOPPASEdge's wiring is covered only indirectly through unit tests of the helpers it calls (FileTypes::sameFormat, supportsCompressedReading, FileNameUtils::compressionType). Building that harness is a separate piece of work.
Two things found along the way that are worth recording:
-out db.peff.gz is still accepted for non-XML outputs, which then write uncompressed bytes under a compressed name; UniPEFF rejects it itself today. XML outputs are unaffected, since XMLFile::save_ genuinely compresses by suffix. Closing this needs a write-side counterpart to COMPRESSED_READABLE and is outside this issue's scope.
A FileType can now carry several extensions: TypeNameBinding in src/openms/source/FORMAT/FileTypes.cpp has an aliases list (:32-34), with the rule that the preferred extension is what typeToName() returns and what gets written, while aliases are only accepted on input and must be unambiguous across types (FileTypes_test enforces uniqueness).
Landed via 70ee9b8 ("Support file type aliases and improve extension matching", #10188) and 3f80b00 ("Honour file type aliases in validation, filters and CTD metadata (#490)", #10191).
Activity
jpfeuffer commentedon Nov 5, 2016
Do we support this by now?
timosachsenberg commentedon Nov 6, 2016
If we introduced support for multiple file endings, would KNIME and GKN work properly with them?
timosachsenberg commentedon Sep 5, 2026
This is still only partially implemented in current
develop. We have special cases for.pep.xml,.prot.xmland.pqt, but no central alias list. File-dialog filters still use the canonical extension, and TOPPAS checks literal suffixes. See FileTypes.cpp, FileHandler.cpp and TOPPASEdge.cpp.I suggest keeping one
FileTypes::Typeper format, with one preferred extension and a list of accepted aliases. CSV and TSV remain separate types; having multiple extensions does not imply merging different formats.Add a central extension registry. Extend the existing type annotations with aliases and expose an API such as
FileTypes::typeToExtensions(Type), returning the preferred extension first. Keep enum values andtypeToName()results unchanged. MakenameToType()recognize aliases case-insensitively. Start withfasta/fa/faa,pepXML/pep.xml,protXML/prot.xmlandparquet/pqt. Reject duplicate aliases across types; do not make ambiguous suffixes such as generic.xmlaliases for specific XML formats.Use the registry for filename handling. Replace the scattered extension special cases with a shared matcher that checks dot-delimited suffixes on the basename and chooses the longest match, so
.pep.xmlwins over.xml. Preservexquest.xml/spec.xml, extensionlessfid, directory formats and existing.gz/.bz2/.ziphandling. Filename-only detection must remain usable for output files that do not exist. Keep content detection as a separate fallback for inputs. Return the matched suffix span sostripExtension()andswapExtension()remove the actual extension, including compound and compression suffixes, instead of searching the path for the canonical type name.Apply aliases consistently during validation. Use the shared matching logic in TOPPBase and TOPPAS, including file lists and tool-to-tool connections. Compare recognized formats by type. Preserve explicitly declared custom extensions and wildcard behavior; two unrecognized strings must not become equivalent just because both map to
UNKNOWN. Keep unknown-format handling explicit for each caller. Compression suffixes must not by themselves imply compatibility with every input type, and recognizing a compressed filename must not advertise decompression support that a reader lacks.Include aliases in filters and parameter metadata. Generate GUI patterns such as
FASTA file (*.fasta *.fa *.faa)and expand supported file formats for single-file and file-list parameters in INI/CTD metadata. Deduplicate patterns and keep their order stable. Keep preferred output suffixes and canonical format choices inin_type/out_typeunchanged. Check save-dialog filter-to-type round trips and preserve explicitly chosen valid output aliases.Add regression coverage. Cover canonical names and aliases, mixed case, compound-suffix precedence, existing compressed-name behavior, dotted directories/stems, extension stripping/swapping, and unchanged handling of custom/unknown formats. Add integration checks for CLI single-file/list validation, TOPPAS connections, GUI filters and exported metadata. Verify that genuine mismatches still fail and CSV/TSV remain distinct.
Suggested split: one PR for the registry and filename helpers, followed by a PR for validation, GUI and workflow integration. The issue is complete when aliases work consistently across these paths while existing canonical names and output defaults remain compatible.
Status: boxes 1–4 are done and merged — #10188 (registry and filename helpers) and #10191 (validation, filters, CTD metadata).
Regression coverage is left unticked because one item in it is genuinely outstanding. Unit coverage is in place (aliases, mixed case, compound-suffix precedence, compressed names, dotted directories/stems, stripping/swapping, custom/unknown formats, CSV≠TSV), as are integration checks for CLI validation (
TOPP_SimpleSearchEngine_3_fasta_aliasand_4_wrong_format), GUI filters (exact filter strings plus the filter-to-type round trip) and exported metadata. TOPPAS connections have no automated test: the repository has no TOPPAS test harness to hook into, soTOPPASEdge's wiring is covered only indirectly through unit tests of the helpers it calls (FileTypes::sameFormat,supportsCompressedReading,FileNameUtils::compressionType). Building that harness is a separate piece of work.Two things found along the way that are worth recording:
stripExtension("fid.gz")used to throwException::IndexOverflowondevelop— it located the canonical namefidat offset 0 and computedprefix(filename, pos - 1), underflowing. Fixed in Support file type aliases and improve extension matching #10188.-out db.peff.gzis still accepted for non-XML outputs, which then write uncompressed bytes under a compressed name;UniPEFFrejects it itself today. XML outputs are unaffected, sinceXMLFile::save_genuinely compresses by suffix. Closing this needs a write-side counterpart toCOMPRESSED_READABLEand is outside this issue's scope.Generated by Claude Code
[FEATURE] FileTypes: central extension registry with per-type aliases (…
[FEATURE] Honour file type aliases in validation, filters and CTD met…
Support file type aliases and improve extension matching (#10188)
[FEATURE] Honour file type aliases in validation, filters and CTD met…
[FEATURE] Honour file type aliases in validation, filters and CTD met…
timosachsenberg commentedon Sep 21, 2026
Resolved on
develop(verified @c5403a8).A
FileTypecan now carry several extensions:TypeNameBindinginsrc/openms/source/FORMAT/FileTypes.cpphas analiaseslist (:32-34), with the rule that the preferred extension is whattypeToName()returns and what gets written, while aliases are only accepted on input and must be unambiguous across types (FileTypes_testenforces uniqueness).Landed via
70ee9b8("Support file type aliases and improve extension matching", #10188) and3f80b00("Honour file type aliases in validation, filters and CTD metadata (#490)", #10191).Proposing to close.
Generated by Claude Code