The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Chemistry::File::MDLMol - MDL molfile reader/writer

SYNOPSIS

use Chemistry::File::MDLMol;

# read a molecule
my $mol = Chemistry::Mol->read('myfile.mol');

# write a molecule
$mol->write("myfile.mol");

# use a molecule as a query for substructure matching
use Chemistry::Pattern;
use Chemistry::Ring;
Chemistry::Ring::aromatize_mol($mol);

my $patt = Chemistry::Pattern->read('query.mol');
if ($patt->match($mol)) {
    print "it matches!\n";
}

DESCRIPTION

MDL Molfile (V2000) reader/writer.

This module automatically registers the 'mdl' format with Chemistry::Mol.

The first three lines of the molfile are stored as $mol->name, $mol->attr("mdlmol/line2"), and $mol->attr("mdlmol/comment").

This version only reads and writes some of the information available in a molfile: it reads coordinats, atom and bond types, charges, radicals, and atom lists. It does not read other things such as stereochemistry, 3d properties, isotopes, etc.

This module is part of the PerlMol project, http://www.perlmol.org.

Query properties

The MDL molfile format supports query properties such as atom lists, and special bond types such as "single or double", "single or aromatic", "double or aromatic", "ring bond", or "any". These properties are supported by this module in conjunction with Chemistry::Pattern. However, support for query properies is currently read-only, and the other properties listed in the specification are not supported yet.

When an atom or a bond uses one of these special query options, the condition is represented as a Perl subroutine. The generated code can be read from the 'mdlmol/test_sub' attribute:

   $atom->attr('mdlmol/test_sub');
   $bond->attr('mdlmol/test_sub');

This may be useful for debugging, such as when an atom doesn't seem to match as expected.

VERSION

0.20

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.

The PerlMol website http://www.perlmol.org/

AUTHOR

Ivan Tubert-Brohman <itub@cpan.org>

COPYRIGHT

Copyright (c) 2005 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.