| 1 | package Chemistry::Pattern; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 10 | $VERSION = '0.26'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # $Id: Pattern.pm,v 1.19 2005/05/16 22:08:15 itubert Exp $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | Chemistry::Pattern - Chemical substructure pattern matching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | use Chemistry::Pattern; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | use Chemistry::Mol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | use Chemistry::File::SMILES; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # Create a pattern and a molecule from SMILES strings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | my $mol_str = "C1CCCC1C(Cl)=O"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | my $patt_str = "C(=O)Cl"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | my $mol = Chemistry::Mol->parse($mol_str, format => 'smiles'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | my $patt = Chemistry::Pattern->parse($patt_str, format => 'smiles'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # try to match the pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | while ($patt->match($mol)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | @matched_atoms = $patt->atom_map; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | print "Matched: (@matched_atoms)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # should print something like "Matched: (a6 a8 a7)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | This module implements basic pattern matching for molecules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | The Chemistry::Pattern class is a subclass of Chemistry::Mol, so patterns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | have all the properties of molecules and can come from reading the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | file formats. Of course there are certain formats (such as SMARTS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | that are exclusively used to describe patterns. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | To perform a pattern matching operation on a molecule, follow these steps. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1) Create a pattern object, either by parsing a file or string, or by adding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | atoms and bonds by hand by using Chemistry::Mol methods. Note that atoms and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | bonds in a pattern should be Chemistry::Pattern::Atom and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Chemistry::Patern::Bond objects. Let's assume that the pattern object is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | stored in $patt and that the molecule is $mol. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 2) Execute the pattern on the molecule by calling $patt->match($mol). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 3) If $patt->match() returns true, extract the "map" that relates the pattern to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | the molecule by calling $patt->atom_map or $patt->bond_map. These methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | return a list of the atoms or bonds in the molecule that are matched by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | corresponding atoms in the pattern. Thus $patt->atom_map(1) would be analogous | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | to the $1 special variable used for regular expresion matching. The difference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | between Chemistry::Pattern and Perl regular expressions is that atoms and bonds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | are always captured. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 4) If more than one match for the molecule is desired, repeat from step (2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | until match() returns false. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 10 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 10 | ▶ | use base qw(Chemistry::Mol); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 10 | ▶ | use Chemistry::Pattern::Atom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 10 | ▶ | use Chemistry::Pattern::Bond; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | =item Chemistry::Pattern->new(name => value, ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | Create a new empty pattern. This is just like the Chemistry::Mol constructor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | with one additional option: "options", which expects a hash reference (the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | options themselves are described under the options() method). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 11 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 11 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 11 | my $self = $class->SUPER::new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | options => { overlap => 1, permute => 0}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 11 | $self->reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 11 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | =item $pattern->options(option => value,...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | Available options: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =item overlap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | If true, matches may overlap. For example, the CC pattern could match twice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | on propane if this option is true, but only once if it is false. This option | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | is true by default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =item permute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | Sometimes there is more than one way of matching the same set of pattern atoms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | on the same set of molecule atoms. If true, return these "redundant" matches. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | For example, the CC pattern could match ethane with two different permutations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | (forwards and backwards). This option is false by default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 22 | ▶ | sub options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
options: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 22 | ▶ | if (@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 22 | ▶ | $self->{options} = {%{$self->{options}||{}}, %{$_[0]}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'options'} || {}
MC/DC100%1/1
$self->{'options'} || {}
$self->{'options'}
Truth table100%2/2
A
A= $self->{'options'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->{options} = {%{$self->{options}}, @_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 33 | ▶ | sub atom_class { "Chemistry::Pattern::Atom" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
atom_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 22 | ▶ | sub bond_class { "Chemistry::Pattern::Bond" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bond_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 10 | our $DEBUG = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | =item $patt->reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | Reset the state of the pattern matching object, so that it begins the next | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | match from scratch instead of where it left off after the last one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 165 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 165 | my ($self, $mol, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 165 | ▶ | print "Resetting to ($mol, $opts{atom})\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 165 | $self->{flat} = $self->flatten; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 165 | $self->map_to($mol); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 165 | ▶ | $self->{pending_atoms} = [$mol ? $mol->atoms : ()]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 165 | $self->{already_matched} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 165 | $self->{paint_tab} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 165 | $self->{anchor} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 165 | my $atom = $self->next_atom($opts{atom}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | #$self->match_local_init($atom) if $atom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 1519 | ▶ | sub already_matched { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
already_matched: called CC=5 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 1519 | my ($self, @objs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 1519 | my @ids = map {$_->id} @objs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1519 | my $unsorted_key = join " ", @ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 1519 | my $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 1519 | ▶ | if ($self->{options}{permute}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $key = $unsorted_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1519 | $key = join " ", sort @ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1519 | ▶ | if ($self->{already_matched}{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 934 | ▶ | print "already matched $unsorted_key\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 934 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 585 | $self->{already_matched}{$key} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 585 | ▶ | print "first match of $key\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 585 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1562 | ▶ | sub next_atom { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_atom: called CC=6 SCAR=18.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1562 | my ($self, $atom) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1562 | ▶ | print "next_atom\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1562 | ▶ | return if $self->{anchor}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1562 | ▶ | if ($atom) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $self->{anchor} = $atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1562 | } elsif (@{$self->{pending_atoms}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1397 | $atom = shift @{$self->{pending_atoms}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1397 | ▶ | print "\tatom $atom\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1562 | $self->{next_atom} = $atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1562 | $atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 10 | Chemistry::Obj::accessor "map_to"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | =item $pattern->atom_map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | Returns the list of atoms that matched the last time $pattern->match was called. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 2104 | ▶ | sub atom_map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
atom_map: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 2104 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2104 | my @atoms = map { $_->map_to } $self->atoms(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2104 | ▶ | @atoms == 1 ? $atoms[0] : @atoms; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | =item $pattern->bond_map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | Returns the list of bonds that matched the last time $pattern->match was called. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 1519 | ▶ | sub bond_map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bond_map: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1519 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 1519 | my @bonds = map { $_->map_to } $self->bonds(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 1519 | ▶ | @bonds == 1 ? $bonds[0] : @bonds; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | =item $pattern->match($mol, %options) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | Returns true if the pattern matches the molecule. If called again for the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | same molecule, continues matching where it left off (in a way similar to global | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | regular expressions under scalar context). When there are no matches left, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | returns false. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | $pattern->match($mol, atom => $atom) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | If atom => $atom is given as an option, match will only look for matches that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | start at $atom (which should be an atom in $mol, of course). This is somewhat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | analog to anchored regular expressions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | To find out which atoms and bonds matched, use the atom_map and bond_map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 739 | ▶ | sub match { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match: called CC=8 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 739 | my ($self, $mol, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 739 | ▶ | print "match $self $mol\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 739 | ▶ | if (defined($mol) and $self->map_to ne $mol | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
defined $mol and $self->map_to ne $mol or defined $opts{"atom"} and $opts{"atom"} ne $self->{"anchor"}
defined $mol and $self->map_to ne $mol
defined $opts{"atom"} and $opts{"atom"} ne $self->{"anchor"}
MC/DC25%1/4
defined $mol and $self->map_to ne $mol or defined $opts{"atom"} and $opts{"atom"} ne $self->{"anchor"}
defined $mol
$self->map_to ne $mol
defined $opts{"atom"}
$opts{"atom"} ne $self->{"anchor"}
Truth table28%2/7
A and B or C and D
A= defined $molB= $self->map_to ne $molC= defined $opts{"atom"}D= $opts{"atom"} ne $self->{"anchor"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | or defined($opts{atom}) and $opts{atom} ne $self->{anchor}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 154 | $self->reset($mol, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 739 | my $match = $self->match_next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 739 | ▶ | $self->map_to(undef) unless $match; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 739 | ▶ | print "returning match: '$match'\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 739 | $match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 739 | ▶ | sub match_next { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match_next: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 739 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 739 | my $match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 739 | ▶ | print "match_next\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 739 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 2916 | ▶ | $self->match_local_init($self->{next_atom}) if $self->{next_atom}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2916 | $match = $self->match_local_next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 2916 | ▶ | if ($match) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 1519 | ▶ | if ($self->already_matched($self->atom_map, $self->bond_map)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 934 | $match = 0, next; # try again | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 585 | ▶ | $self->next_atom unless ($self->{options}{overlap}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 585 | last; # matched! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1397 | ▶ | $self->next_atom or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 739 | $match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 1397 | ▶ | sub match_local_init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match_local_init: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1397 | my ($patt, $atom) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1397 | my $mol = $patt->map_to; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1397 | ▶ | print "match_local_init(",$patt->atoms(1),", $atom)\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # clean up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 1397 | $_->map_to(undef) for ($patt->atoms, $patt->bonds); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 1397 | ▶ | $patt->{paint_tab} = {} if ($mol and $patt->{options}{overlap}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mol and $patt->{"options"}{"overlap"}
MC/DC0%0/2
$mol and $patt->{"options"}{"overlap"}
$mol
$patt->{"options"}{"overlap"}
Truth table33%1/3
A and B
A= $molB= $patt->{"options"}{"overlap"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 1397 | $patt->{stack} = [[0]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 1397 | $patt->{backtrack} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1397 | $patt->{next_atom} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1397 | $patt->{current_atom} = $atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 2916 | ▶ | sub match_local_next { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match_local_next: called CC=49 SCAR=53.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 2916 | my ($patt) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 2916 | my $stack = $patt->{stack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 2916 | my $paint_tab = $patt->{paint_tab}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2916 | my $match = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 2916 | my $backtrack = $patt->{backtrack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 2916 | my $where = $patt->{current_atom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 2916 | my $flat = $patt->{flat}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 2916 | my $mol = $patt->map_to; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 2916 | ▶ | print "match_local_next($where)\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 2916 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 15721 | my ($idx) = @{$stack->[-1]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 15721 | my $pos = @$stack - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 15721 | my $what = $flat->[$pos]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | if($DEBUG) { print "[@$_] " for @$stack; print "\n" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 15721 | ▶ | if ($backtrack) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 3891 | ▶ | print "\tbacktracking...\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 3891 | ▶ | if (@$stack <= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1306 | ▶ | print "\tnowhere to backtrack\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1306 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 2585 | my $to; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 2585 | pop @$stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 2585 | (undef, $what, $to) = @{$stack->[-1]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 2585 | $backtrack = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 2585 | ▶ | if ($what) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 2585 | ▶ | print "\tcleaning $what\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 2585 | $paint_tab->{$what->map_to} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 2585 | $what->map_to(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 2585 | ▶ | if ($to) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 2585 | ▶ | print "\tcleaning $to\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 2585 | $paint_tab->{$to->map_to} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 2585 | $to->map_to(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 2585 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } elsif ($pos >= @$flat) { # nothing else to match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1519 | ▶ | print "\tmatched!\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 1519 | $backtrack = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 1519 | $match = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 1519 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } elsif (@$stack == 1) { # match first atom (anchored) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1397 | ▶ | if (!$paint_tab->{$where} and $what->test($where)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $paint_tab->{$where} and $what->test($where)
MC/DC50%1/2
not $paint_tab->{$where} and $what->test($where)
not $paint_tab->{$where}
$what->test($where)
Truth table66%2/3
not(A) and B
A= not $paint_tab->{$where}B= $what->test($where)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1306 | ▶ | print "\tmatched initial atom $what on $where\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 1306 | $paint_tab->{$where} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 1306 | $what->map_to($where); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 1306 | push @$stack, [0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 1306 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 91 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } elsif ($what->isa("Chemistry::Pattern::Atom")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # match unanchored atom | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | if($idx >= $mol->atoms) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | print "\tno more atoms at $mol\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | $backtrack = 1, next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my $next = $mol->atoms($idx+1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $stack->[-1] = [++$idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ($paint_tab->{$next}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | print "\t$next already visited\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | if ($what->test($next)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | print "\tmatched unanchored atom $what on $next\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $paint_tab->{$next} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $what->map_to($next); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $stack->[-1] = [$idx, undef, $what]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | push @$stack, [0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | print "\tunanchored atom $what didn't match $next\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } elsif ($what->isa("Chemistry::Pattern::Bond")) { # match bond | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 8914 | my ($a1, $a2) = $what->atoms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 8914 | ▶ | my ($from, $to) = $a1->map_to ? ($a1, $a2) : ($a2, $a1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 8914 | ▶ | $where = $a1->map_to || $a2->map_to; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$a1->map_to || $a2->map_to
MC/DC0%0/2
$a1->map_to || $a2->map_to
$a1->map_to
$a2->map_to
Truth table33%1/3
A || B
A= $a1->map_toB= $a2->map_to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 8914 | ▶ | print "\tfrom $from to $to\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 8914 | my @bn = $where->bonds_neighbors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 8914 | ▶ | if ($idx >= @bn) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 2372 | ▶ | print "\tno more bonds at $where\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 2372 | $backtrack = 1, next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 6542 | my $nei = $bn[$idx]{to}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 6542 | my $bond = $bn[$idx]{bond}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 6542 | $stack->[-1] = [++$idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 6542 | ▶ | if ($paint_tab->{$bond}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1410 | ▶ | print "\t$bond already visited\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1410 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 5132 | ▶ | if ($a1->map_to and $a2->map_to) { # ring closure bond | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$a1->map_to and $a2->map_to
MC/DC0%0/2
$a1->map_to and $a2->map_to
$a1->map_to
$a2->map_to
Truth table33%1/3
A and B
A= $a1->map_toB= $a2->map_to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | if ($what->test($bond)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | print "\tmatched ring bond $what on $bond\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | if ($to->map_to eq $nei) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | print "\tring closed $to on $nei\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | $paint_tab->{$bond} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | $what->map_to($bond); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $stack->[-1] = [$idx, $what]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | push @$stack, [0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | print "\tring didn't close $to on $nei\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 5132 | ▶ | if ($paint_tab->{$nei}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | print "\t$nei already visited\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 5132 | ▶ | if ($what->test($bond)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 3940 | ▶ | print "\tmatched bond $what on $bond\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 3940 | ▶ | if ($to->test($nei)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 2585 | ▶ | print "\tmatched atom $to on $nei\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 2585 | $paint_tab->{$nei} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 2585 | $to->map_to($nei); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 2585 | $paint_tab->{$bond} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 2585 | $what->map_to($bond); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 2585 | $stack->[-1] = [$idx, $what, $to]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 2585 | push @$stack, [0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 2585 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 1355 | ▶ | print "\tatom $to didn't match $nei\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 1192 | ▶ | print "\tbond $what didn't match $bond\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 2547 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | die "shouldn't be here; what=($what)!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 2916 | $patt->{backtrack} = $backtrack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 2916 | $patt->{stack} = $stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 2916 | $match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 165 | ▶ | sub flatten { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flatten: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 165 | my ($patt) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 165 | my $visited = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 165 | my $list = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 165 | for my $atom ($patt->atoms) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 462 | ▶ | next if $visited->{$atom}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 154 | push @$list, $atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 154 | _flatten($patt, $atom, $visited, $list); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 165 | ▶ | print "flattened list: (@$list)\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 165 | $list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 462 | ▶ | sub _flatten { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 462 | my ($patt, $atom, $visited, $list) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 462 | $visited->{$atom} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 462 | for my $bn ($atom->bonds_neighbors) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 616 | my $nei = $bn->{to}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 616 | my $bond = $bn->{bond}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 616 | ▶ | next if $visited->{$bond}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 308 | $visited->{$bond} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 308 | push @$list, $bond; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 308 | ▶ | unless ($visited->{$nei}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 308 | _flatten($patt, $nei, $visited, $list); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0.26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | L<Chemistry::Pattern::Atom>, L<Chemistry::Pattern::Bond>, L<Chemistry::Mol>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | L<Chemistry::File>, L<Chemistry::File::SMARTS>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | The PerlMol website L<http://www.perlmol.org/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | Ivan Tubert-Brohman E<lt>itub@cpan.orgE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | Copyright (c) 2005 Ivan Tubert-Brohman. All rights reserved. This program is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | free software; you can redistribute it and/or modify it under the same terms as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||