~ubuntu-branches/ubuntu/lucid/bioperl/lucid

« back to all changes in this revision

Viewing changes to Bio/Root/Xref.pm

  • Committer: Bazaar Package Importer
  • Author(s): Matt Hope
  • Date: 2002-03-20 01:16:30 UTC
  • Revision ID: james.westby@ubuntu.com-20020320011630-wyvmxwc7o5bi4665
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#-----------------------------------------------------------------------------
 
2
# PACKAGE : Bio::Root::Xref.pm
 
3
# AUTHOR  : Steve Chervitz (sac@bioperl.org)
 
4
# CREATED : 8 May 1997
 
5
# REVISION: $Id: Xref.pm,v 1.8 2002/01/23 11:30:22 heikki Exp $
 
6
# STATUS  : Pre-Alpha 
 
7
#
 
8
# WARNING: This is considered an experimental module.
 
9
#
 
10
# Copyright (c) 1997-8 Steve Chervitz. All Rights Reserved.
 
11
#           This module is free software; you can redistribute it and/or 
 
12
#           modify it under the same terms as Perl itself.
 
13
#-----------------------------------------------------------------------------
 
14
 
 
15
package Bio::Root::Xref;
 
16
 
 
17
use Bio::Root::Global;
 
18
use Bio::Root::Object ();
 
19
use Bio::Root::Vector ();
 
20
 
 
21
@Bio::Root::Xref::ISA = qw( Bio::Root::Vector Bio::Root::Object );
 
22
 
 
23
use vars qw($ID $VERSION);
 
24
$ID = 'Bio::Root::Xref';
 
25
$VERSION = 0.01;
 
26
 
 
27
## POD Documentation:
 
28
 
 
29
=head1 NAME
 
30
 
 
31
Bio::Root::Xref - A generic cross-reference object.
 
32
 
 
33
B<WARNING: This module is still in the experimental phase and has not been tested.>
 
34
 
 
35
=head1 SYNOPSIS
 
36
 
 
37
=head2 Object Creation
 
38
 
 
39
 use Bio::Root::Object;
 
40
 
 
41
 $myObj->xref($object_ref);
 
42
 
 
43
=head2 Object Manipulation
 
44
 
 
45
 Accessors
 
46
 ---------------------------------------------------------------------
 
47
 obj()         - Get the cross-referenced object.
 
48
 desc()        - Description of the nature of the cross-reference.
 
49
 set_desc()    - Set description.
 
50
 type()        - Symmetric or assymetric.
 
51
 
 
52
 Methods
 
53
 ---------------------------------------------------------------------
 
54
 clear()       - remove all cross-references within the Xref object (not implemented).
 
55
 
 
56
=head1 DESCRIPTION
 
57
 
 
58
An instance of B<Bio::Root::Xref.pm> manages sets of objects not
 
59
necessarily related by inheritance or composition, but by an arbitrary
 
60
criterion defined by the client. Currently, Bio::Root::Xref inherits
 
61
from both B<Bio::Root::Object.pm> and B<Bio::Root::Vector.pm>. An Xref
 
62
object is an example of a heterogeneous Vector object since different
 
63
objects in the vector need not all derive from the same base class.
 
64
 
 
65
The two objects involved in the cross-reference typically involve a
 
66
symmetrical relationship in which each will have a Xref object relating it
 
67
to the other object. This relationship is not necessarily transitive,
 
68
however: if A is an xref of B and B is an xref of C, A is not
 
69
necessarily an xref of C. Assymetric Xrefs are also possible.
 
70
 
 
71
The establishment of cross-references is managed by B<Bio::Root::Object.pm>.
 
72
See the xref() method in that module.
 
73
 
 
74
B<The API for this module is not complete since the module is under development. Caveat emptor.>
 
75
 
 
76
 
 
77
=head1 SEE ALSO
 
78
 
 
79
  Bio::Root::Object.pm       - Core object
 
80
  Bio::Root::Global.pm       - Manages global variables/constants
 
81
 
 
82
  http://bio.perl.org/Projects/modules.html  - Online module documentation
 
83
  http://bio.perl.org/                       - Bioperl Project Homepage 
 
84
 
 
85
=head1 FEEDBACK
 
86
 
 
87
=head2 Mailing Lists 
 
88
 
 
89
User feedback is an integral part of the evolution of this and other Bioperl modules.
 
90
Send your comments and suggestions preferably to one of the Bioperl mailing lists.
 
91
Your participation is much appreciated.
 
92
 
 
93
  bioperl-l@bioperl.org             - General discussion
 
94
  http://bioperl.org/MailList.shtml - About the mailing lists
 
95
 
 
96
=head2 Reporting Bugs
 
97
 
 
98
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and 
 
99
their resolution. Bug reports can be submitted via email or the web:
 
100
 
 
101
    bioperl-bugs@bio.perl.org                   
 
102
    http://bio.perl.org/bioperl-bugs/           
 
103
 
 
104
=head1 AUTHOR 
 
105
 
 
106
Steve Chervitz E<lt>sac@bioperl.orgE<gt>
 
107
 
 
108
See L<the FEEDBACK section | FEEDBACK> for where to send bug reports and comments.
 
109
 
 
110
=head1 VERSION
 
111
 
 
112
Bio::Root::Xref.pm, 0.01 pre-alpha
 
113
 
 
114
=head1 COPYRIGHT
 
115
 
 
116
Copyright (c) 1997-8 Steve Chervitz. All Rights Reserved.
 
117
This module is free software; you can redistribute it and/or 
 
118
modify it under the same terms as Perl itself.
 
119
 
 
120
 
 
121
=head1 TODO
 
122
 
 
123
Update documentation to work with pod2html from Perl 5.004.
 
124
 
 
125
=cut
 
126
 
 
127
#
 
128
##
 
129
###
 
130
#### END of main POD documentation.
 
131
###
 
132
##
 
133
#
 
134
 
 
135
 
 
136
 
 
137
#####################################################################################
 
138
##                                 CONSTRUCTOR                                     ##
 
139
#####################################################################################
 
140
 
 
141
sub _initialize {
 
142
    my( $self, %param ) = @_;
 
143
 
 
144
    $self->SUPER::_initialize(%param);
 
145
    
 
146
    $self->{'_obj'} = ($param{-OBJ} || undef);
 
147
 
 
148
    ## By default, all Xrefs are symmetric.
 
149
    ## Create symmetric cross-reference in obj.
 
150
    if(!$param{-ASYM}) {
 
151
        $self->{'_obj'}->xref(-OBJ=>$param{-PARENT});
 
152
        $self->{'_type'} = 'sym';
 
153
    } else {
 
154
        $self->{'_type'} = 'asym';
 
155
    }   
 
156
}
 
157
 
 
158
 
 
159
#####################################################################################
 
160
##                                  ACCESSORS                                      ##
 
161
#####################################################################################
 
162
 
 
163
sub obj {my ($self) = shift; return $self->{'_obj'}; }
 
164
sub desc {my ($self) = shift; return $self->{'_desc'}; }
 
165
sub type {my ($self) = shift; return $self->{'_type'}; }
 
166
    
 
167
sub set_desc {my ($self,$desc) = @_; 
 
168
             $self->{'_desc'} = $desc;
 
169
         }
 
170
 
 
171
sub clear {
 
172
## Not implemented. Need to do this carefully.
 
173
## Not sure if this method is needed.    
 
174
    my ($self) = @_;
 
175
}
 
176
 
 
177
1;
 
178
__END__
 
179
 
 
180
#####################################################################################
 
181
#                                  END OF CLASS                                     #
 
182
#####################################################################################
 
183
 
 
184
=head1 DATA MEMBERS 
 
185
 
 
186
 _obj   : The object being cross-referenced to the parent.
 
187
 _type  : Symmetric or asymmetric
 
188
 _desc  : Description associated with the cross-reference
 
189
 
 
190
 INHERITED DATA MEMBERS (from Bio::Root::Object)
 
191
 
 
192
 _parent : The object receiving the cross-reference.
 
193
 _name   : Descriptive nature of the cross-reference.
 
194
 
 
195
=cut
 
196
 
 
197