0
|
1 # $Id: Ref.pm,v 1.5 2002/10/22 07:45:11 lapp Exp $
|
|
2 #
|
|
3 # BioPerl module for Bio::Biblio::Ref
|
|
4 #
|
|
5 # Cared for by Martin Senger <senger@ebi.ac.uk>
|
|
6 # For copyright and disclaimer see below.
|
|
7
|
|
8 # POD documentation - main docs before the code
|
|
9
|
|
10 =head1 NAME
|
|
11
|
|
12 Bio::Biblio::Ref - Representation of a bibliographic reference
|
|
13
|
|
14 =head1 SYNOPSIS
|
|
15
|
|
16 $obj = new Bio::Biblio::Ref (-type => 'Letter',
|
|
17 -title => 'Onegin to Tatiana');
|
|
18 --- OR ---
|
|
19
|
|
20 $obj = new Bio::Biblio::Ref;
|
|
21 $obj->type ('Letter');
|
|
22
|
|
23 =head1 DESCRIPTION
|
|
24
|
|
25 A storage object for a general bibliographic reference (a citation).
|
|
26 See its place in the class hierarchy in
|
|
27 http://industry.ebi.ac.uk/openBQS/images/bibobjects_perl.gif
|
|
28
|
|
29 =head2 Attributes
|
|
30
|
|
31 The following attributes are specific to this class,
|
|
32 and they are inherited by all citation types.
|
|
33
|
|
34 author_list_complete values: 'Y' (default) or 'N'
|
|
35 authors type: array ref of Bio::Biblio::Provider's
|
|
36 cross_references type: array ref of Bio::Annotation::DBLink's
|
|
37 cross_references_list_complete values: 'Y' (default) or 'N'
|
|
38 abstract
|
|
39 abstract_language
|
|
40 abstract_type
|
|
41 codes type: hash ref
|
|
42 contributors type: array ref of Bio::Biblio::Provider's
|
|
43 date
|
|
44 date_completed
|
|
45 date_created
|
|
46 date_revised
|
|
47 format
|
|
48 identifier
|
|
49 keywords
|
|
50 language
|
|
51 last_modified_date
|
|
52 publisher type: Bio::Biblio::Provider
|
|
53 repository_subset
|
|
54 rights
|
|
55 spatial_location
|
|
56 subject_headings type: hash ref
|
|
57 subject_headings_source
|
|
58 temporal_period
|
|
59 title
|
|
60 toc
|
|
61 toc_type
|
|
62 type
|
|
63
|
|
64 =head1 SEE ALSO
|
|
65
|
|
66 =over
|
|
67
|
|
68 =item *
|
|
69
|
|
70 OpenBQS home page: http://industry.ebi.ac.uk/openBQS
|
|
71
|
|
72 =item *
|
|
73
|
|
74 Comments to the Perl client: http://industry.ebi.ac.uk/openBQS/Client_perl.html
|
|
75
|
|
76 =back
|
|
77
|
|
78 =head1 FEEDBACK
|
|
79
|
|
80 =head2 Mailing Lists
|
|
81
|
|
82 User feedback is an integral part of the evolution of this and other
|
|
83 Bioperl modules. Send your comments and suggestions preferably to
|
|
84 the Bioperl mailing list. Your participation is much appreciated.
|
|
85
|
|
86 bioperl-l@bioperl.org - General discussion
|
|
87 http://bioperl.org/MailList.shtml - About the mailing lists
|
|
88
|
|
89 =head2 Reporting Bugs
|
|
90
|
|
91 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
92 of the bugs and their resolution. Bug reports can be submitted via
|
|
93 email or the web:
|
|
94
|
|
95 bioperl-bugs@bioperl.org
|
|
96 http://bugzilla.bioperl.org/
|
|
97
|
|
98 =head1 AUTHORS
|
|
99
|
|
100 Heikki Lehvaslaiho (heikki@ebi.ac.uk),
|
|
101 Martin Senger (senger@ebi.ac.uk)
|
|
102
|
|
103 =head1 COPYRIGHT
|
|
104
|
|
105 Copyright (c) 2002 European Bioinformatics Institute. All Rights Reserved.
|
|
106
|
|
107 This module is free software; you can redistribute it and/or modify
|
|
108 it under the same terms as Perl itself.
|
|
109
|
|
110 =head1 DISCLAIMER
|
|
111
|
|
112 This software is provided "as is" without warranty of any kind.
|
|
113
|
|
114 =head1 APPENDIX
|
|
115
|
|
116 The rest of the documentation details each of the object
|
|
117 methods. Internal methods are preceded with a _
|
|
118
|
|
119 =cut
|
|
120
|
|
121
|
|
122 # Let the code begin...
|
|
123
|
|
124
|
|
125 package Bio::Biblio::Ref;
|
|
126 use strict;
|
|
127 use vars qw(@ISA $AUTOLOAD);
|
|
128
|
|
129 use Bio::Biblio::BiblioBase;
|
|
130 use Bio::Annotation::DBLink;
|
|
131
|
|
132 @ISA = qw(Bio::Biblio::BiblioBase);
|
|
133
|
|
134 #
|
|
135 # a closure with a list of allowed attribute names (these names
|
|
136 # correspond with the allowed 'get' and 'set' methods); each name also
|
|
137 # keep what type the attribute should be (use 'undef' if it is a
|
|
138 # simple scalar)
|
|
139 #
|
|
140 {
|
|
141 my %_allowed =
|
|
142 (
|
|
143 _author_list_complete => undef,
|
|
144 _authors => 'ARRAY', # of Bio::Biblio::Provider
|
|
145 _cross_references => 'ARRAY', # of Bio::Annotation::DBLink
|
|
146 _cross_references_list_complete => undef,
|
|
147 _abstract => undef,
|
|
148 _abstract_language => undef,
|
|
149 _abstract_type => undef,
|
|
150 _codes => 'HASH',
|
|
151 _contributors => 'ARRAY', # of Bio::Biblio::Provider
|
|
152 _date => undef,
|
|
153 _date_completed => undef,
|
|
154 _date_created => undef,
|
|
155 _date_revised => undef,
|
|
156 _format => undef,
|
|
157 _identifier => undef,
|
|
158 _keywords => 'HASH',
|
|
159 _language => undef,
|
|
160 _last_modified_date => undef,
|
|
161 _publisher => 'Bio::Biblio::Provider',
|
|
162 _repository_subset => undef,
|
|
163 _rights => undef,
|
|
164 _spatial_location => undef,
|
|
165 _subject_headings => 'HASH',
|
|
166 _subject_headings_source => undef,
|
|
167 _temporal_period => undef,
|
|
168 _title => undef,
|
|
169 _toc => undef,
|
|
170 _toc_type => undef,
|
|
171 _type => undef,
|
|
172 );
|
|
173
|
|
174 # return 1 if $attr is allowed to be set/get in this class
|
|
175 sub _accessible {
|
|
176 my ($self, $attr) = @_;
|
|
177 exists $_allowed{$attr};
|
|
178 }
|
|
179
|
|
180 # return an expected type of given $attr
|
|
181 sub _attr_type {
|
|
182 my ($self, $attr) = @_;
|
|
183 $_allowed{$attr};
|
|
184 }
|
|
185 }
|
|
186
|
|
187
|
|
188 =head2 add_cross_reference
|
|
189
|
|
190 Usage : $self->add_cross_reference
|
|
191 (new Bio::Annotation::DBLink (-database => 'EMBL',
|
|
192 -primary_id => 'V00808');
|
|
193 Function: adding a link to a database entry
|
|
194 Returns : new value of 'cross_references'
|
|
195 Args : an object of type Bio::Annotation::DBLink
|
|
196
|
|
197 =cut
|
|
198
|
|
199 sub add_cross_reference {
|
|
200 my ($self, $value) = @_;
|
|
201 $self->throw ($self->_wrong_type_msg (ref $value, 'Bio::Annotation::DBLink'))
|
|
202 unless (UNIVERSAL::isa ($value, 'Bio::Annotation::DBLink'));
|
|
203 (defined $self->cross_references) ?
|
|
204 push (@{ $self->cross_references }, $value) :
|
|
205 return $self->cross_references ( [$value] );
|
|
206 return $self->cross_references;
|
|
207 }
|
|
208
|
|
209
|
|
210 =head2 add_author
|
|
211
|
|
212 Usage : $self->add_author (new Bio::Biblio::Person (-lastname => 'Novak');
|
|
213 Function: adding an author to a list of authors
|
|
214 Returns : new value of 'authors' (a full list)
|
|
215 Args : an object of type Bio::Biblio::Provider
|
|
216
|
|
217 =cut
|
|
218
|
|
219
|
|
220 sub add_author {
|
|
221 my ($self, $value) = @_;
|
|
222 $self->throw ($self->_wrong_type_msg (ref $value, 'Bio::Biblio::Provider'))
|
|
223 unless (UNIVERSAL::isa ($value, 'Bio::Biblio::Provider'));
|
|
224 (defined $self->authors) ?
|
|
225 push (@{ $self->authors }, $value) :
|
|
226 return $self->authors ( [$value] );
|
|
227 return $self->authors;
|
|
228 }
|
|
229
|
|
230 =head2 add_contributor
|
|
231
|
|
232 Usage : $self->add_contributor (new Bio::Biblio::Person (-lastname => 'Novak');
|
|
233 Function: adding a contributor to a list of contributors
|
|
234 Returns : new value of 'contributors' (a full list)
|
|
235 Args : an object of type Bio::Biblio::Provider
|
|
236
|
|
237 =cut
|
|
238
|
|
239 sub add_contributor {
|
|
240 my ($self, $value) = @_;
|
|
241 $self->throw ($self->_wrong_type_msg (ref $value, 'Bio::Biblio::Provider'))
|
|
242 unless (UNIVERSAL::isa ($value, 'Bio::Biblio::Provider'));
|
|
243 (defined $self->contributors) ?
|
|
244 push (@{ $self->contributors }, $value) :
|
|
245 return $self->contributors ( [$value] );
|
|
246 return $self->contributors;
|
|
247 }
|
|
248
|
|
249
|
|
250 1;
|
|
251 __END__
|