comparison variant_effect_predictor/Bio/Ontology/TermFactory.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 # $Id: TermFactory.pm,v 1.1.2.2 2003/03/27 10:07:56 lapp Exp $
2 #
3 # BioPerl module for Bio::Ontology::TermFactory
4 #
5 # Cared for by Hilmar Lapp <hlapp at gmx.net>
6 #
7 # Copyright Hilmar Lapp
8 #
9 # You may distribute this module under the same terms as perl itself
10
11 #
12 # (c) Hilmar Lapp, hlapp at gmx.net, 2002.
13 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
14 #
15 # You may distribute this module under the same terms as perl itself.
16 # Refer to the Perl Artistic License (see the license accompanying this
17 # software package, or see http://www.perl.com/language/misc/Artistic.html)
18 # for the terms under which you may use, modify, and redistribute this module.
19 #
20 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
21 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
22 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 #
24
25 # POD documentation - main docs before the code
26
27 =head1 NAME
28
29 Bio::Ontology::TermFactory - Instantiates a new Bio::Ontology::TermI (or derived class) through a factory
30
31 =head1 SYNOPSIS
32
33 use Bio::Ontology::TermFactory;
34
35 # the default type is Bio::Ontology::Term
36 my $factory = new Bio::Ontology::TermFactory(-type => 'Bio::Ontology::GOterm');
37 my $term = $factory->create_object(-name => 'peroxisome',
38 -ontology => 'Gene Ontology',
39 -identifier => 'GO:0005777');
40
41
42 =head1 DESCRIPTION
43
44 This object will build L<Bio::Ontology::TermI> objects generically.
45
46 =head1 FEEDBACK
47
48 =head2 Mailing Lists
49
50 User feedback is an integral part of the evolution of this and other
51 Bioperl modules. Send your comments and suggestions preferably to
52 the Bioperl mailing list. Your participation is much appreciated.
53
54 bioperl-l@bioperl.org - General discussion
55 http://bioperl.org/MailList.shtml - About the mailing lists
56
57 =head2 Reporting Bugs
58
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 of the bugs and their resolution. Bug reports can be submitted via
61 email or the web:
62
63 bioperl-bugs@bioperl.org
64 http://bugzilla.bioperl.org/
65
66 =head1 AUTHOR - Hilmar Lapp
67
68 Email hlapp at gmx.net
69
70
71 =head1 APPENDIX
72
73 The rest of the documentation details each of the object methods.
74 Internal methods are usually preceded with a _
75
76 =cut
77
78
79 # Let the code begin...
80
81
82 package Bio::Ontology::TermFactory;
83 use vars qw(@ISA);
84 use strict;
85
86 use Bio::Root::Root;
87 use Bio::Factory::ObjectFactory;
88
89 @ISA = qw(Bio::Factory::ObjectFactory);
90
91 =head2 new
92
93 Title : new
94 Usage : my $obj = new Bio::Ontology::TermFactory();
95 Function: Builds a new Bio::Ontology::TermFactory object
96 Returns : Bio::Ontology::TermFactory
97 Args : -type => string, name of a L<Bio::Ontology::TermI> derived class.
98 The default is L<Bio::Ontology::Term>.
99
100 =cut
101
102 sub new {
103 my($class,@args) = @_;
104
105 my $self = $class->SUPER::new(@args);
106
107 # make sure this matches our requirements
108 $self->interface("Bio::Ontology::TermI");
109 $self->type($self->type() || "Bio::Ontology::Term");
110
111 return $self;
112 }
113
114
115 =head2 create_object
116
117 Title : create_object
118 Usage : my $term = $factory->create_object(<named parameters>);
119 Function: Instantiates new Bio::Ontology::TermI (or one of its child classes)
120
121 This object allows us to genericize the instantiation of
122 Term objects.
123
124 Returns : L<Bio::Ontology::TermI> compliant object
125 The return type is configurable using new(-type =>"...").
126 Args : initialization parameters specific to the type of term
127 object we want. Typically
128 -name => $name
129 -identifier => identifier for the term
130 -ontology => ontology for the term
131
132 =cut
133
134 1;