15 my $self = bless {}, $class;
17 $self->set_smmid($smmid);
19 print STDERR
"SMMID FILE = $file\n";
20 $self->{smmid_file
} = $file;
27 =head2 accessors get_smmid, set_smmid
39 return $self->{smmid
};
44 $self->{smmid
} = shift;
51 open (my $F, "<".$self->{smmid_file
}) || die "Can't open the SMMID definition file $self->{smmid_file}.";
57 if (/^SMMID\:\s*(.*)/) {
59 $SMMID{$current}->{SMMID
}=$current;
63 my ($key, $value) = split /\s*\:\s*/;
65 print STDERR
"Adding reference to $section: $value.\n";
66 push @
{$SMMID{$current}->{link_url
}->{$section}}, $value;
69 print STDERR
"Adding link to $section: $key\n";
70 push @
{$SMMID{$current}->{link_text
}->{$section}}, $key;
73 $SMMID{$current}->{$key}=$value;
84 =head2 accessors get_name, set_name
96 #if (!exists $SMMID{$self->get_smmid()}) {
97 # die "Need to set smmid first with set_smmid()";
99 my $name = $SMMID{$self->get_smmid()}->{"CHEMICAL NAME"};
100 print STDERR
"Chemical name is $name\n";
106 $SMMID{$self->get_smmid()}->{NAME
}=shift;
109 =head2 accessors get_synonyms, set_synonyms
121 return $SMMID{$self->get_smmid()}->{SYNONYMS
};
126 $SMMID{$self->get_smmid()}->{SYNONYMS
}=shift;
129 =head2 accessors get_molecular_formula, set_molecular_formula
139 sub get_molecular_formula
{
141 return $SMMID{$self->get_smmid()}->{"MOLECULAR FORMULA"};
144 sub set_molecular_formula
{
146 $SMMID{$self->get_smmid()}->{"MOLCULAR FORMULA"}=shift;
150 =head2 accessors get_molecular_weight, set_molecular_weight
160 sub get_molecular_weight
{
162 return $SMMID{$self->get_smmid()}->{"MOLECULAR WEIGHT"};
165 sub set_molecular_weight
{
167 $SMMID{$self->get_smmid()}->{"MOLECULAR WEIGHT"}=shift;
170 =head2 get_structure_file
181 sub get_structure_file
{
183 my $file = $self->get_smmid();
184 $file =~ s/\#/\%23/g;
189 =head2 get_smmid_for_link
200 sub get_smmid_for_link
{
202 return $urlencode{$self->get_smmid()};
220 print STDERR
"getting links for section $section\n";
222 if (!defined($SMMID{$self->get_smmid()}->{link_text
}->{$section})) { return; }
223 print STDERR
scalar(@
{$SMMID{$self->get_smmid()}->{link_text
}->{$section}})." entries\n";
224 for (my $i=0; $i<@
{$SMMID{$self->get_smmid()}->{link_text
}->{$section}}; $i++) {
225 push @links, [ ${$SMMID{$self->get_smmid()}->{link_text
}->{$section}}[$i], ${$SMMID{$self->get_smmid()}->{link_url
}->{$section}}[$i] ];
245 return $SMMID{$self->get_smmid()}->{CAS
};
248 =head2 get_concise_summary
259 sub get_concise_summary
{
261 return $SMMID{$self->get_smmid()}->{"CONCISE SUMMARY"};
264 =head2 get_biosynthesis
275 sub get_biosynthesis
{
277 return $SMMID{$self->get_smmid()}->{BIOSYNTHESIS
};
293 return $SMMID{$self->get_smmid()}->{RECEPTORS
};
316 my $self = $class->new($path);
322 foreach my $s (sort keys(%SMMID)) {
323 my $smmid = SMMIDDb
->new($path, $s);
325 push @all_smmids, $smmid;