GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Chemistry::OpenSMILES(3) User Contributed Perl Documentation Chemistry::OpenSMILES(3)

Chemistry::OpenSMILES - OpenSMILES format reader and writer

    use Chemistry::OpenSMILES::Parser;
    my $parser = Chemistry::OpenSMILES::Parser->new;
    my @moieties = $parser->parse( 'C#C.c1ccccc1' );
    $\ = "\n";
    for my $moiety (@moieties) {
        #  $moiety is a Graph::Undirected object
        print scalar $moiety->vertices;
        print scalar $moiety->edges;
    }
    use Chemistry::OpenSMILES::Writer qw(write_SMILES);
    print write_SMILES( \@moieties );

Chemistry::OpenSMILES provides support for SMILES chemical identifiers conforming to OpenSMILES v1.0 specification (<http://opensmiles.org/opensmiles.html>).

Chemistry::OpenSMILES::Parser reads in SMILES strings and returns them parsed to arrays of Graph::Undirected objects. Each atom is represented by a hash.

Chemistry::OpenSMILES::Writer performs the inverse operation. For SMILES writing conventions and options refer to its description.

Disconnected parts of a compound are represented as separate Graph::Undirected objects. Atoms are represented as vertices, and bonds are represented as edges.

Atoms

Atoms, or vertices of a molecular graph, are represented as hash references:

    {
        "symbol"    => "C",
        "isotope"   => 13,
        "chirality" => "@@",
        "hcount"    => 3,
        "charge"    => 1,
        "class"     => 0,
        "number"    => 0,
    }

Except for "symbol", "class" and "number", all keys of hash are optional. Per OpenSMILES specification, default values for "hcount" and "class" are 0.

For chiral atoms, the order of their neighbours in input is preserved in an array added as value for "chirality_neighbours" key of the atom hash. The order of atoms there follow OpenSMILES convention.

Bonds

Bonds, or edges of a molecular graph, rely completely on Graph::Undirected internal representation. Bond orders other than single ("-", which is also a default) are represented as values of edge attribute "bond". They correspond to the symbols used in OpenSMILES specification.

Andrius Merkys, <merkys@cpan.org>

2025-07-04 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.