From 01016615ece14df85f50158d9efd05973d763717 Mon Sep 17 00:00:00 2001 From: Xavier Robin <xavier.robin@unibas.ch> Date: Thu, 17 Oct 2024 14:15:53 +0200 Subject: [PATCH] SDF reader reads .mol files as well --- modules/io/doc/structure_formats.rst | 9 +++++---- modules/io/src/mol/entity_io_sdf_handler.cc | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/io/doc/structure_formats.rst b/modules/io/doc/structure_formats.rst index 2fe0eaf67..6903ed50f 100644 --- a/modules/io/doc/structure_formats.rst +++ b/modules/io/doc/structure_formats.rst @@ -51,12 +51,13 @@ radii. SDF - Structured Data File ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Chemical table (Ctab) file format (V2000; read-only V3000 experimental support), -aka MDL Molfile. -The SDF format does not support residues, chains or atom names natively. +Chemical table (Ctab) file format, aka SDF, aka MDL Molfile, originally named +after Molecular Design Limited, Inc. Follows the "BIOVIA Databases 2020" format +specification (V2000; read-only V3000 experimental support). The SDF importer supports loading gzipped files, which are auto-detected by the .gz file extension. +The SDF format does not support residues, chains or atom names natively. The reader assigns 1-based atom indices as atom names. SDF files containing several molecules are loaded into distinct chains, named after the molecule name in the MOLfile header with a numerical prefix. @@ -66,5 +67,5 @@ Chains are written as separate molecules. If a chain contains more than one residue, they will be merged into a single molecule. *Recognized File Extensions* - .sdf, .sdf.gz + .sdf, .sdf.gz, .mol, .mol.gz diff --git a/modules/io/src/mol/entity_io_sdf_handler.cc b/modules/io/src/mol/entity_io_sdf_handler.cc index cf1ff10c6..fed25f86b 100644 --- a/modules/io/src/mol/entity_io_sdf_handler.cc +++ b/modules/io/src/mol/entity_io_sdf_handler.cc @@ -70,7 +70,8 @@ bool sdf_handler_is_responsible_for(const boost::filesystem::path& loc, if(type=="auto") { String match_suf_string=loc.string(); std::transform(match_suf_string.begin(),match_suf_string.end(),match_suf_string.begin(),tolower); - if(detail::FilenameEndsWith(match_suf_string,".sdf") || detail::FilenameEndsWith(match_suf_string,".sdf.gz")) { + if(detail::FilenameEndsWith(match_suf_string,".sdf") || detail::FilenameEndsWith(match_suf_string,".sdf.gz") || + detail::FilenameEndsWith(match_suf_string,".mol") || detail::FilenameEndsWith(match_suf_string,".mol.gz")) { return true; } -- GitLab