| 1 | package Chemistry::File::SLN; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | $VERSION = "0.11"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # $Id: SLN.pm,v 1.4 2005/03/29 16:38:06 itubert Exp $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use base "Chemistry::File"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 9 | ▶ | use Chemistry::Mol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use Chemistry::File::SLN::Parser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 9 | ▶ | use Chemistry::Bond::Find 'assign_bond_orders'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 9 | ▶ | use List::Util qw(sum); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | Chemistry::File::SLN - SLN linear notation parser/writer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSYS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | use Chemistry::File::SLN; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # parse a SLN string for benzene | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | my $s = 'C[1]H:CH:CH:CH:CH:CH@1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | my $mol = Chemistry::Mol->parse($s, format => 'sln'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # print a SLN string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | print $mol->print(format => 'sln'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # print a unique (canonical) SLN string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | print $mol->print(format => 'sln', unique => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # parse a multiline SLN file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | my @mols = Chemistry::Mol->read("file.sln", format => 'sln'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # write a multiline SLN file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | Chemistry::Mol->write("file.sln", mols => [@mols]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | This module parses a SLN (Sybyl Line Notation) string. This is a File I/O | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | driver for the PerlMol project. L<http://www.perlmol.org/>. It registers the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 'sln' format with Chemistry::Mol, and recognizes filenames ending in '.sln'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | Optional attributes for atoms, bonds, and molecules are stored as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | $atom->attr("sln/attr"), $bond->attr("sln/attr"), and $mol->attr("sln/attr"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | respectively. Boolean attributes are stored with a value of 'TRUE'. That's the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | way boolean attributes are recognized when writing, so that they can be written | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | in the shortened form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | $sln_attr->{backbone} = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # would be ouput as "C[backbone=1]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | $sln_attr->{backbone} = 'TRUE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # would be ouput as "C[backbone]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | Also note that attribute names are normalized to lowercase on reading. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =head1 OPTIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | The following options are available when reading: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | =item kekulize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | Assign bond orders for unsatisfied valences or for aromatic bonds. For example, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | benzene read as C[1]H:CH:CH:CH:CH:CH@1 will be converted internally to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | something like C[1]H=CHCH=CHCH=CH@1. This is needed if another format or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | module expects a Kekule representation without an aromatic bond type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | The following options are available when writing: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | =item mols | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | If this option points to an array of molecules, these molecules will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | written, one per line, as in the example in the SYNOPSYS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | =item aromatic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | Detect aromaticity before writing. This will ensure that aromatic bond types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | are used instead of alternate single and double bonds. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | =item unique | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | Canonicalize before writing, and produce a unique strucure. NOTE: this option | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | does not guarantee a unique representation for molecules with bracketed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | attributes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | =item name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | Include the name of the molecule ($mol->name) in the output string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =item coord3d, coords | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | Include the 3D coordinates of every atom in the molecule in the output string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | C<coord3d> and C<coords> may be used interchangeably. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | =item attr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | Output the atom, bond, and molecule attributes found in $mol->attr("sln/attr"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | =head1 CAVEATS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | This version does not implement the full SLN specification. It supports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | simple structures and some attributes, but it does not support any of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | following: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | =item Macro atoms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | =item Pattern matching options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | =item Markush structures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | =item 2D Coordinates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | The SLN specification is vague on several points, and I don't have a reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | implementation available, so I had to make several arbitrary decisions. Also, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | this version of this module has not been tested exhaustively, so please report | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | any bugs that you find. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | If the parser doesn't understand a string, it only says "syntax error", which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | may not be very helpful. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # INITIALIZATION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 9 | Chemistry::Mol->register_format('sln'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 9 | my $Parser = Chemistry::File::SLN::Parser->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub name_is { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name_is: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $name =~ /\.sln$/i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub file_is { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_is: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $_[0]->name_is($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub parse_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_string: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my ($self, $string, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my (@lines) = split /(?:\n|\r\n?)/, $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my @mols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | for my $line (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $mol = $self->parse_single_line($line, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | return $mol unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | push @mols, $mol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | @mols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub parse_single_line { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_single_line: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my ($self, $string, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my $mol_class = $opts{mol_class} || "Chemistry::Mol"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts{'mol_class'} || 'Chemistry::Mol'
MC/DC0%0/1
$opts{'mol_class'} || 'Chemistry::Mol'
$opts{'mol_class'}
Truth table0%0/2
A
A= $opts{'mol_class'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # call the actual yapp-generated parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | my $tree = $Parser->run($string) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | #use Data::Dumper; print Dumper $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $mol = $mol_class->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my @nodes = @{$tree->{chain}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my %closures; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | my $last_atom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | while (my $node = shift @nodes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | if ($node eq '(') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | push @stack, $last_atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } elsif ($node eq ')') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $last_atom = pop @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } elsif($last_atom) { # bond | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $next = shift @nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ($next->{closure}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $atom = $closures{$next->{closure}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $self->compile_bond($mol, $node, $last_atom, $atom); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $atom = $self->compile_atom($mol, $next, \%closures); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $self->compile_bond($mol, $node, $last_atom, $atom); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $last_atom = $atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } else { # first atom | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $last_atom = $self->compile_atom($mol, $node, \%closures); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if ($opts{kekulize}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | assign_bond_orders($mol, method => "itub", use_coords => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | scratch => 0, charges => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my @sln_attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | while (my ($attr, $value) = each %{$tree->{attr}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if ($attr eq 'name') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $mol->name($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } elsif ($attr eq 'type') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $mol->type($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } elsif ($attr eq 'coord3d') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->read_coords($mol, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | push @sln_attr, $attr, $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $mol->attr("sln/attr", {@sln_attr}) if @sln_attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $mol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub compile_atom { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile_atom: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my ($self, $mol, $node, $closures) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | my $atom = $mol->new_atom( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | symbol => $node->{symbol}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | hydrogens => $node->{hcount}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | formal_charge => $node->{attr}{charge}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $atom->attr("sln/attr", $node->{attr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | delete $node->{attr}{charge}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | $closures->{$node->{id}} = $atom if $node->{id}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $atom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 9 | my %TYPE_TO_ORDER = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | '-' => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | '=' => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | '#' => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | ':' => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | '.' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | sub compile_bond { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile_bond: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my ($self, $mol, $node, $atom1, $atom2) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $order = $TYPE_TO_ORDER{$node->{type}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if ($order) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | my $bond = $mol->new_bond( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | type => $node->{type}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | atoms=>[$atom1, $atom2], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | order => $order, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $bond->attr("sln/attr", $node->{attr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | if ($node->{type} eq ':') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $_->aromatic(1) for ($atom1, $atom2, $bond); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub read_coords { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_coords: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my ($self, $mol, $coords_str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $coords_str =~ s/[()]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my (@coords) = split /,/, $coords_str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $fh = $mol->formula_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $n = sum(values %$fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $sprout = (@coords == 3*$n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | for my $atom ($mol->atoms) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $atom->coords(splice @coords, 0, 3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | if ($sprout) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | for (1 .. $atom->implicit_hydrogens) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $H = $mol->new_atom(symbol => 'H', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | coords => [splice @coords, 0, 3]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $mol->new_bond(atoms => [$atom, $H]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $atom->implicit_hydrogens(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | ########### WRITER ################# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | sub write_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_string: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my ($self, $mol_ref, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $eol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | my @mols; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | if ($opts{mols}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | @mols = @{$opts{mols}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $eol = "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | @mols = $mol_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $eol = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $sln; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | for my $mol (@mols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $sln .= $self->write_mol($mol, %opts) . $eol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | $sln; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub write_mol { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_mol: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my ($self, $mol, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $oldmol = $mol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $mol = $mol->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my $sln = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my @id_log; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | if ($mol->atoms) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my @atoms = $self->clean_mol($mol, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my $visited = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | my @s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | for my $atom (@atoms) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | next if $visited->{$atom}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $ring_atoms = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # first pass to find and number the ring bonds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $self->find_ring_bonds($mol, \%opts, $atom, undef, {}, $ring_atoms); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # second pass to actually generate the sln string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | push @s, $self->branch($mol, \%opts, $atom, undef, $visited, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | $ring_atoms, \@id_log); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $sln .= join '.', @s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $sln .= $self->format_ctab_attr($mol, \%opts, $oldmol, \@id_log); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | sub clean_mol { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clean_mol: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my ($self, $mol, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $self->collapse_hydrogens($mol); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my @atoms = $mol->atoms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if ($opts{unique}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | unless ($atoms[0]->attr("canon/class")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | require Chemistry::Canonicalize; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | Chemistry::Canonicalize::canonicalize($mol); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | #$opts{aromatic} = 1; # all unique sln have to be aromatic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | @atoms = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $a->attr("canon/class") <=> $b->attr("canon/class") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } @atoms; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if ($opts{aromatic}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | require Chemistry::Ring; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | Chemistry::Ring::aromatize_mol($mol); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | @atoms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | sub format_ctab_attr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_ctab_attr: not called CC=12 SCAR=48.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my ($self, $mol, $opts, $oldmol, $id_log) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my $sln = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if ($opts->{name} or $opts->{attr} or $opts->{coords} or $opts->{coord3d}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$opts->{"name"} or $opts->{"attr"} or $opts->{"coords"} or $opts->{"coord3d"}
$opts->{"name"} or $opts->{"attr"} or $opts->{"coords"}
$opts->{"name"} or $opts->{"attr"}
MC/DC0%0/4
$opts->{"name"} or $opts->{"attr"} or $opts->{"coords"} or $opts->{"coord3d"}
$opts->{"name"}
$opts->{"attr"}
$opts->{"coords"}
$opts->{"coord3d"}
Truth table0%0/5
A or B or C or D
A= $opts->{"name"}B= $opts->{"attr"}C= $opts->{"coords"}D= $opts->{"coord3d"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 9 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | my @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $name = $mol->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $name =~ s/[\r\n]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | push @attr, 'name="' . $mol->name . '"' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | if $opts->{name} and length $mol->name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opts->{"name"} and length $mol->name
MC/DC0%0/2
$opts->{"name"} and length $mol->name
$opts->{"name"}
length $mol->name
Truth table0%0/3
A and B
A= $opts->{"name"}B= length $mol->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my @coords; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if ($opts->{coord3d} or $opts->{coords}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opts->{"coord3d"} or $opts->{"coords"}
MC/DC0%0/2
$opts->{"coord3d"} or $opts->{"coords"}
$opts->{"coord3d"}
$opts->{"coords"}
Truth table0%0/3
A or B
A= $opts->{"coord3d"}B= $opts->{"coords"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | my @all_atoms = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | $oldmol->by_id($_), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | grep {$_->symbol eq 'H'} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | $oldmol->by_id($_)->neighbors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } @$id_log; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | push @coords, sprintf("(%.3f,%.3f,%.3f)",$_->coords->array) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | for @all_atoms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | push @attr, 'coord3d=' . join(',',@coords); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | if ($opts->{attr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | push @attr, $self->format_sln_attr($mol); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | $sln .= '<' . join(';', @attr) . '>' if @attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | $sln; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub find_ring_bonds { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_ring_bonds: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my ($self, $mol, $opts, $atom, $from_bond, $visited, $ring_atoms) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $visited->{$atom} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | for my $bn (sorted_bonds_neighbors($atom, $opts)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my $nei = $bn->{to}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my $bond = $bn->{bond}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | next if $visited->{$bond}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $visited->{$bond} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | if ($visited->{$nei}) { # closed ring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | #print "closing ring\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $ring_atoms->{$nei}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $self->find_ring_bonds($mol, $opts, $nei, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | $bond, $visited, $ring_atoms); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub branch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
branch: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my ($self, $mol, $opts, $atom, $from_bond, $visited, $digits, $id_log) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $prev_branch = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my $sln; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $sln .= $self->format_bond($from_bond, $opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | my $digit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | if ($digits->{$atom}) { # opening a ring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $digit = $self->next_digit($digits); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | $digits->{$atom} = $digit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $sln .= $self->format_atom($atom, $opts, $digit); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | push @$id_log, $atom->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | $visited->{$atom} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my @bns = sorted_bonds_neighbors($atom, $opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | for my $bn (@bns) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my $nei = $bn->{to}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my $bond = $bn->{bond}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | next if $visited->{$bond}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | $visited->{$bond} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | if ($visited->{$nei}) { # closed a ring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if ($prev_branch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $sln .= "($prev_branch)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $prev_branch = $self->format_bond($bond, $opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | . '@' . $digits->{$nei}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $visited->{$bond} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $branch = $self->branch($mol, $opts, $nei, $bond, $visited, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | $digits, $id_log); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | if ($prev_branch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | $sln .= "($prev_branch)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $prev_branch = $branch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $sln .= "$prev_branch"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $sln; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | sub next_digit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_digit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | my ($self, $digits) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ++$digits->{used_digits}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | sub collapse_hydrogens { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
collapse_hydrogens: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | my ($self, $mol) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | for my $atom (grep {$_->symbol eq 'H'} $mol->atoms) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | my ($neighbor) = $atom->neighbors or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $atom->delete; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my $h_count = $neighbor->hydrogens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | $h_count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $neighbor->hydrogens($h_count); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | sub sorted_bonds_neighbors { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sorted_bonds_neighbors: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my ($atom, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my @bn = $atom->bonds_neighbors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | if ($opts->{unique}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | @bn = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $a->{to}->attr("canon/class") <=> $b->{to}->attr("canon/class") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } @bn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | @bn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 9 | my %ORDER_TO_TYPE = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 1 => '', 2 => '=', 3 => '#', 4 => '', 0 => '.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | sub format_bond { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_bond: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my ($self, $bond, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | return '' unless $bond; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | my $s = $bond->aromatic ? ':' : $ORDER_TO_TYPE{$bond->order}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | @attr = $self->format_sln_attr($bond) if $opts->{attr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | if (@attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $s .= '[' . join(";", @attr) . ']'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | sub format_atom { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_atom: not called CC=11 SCAR=46.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my ($self, $atom, $opts, $digit) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 9 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $h_count = $atom->hydrogens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $charge = $atom->formal_charge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $symbol = $atom->symbol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | $charge = $charge ? sprintf("%+d", $charge): ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | $h_count = $h_count ? ($h_count > 1 ? "H$h_count" : 'H') : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $s = $symbol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | ▶ | @attr = $self->format_sln_attr($atom) if $opts->{attr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if ($charge or $digit or @attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$charge or $digit or @attr
$charge or $digit
MC/DC0%0/3
$charge or $digit or @attr
$charge
$digit
@attr
Truth table0%0/4
A or B or C
A= $chargeB= $digitC= @attr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | $s .= '['; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $s .= $digit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | ▶ | unshift @attr, $charge if $charge; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | if (@attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | $s .= ':' if $digit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $s .= join ';', @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | $s .= ']'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $s .= $h_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub format_sln_attr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_sln_attr: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my ($self, $obj) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | my $sln_attr = $obj->attr("sln/attr") || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->attr('sln/attr') || {}
MC/DC0%0/1
$obj->attr('sln/attr') || {}
$obj->attr('sln/attr')
Truth table0%0/2
A
A= $obj->attr('sln/attr')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | for my $key (sort keys %$sln_attr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my $val = $sln_attr->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | push @attr, "$key" . ($val eq 'TRUE' ? "" : "=$val"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0.11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | L<Chemistry::Mol>, L<Chemistry::File>, L<Chemistry::File::SMILES> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | The PerlMol website L<http://www.perlmol.org/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | Ash, S.; Cline, M. A.; Homer, R. W.; Hurst, T.; Smith, G. B., SYBYL Line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | Notation (SLN): A Versatile Language for Chemical Structure Representation. J. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | Chem. Inf. Comput. Sci; 1997; 37(1); 71-79. DOI: 10.1021/ci960109j | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | (L<http://dx.doi.org/10.1021/ci960109j>) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | Ivan Tubert-Brohman E<lt>itub@cpan.orgE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | Copyright (c) 2004 Ivan Tubert-Brohman. All rights reserved. This program is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | free software; you can redistribute it and/or modify it under the same terms as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||