Bio/Ontology/TermFactory.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 24 / 24 CC 2 SCAR 3.4
CC
2
Cov
100%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Bio/Ontology/RelationshipFactory.pm ↑ Summary Bio/Seq/LargeSeq.pm »
1 #
2 # BioPerl module for Bio::Ontology::TermFactory
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Hilmar Lapp <hlapp at gmx.net>
7 #
8 # Copyright Hilmar Lapp
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 #
13 # (c) Hilmar Lapp, hlapp at gmx.net, 2002.
14 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
15 #
16 # You may distribute this module under the same terms as perl itself.
17 # Refer to the Perl Artistic License (see the license accompanying this
18 # software package, or see http://www.perl.com/language/misc/Artistic.html)
19 # for the terms under which you may use, modify, and redistribute this module.
20 #
21 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
22 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
23 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24 #
25  
26 # POD documentation - main docs before the code
27  
28 =head1 NAME
29  
30 Bio::Ontology::TermFactory - Instantiates a new
31 Bio::Ontology::TermI (or derived class) through a factory
32  
33 =head1 SYNOPSIS
34  
35 use Bio::Ontology::TermFactory;
36  
37 # the default type is Bio::Ontology::Term
38 my $factory = Bio::Ontology::TermFactory->new(
39 -type => 'Bio::Ontology::GOterm');
40 my $term = $factory->create_object(-name => 'peroxisome',
41 -ontology => 'Gene Ontology',
42 -identifier => 'GO:0005777');
43  
44  
45 =head1 DESCRIPTION
46  
47 This object will build L<Bio::Ontology::TermI> objects generically.
48  
49 =head1 FEEDBACK
50  
51 =head2 Mailing Lists
52  
53 User feedback is an integral part of the evolution of this and other
54 Bioperl modules. Send your comments and suggestions preferably to
55 the Bioperl mailing list. Your participation is much appreciated.
56  
57 bioperl-l@bioperl.org - General discussion
58 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
59  
60 =head2 Support
61  
62 Please direct usage questions or support issues to the mailing list:
63  
64 I<bioperl-l@bioperl.org>
65  
66 rather than to the module maintainer directly. Many experienced and
67 reponsive experts will be able look at the problem and quickly
68 address it. Please include a thorough description of the problem
69 with code and data examples if at all possible.
70  
71 =head2 Reporting Bugs
72  
73 Report bugs to the Bioperl bug tracking system to help us keep track
74 of the bugs and their resolution. Bug reports can be submitted via
75 the web:
76  
77 https://github.com/bioperl/bioperl-live/issues
78  
79 =head1 AUTHOR - Hilmar Lapp
80  
81 Email hlapp at gmx.net
82  
83  
84 =head1 APPENDIX
85  
86 The rest of the documentation details each of the object methods.
87 Internal methods are usually preceded with a _
88  
89 =cut
90  
91  
92 # Let the code begin...
93  
94  
95 package Bio::Ontology::TermFactory;
96 12 $Bio::Ontology::TermFactory::VERSION = '1.7.8';
97 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 12 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 12 ▶use base qw(Bio::Factory::ObjectFactory);
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 =head2 new
104  
105 Title : new
106 Usage : my $obj = Bio::Ontology::TermFactory->new();
107 Function: Builds a new Bio::Ontology::TermFactory object
108 Returns : Bio::Ontology::TermFactory
109 Args : -type => string, name of a Bio::Ontology::TermI derived class.
110 The default is Bio::Ontology::Term.
111  
112 See L<Bio::Ontology::TermI>, L<Bio::Ontology::Term>.
113  
114 =cut
115  
116 9 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
117 9 my($class,@args) = @_;
118  
119 9 my $self = $class->SUPER::new(@args);
120
121 # make sure this matches our requirements
122 9 $self->interface("Bio::Ontology::TermI");
123 9 ▶ $self->type($self->type() || "Bio::Ontology::Term");
Condition100%2/2
$self->type || 'Bio::Ontology::Term'
l!l
81
MC/DC100%1/1
$self->type || 'Bio::Ontology::Term'
$self->type
Truth table100%2/2
A
A= $self->type
Aresult
11
00
124  
125 9 return $self;
126 }
127  
128  
129 =head2 create_object
130  
131 Title : create_object
132 Usage : my $term = $factory->create_object(<named parameters>);
133 Function: Instantiates new Bio::Ontology::TermI (or one of its child classes)
134  
135 This object allows us to genericize the instantiation of
136 Term objects.
137  
138 Returns : Bio::Ontology::TermI compliant object
139 The return type is configurable using new(-type =>"...").
140 Args : initialization parameters specific to the type of term
141 object we want. Typically
142 -name => $name
143 -identifier => identifier for the term
144 -ontology => ontology for the term
145  
146 See L<Bio::Ontology::TermI>.
147  
148 =cut
149  
150 12 1;
« Bio/Ontology/RelationshipFactory.pm ↑ Summary Bio/Seq/LargeSeq.pm »