Chemistry::OpenSMILES::Writer - OpenSMILES format writer
use Graph::Undirected;
use Chemistry::OpenSMILES::Writer qw( write_SMILES );
my $g = Graph::Undirected->new;
$g->add_edge( { symbol => 'C' }, { symbol => 'O' } );
print write_SMILES( [ $g ] );
"Chemistry::OpenSMILES::Writer"
is writer for molecular graph objects created by
Chemistry::OpenSMILES::Parser or other means. It exports a single
subroutine, write_SMILES(), which is given an array
of molecular graph objects and outputs a SMILES representation of them.
@molecules is an array of molecular graph
objects.
Options
- "explicit_aromatic_bonds"
- Boolean flag instructing the writer to output all aromatic bonds as ':'.
Off by default.
- "explicit_parentheses"
- Boolean flag instructing the writer to always enclose "children"
atoms in parentheses. Off by default.
- "immediately_reuse_ring_numbers"
- Boolean flag instructing the writer to immediately reuse ring closure
numbers. On by default. Immediately reused ring numbers might cause some
confusion for human readers, but the benefit of reuse is the ability to
have more open rings at once.
- "remove_implicit_hydrogens"
- Boolean flag instructing the writer to remove hydrogens, expressed as atom
properties, when their number can be unambiguously derived from normal
valency. On by default.
- "unsprout_hydrogens"
- Boolean flag instructing the writer to demote explicit hydrogens
("atoms on their own", "sprouted") to atom properties
of their parent heavy atom. On by default. Not all hydrogens can be
demoted.
- "order_sub"
- Subroutine reference used to determine the next atom in order upon
ambiguity. If none is provided, input order is retained whenever possible.
It should be noted, however, that write_SMILES()
does not necessary respect the order subroutine: if performs DFS merely
guided by the requested order. Thus before calling
write_SMILES() the exact postorder is not known.
Only preorder is known, thus relative properties, such as cis/trans
markers, have to be adjusted to preorder. Other order-dependent markers
have to be adjusted to preorder as well.
Andrius Merkys, <merkys@cpan.org>