The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Chemistry::Reaction - Explicit chemical reactions

SYNOPSIS

    use Chemistry::Reaction;
    use Chemistry::File::SMILES;

    my $s = Chemistry::Pattern->parse('C=CC=C.C=C', format=>'smiles');
    my $p = Chemistry::Pattern->parse('C1=CCCCC1', format=>'smiles');
    my %m;
    for (my $i = 1; $i <= $s->atoms; $i++) {
      $m{$s->atoms($i)} = $p->atoms($i);
    }
    my $r = Chemistry::Reaction->new($s, $p, \%m);

DESCRIPTION

This package, along with Chemistry::Pattern, provides an implementation of explicit chemical reactions.

An explicit chemical reaction is a representation of the transformation that takes place in a given chemical reaction. In an explicit chemical reaction, a substrate molecule is transformed into a product molecule by breaking existing bonds and creating new bonds between atoms.

The representation of an explicit chemical reaction is a molecule in which the order of a bond before the chemical reaction is distinguished from the order of the bond after the chemical reaction. Thus, the breaking of an existing bond is represented by one of the following before/after pairs:

  3/2, 2/1, 1/0 (breaking of a single bond or reduce order by one)
       3/1, 2/0 (breaking of a double bond or reduce order by two)
            3/0 (breaking of a triple bond)

The creation of a new bond is represented by one of the following before/after pairs:

  0/1, 1/2, 2/3 (creation of a single bond or increase order by one)
       0/2, 1/3 (creation of a double bond or increase order by two)
            0/3 (creation of a triple bond)

An explicit chemical reaction $react can be forward or reverse applied once to a molecule $mol at the first subgraph of $mol found which is isomorphic to the substrate or product of $react:

    my $subst = $react->substrate;
    if ($subst->match($mol)) {
      $react->forward($mol, $subst->atom_map);
    }

Also, an explicit chemical reaction $react can be forward or reverse applied once to a molecule $mol at each subgraph of $mol which is isomorphic to the substrate or product of $react:

    my $subst = $react->substrate;
    my @products;
    while ($subst->match($mol)) {
      my $new_mol = $mol->clone; # start from a fresh molecule
      my @map = $subst->atom_map;
      # translate atom map to the clone
      my @m = map { $new_mol->by_id($_->id) } @map;
      $react->forward($new_mol, @m);
      push @products, $new_mol;
    }

Furthermore, an explicit chemical reaction $react can be forward or reverse applied as long as possible to a molecule $mol at the first subgraph of $mol found which is isomorphic to the substrate or product of $react:

    my $subst = $react->substrate;
    while ($subst->match($mol)) {
      $react->forward($mol, $subst->atom_map);
    }

METHODS

Chemistry::Reaction->new($subst, $prod, \%map)

Create a new Reaction object that describes the transformation of the $subst substrate into the $prod product, according to the %map mapping of substrate atoms to product atoms.

$react->substrate

Return a Chemistry::Pattern object that represents the substrate molecules of the explicit chemical reaction $react.

$react->product

Return a Chemistry::Pattern object that represents the product molecules of the explicit chemical reaction $react.

$react->forward($mol, @map)

Forward application of the explicit chemical reaction $react to the molecule $mol, according to the mapping @map of substrate atoms to $mol atoms. The substrate of the explicit chemical reaction $react must be a subgraph of the molecule $mol. Return the modified molecule $mol.

$react->reverse($mol, @map)

Reverse application of the explicit chemical reaction $react to the molecule $mol, according to the mapping @map of product atoms to $mol atoms. The product of the explicit chemical reaction $react must be a subgraph of the molecule $mol. Return the modified molecule $mol.

VERSION

0.02

SEE ALSO

Chemistry::Mol, Chemistry::Pattern, Chemistry::Tutorial

Rosselló, F. and G. Valiente, Analysis of metabolic pathways by graph transformation, in: Proc. 2nd Int. Conf. Graph Transformation, Lecture Notes in Computer Science 3256 (2004), pp. 73--85.

Rosselló, F. and G. Valiente, Chemical graphs, chemical reaction graphs, and chemical graph transformation, in: Proc. 2nd Int. Workshop on Graph-Based Tools, Electronic Notes in Theoretical Computer Science (2004), in press.

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

AUTHOR

Ivan Tubert-Brohman <itub@cpan.org> and Gabriel Valiente <valiente@lsi.upc.es>

COPYRIGHT

Copyright (c) 2004 Ivan Tubert-Brohman and Gabriel Valiente. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 407:

Non-ASCII character seen before =encoding in 'Rosselló,'. Assuming CP1252