tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / Bio / OntologyIO / goflat.pm
blobb7190aaa3a2f3674bf0921ecd20a2a4bbe7d2942
1 # $Id$
3 # BioPerl module for Bio::OntologyIO::goflat
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Christian M. Zmasek <czmasek-at-burnham.org> or <cmzmasek@yahoo.com>
9 # (c) Christian M. Zmasek, czmasek-at-burnham.org, 2002.
10 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
12 # You may distribute this module under the same terms as perl itself.
13 # Refer to the Perl Artistic License (see the license accompanying this
14 # software package, or see http://www.perl.com/language/misc/Artistic.html)
15 # for the terms under which you may use, modify, and redistribute this module.
17 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
18 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 # You may distribute this module under the same terms as perl itself
23 # POD documentation - main docs before the code
25 =head1 NAME
27 Bio::OntologyIO::goflat - a parser for the Gene Ontology flat-file format
29 =head1 SYNOPSIS
31 use Bio::OntologyIO;
33 # do not use directly -- use via Bio::OntologyIO
34 my $parser = Bio::OntologyIO->new
35 ( -format => "go",
36 -defs_file => "/home/czmasek/GO/GO.defs",
37 -files => ["/home/czmasek/GO/component.ontology",
38 "/home/czmasek/GO/function.ontology",
39 "/home/czmasek/GO/process.ontology"] );
41 my $go_ontology = $parser->next_ontology();
43 my $IS_A = Bio::Ontology::RelationshipType->get_instance( "IS_A" );
44 my $PART_OF = Bio::Ontology::RelationshipType->get_instance( "PART_OF" );
46 =head1 DESCRIPTION
48 Needs Graph.pm from CPAN.
50 This is essentially a very thin derivation of the dagflat parser.
52 =head1 FEEDBACK
54 =head2 Mailing Lists
56 User feedback is an integral part of the evolution of this and other
57 Bioperl modules. Send your comments and suggestions preferably to the
58 Bioperl mailing lists Your participation is much appreciated.
60 bioperl-l@bioperl.org - General discussion
61 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
63 =head2 Support
65 Please direct usage questions or support issues to the mailing list:
67 I<bioperl-l@bioperl.org>
69 rather than to the module maintainer directly. Many experienced and
70 reponsive experts will be able look at the problem and quickly
71 address it. Please include a thorough description of the problem
72 with code and data examples if at all possible.
74 =head2 Reporting Bugs
76 Report bugs to the Bioperl bug tracking system to help us keep track
77 the bugs and their resolution. Bug reports can be submitted via the
78 web:
80 http://bugzilla.open-bio.org/
82 =head1 AUTHOR
84 Christian M. Zmasek
86 Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
88 WWW: http://monochrome-effect.net/
90 Address:
92 Genomics Institute of the Novartis Research Foundation
93 10675 John Jay Hopkins Drive
94 San Diego, CA 92121
96 =head2 CONTRIBUTOR
98 Hilmar Lapp, hlapp at gmx.net
100 =head1 APPENDIX
102 The rest of the documentation details each of the object
103 methods. Internal methods are usually preceded with a _
105 =cut
108 # Let the code begin...
111 package Bio::OntologyIO::goflat;
113 use strict;
115 use Bio::Ontology::TermFactory;
117 use constant TRUE => 1;
118 use constant FALSE => 0;
121 use base qw(Bio::OntologyIO::dagflat);
124 =head2 new
126 Title : new
127 Usage : $parser = Bio::OntologyIO->new(
128 -format => "go",
129 -defs_file => "/path/to/GO.defs",
130 -files => ["/path/to/component.ontology",
131 "/path/to/function.ontology",
132 "/path/to/process.ontology"] );
133 Function: Creates a new goflat parser.
134 Returns : A new goflat parser object, implementing Bio::OntologyIO.
135 Args : -defs_file => the name of the file holding the term
136 definitions
137 -files => a single ontology flat file holding the
138 term relationships, or an array ref holding
139 the file names (for GO, there will usually be
140 3 files: component.ontology, function.ontology,
141 process.ontology)
142 -file => if there is only a single flat file, it may
143 also be specified via the -file parameter
144 -ontology_name => the name of the ontology; if not specified the
145 parser will auto-discover it by using the term
146 that starts with a $, and converting underscores
147 to spaces
148 -engine => the Bio::Ontology::OntologyEngineI object
149 to be reused (will be created otherwise); note
150 that every Bio::Ontology::OntologyI will
151 qualify as well since that one inherits from the
152 former.
154 See L<Bio::OntologyIO>.
156 =cut
158 # in reality, we let OntologyIO::new do the instantiation, and override
159 # _initialize for all initialization work
160 sub _initialize {
161 my ($self, @args) = @_;
163 $self->SUPER::_initialize( @args );
165 # default term object factory
166 $self->term_factory(Bio::Ontology::TermFactory->new(
167 -type => "Bio::Ontology::GOterm"))
168 unless $self->term_factory();
170 } # _initialize