Chemis...e::SDF(3pm)
β¨ Chemistry::File::SDF β the MDL Structure Data File reader/writer π
okay bestie, welcome to the Chemis...e::SDF(3pm) page, straight outta the User Contributed Perl Documentation π
this is the module that reads and writes MDL Structure Data Files, and honestly? she's iconic. let's get into it π¦
πΈ SYNOPSIS πΈ
no cap, here's how you use her:
use Chemistry::File::SDF;
# Simple interface (all at once)
# read all the molecules in the file
my @mols = Chemistry::Mol->read('myfile.sdf');
# assuming that the file includes a <PKA> data item...
print $mols[0]->attr("sdf/data")->{PKA};
# write a bunch of molecules to an SDF file
Chemistry::Mol->write('myfile.sdf', mols => \@mols);
# or write just one molecule
$mol->write('myfile.sdf');
# Low level interface (one at a time)
# create reader
my $reader = Chemistry::Mol->file('myfile.sdf');
$reader->open('<');
while (my $mol = $reader->read_mol($reader->fh)) {
# do something with $mol
}
see how there's two whole vibes in there? the simple interface grabs everything at once (main character energy, no waiting), and the low level interface hands you one molecule at a time like a lil conveyor belt π
π DESCRIPTION π
MDL SDF (V2000) reader. periodt, that's the whole job.
This module automatically registers the 'sdf' format with Chemistry::Mol β¨ so like, you don't have to do anything, she just shows up and slays.
The parser returns a list of Chemistry::Mol objects π SDF data can be accessed by the $mol->attr method. Attribute names are stored as a hash ref at the "sdf/data" attribute, as shown in the synopsis (iykyk). When a data item has a single line in the SDF file, the attribute is stored as a string; when there's more than one line, they are stored as an array reference π The rest of the information on the line that holds the field name is ignored β literally just tossed, no thoughts.
This module is part of the PerlMol project, <https://github.com/perlmol> π«Ά
π CAVEATS π
okay listen, bestie, important stuff, don't skip this:
Note that by storing the SDF data as a hash, there can be only one field with a given name π The SDF format description is not entirely clear in this regard. The SDF format description is giving "we forgot to decide" fr fr.
Also note that SDF data field names are considered to be case-sensitive π₯ so PKA and pka are NOT the same thing, don't come for me.
π§ SOURCE CODE REPOSITORY π§
<https://github.com/perlmol/Chemistry-File-MDLMol> β go look, go star, go vibe check the source π
β SEE ALSO β
Chemistry::Molπ- The MDL file format specification. <http://www.mdl.com/downloads/public/ctfile/ctfile.pdf> β or Arthur Dalby et al., J. Chem. Inf. Comput. Sci, 1992, 32, 244-255 π
π AUTHOR π
Ivan Tubert-Brohman <itub@cpan.org> π
absolute legend.
π COPYRIGHT π
Copyright (c) 2009 Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
and that's the whole page, bestie!! this was perl v5.32.1, dated 2022-02-06, and it lives at Chemis...e::SDF(3pm) π go read some molecules, you got this β¨π¦
π¦ where this page comes from
- debian bookworm: libchemistry-file-mdlmol-perl 0.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libchemistry-file-mdlmol-perl 0.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libchemistry-file-mdlmol-perl 0.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libchemistry-file-mdlmol-perl 0.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libchemistry-file-mdlmol-perl 0.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libchemistry-file-mdlmol-perl 0.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms