NAME

Chemistry::File::SLN - SLN linear notation parser/writer

SYNOPSYS

#!/usr/bin/perl
use Chemistry::File::SLN;

# parse a SLN string for benzene
my $s = 'C[1]H:CH:CH:CH:CH:CH@1';
my $mol = Chemistry::Mol->parse($s, format => 'sln');

# print a SLN string
print $mol->print(format => 'sln');

# print a unique (canonical) SLN string
print $mol->print(format => 'sln', unique => 1);

# parse a multiline SLN file
my @mols = Chemistry::Mol->read("file.sln", format => 'sln');

# write a multiline SLN file
Chemistry::Mol->write("file.sln", mols => [@mols]);

DESCRIPTION

This module parses a SLN (Sybyl Line Notation) string. This is a File I/O driver for the PerlMol project. http://www.perlmol.org/. It registers the 'sln' format with Chemistry::Mol, and recognizes filenames ending in '.sln'.

Optional attributes for atoms, bonds, and molecules are stored as $atom->attr("sln/attr"), $bond->attr("sln/attr"), and $mol->attr("sln/attr"), respectively. Boolean attributes are stored with a value of 'TRUE'. That's the way boolean attributes are recognized when writing, so that they can be written in the shortened form.

$sln_attr->{backbone} = 1;
# would be ouput as "C[backbone=1]"

$sln_attr->{backbone} = 'TRUE';
# would be ouput as "C[backbone]"

Also note that attribute names are normalized to lowercase on reading.

OPTIONS

The following options are available when reading:

kekulize

Assign bond orders for unsatisfied valences or for aromatic bonds. For example, benzene read as C[1]H:CH:CH:CH:CH:CH@1 will be converted internally to something like C[1]H=CHCH=CHCH=CH@1. This is needed if another format or module expects a Kekule representation without an aromatic bond type.

The following options are available when writing:

mols

If this option points to an array of molecules, these molecules will be written, one per line, as in the example in the SYNOPSYS.

aromatic

Detect aromaticity before writing. This will ensure that aromatic bond types are used instead of alternate single and double bonds.

unique

Canonicalize before writing, and produce a unique strucure. NOTE: this option does not guarantee a unique representation for molecules with bracketed attributes.

name

Include the name of the molecule ($mol->name) in the output string.

coord3d, coords

Include the 3D coordinates of every atom in the molecule in the output string. coord3d and coords may be used interchangeably.

attr

Output the atom, bond, and molecule attributes found in $mol->attr("sln/attr"), etc.

CAVEATS

This version does not implement the full SLN specification. It supports simple structures and some attributes, but it does not support any of the following:

Macro atoms
Pattern matching options
Markush structures
2D Coordinates

The SLN specification is vague on several points, and I don't have a reference implementation available, so I had to make several arbitrary decisions. Also, this version of this module has not been tested exhaustively, so please report any bugs that you find.

If the parser doesn't understand a string, it only says "syntax error", which may not be very helpful.

VERSION

0.10

SEE ALSO

Chemistry::Mol, Chemistry::File, Chemistry::File::SMILES

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

Ash, S.; Cline, M. A.; Homer, R. W.; Hurst, T.; Smith, G. B., SYBYL Line Notation (SLN): A Versatile Language for Chemical Structure Representation. J. Chem. Inf. Comput. Sci; 1997; 37(1); 71-79. DOI: 10.1021/ci960109j (http://dx.doi.org/10.1021/ci960109j)

AUTHOR

Ivan Tubert-Brohman <itub@cpan.org>

COPYRIGHT

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