correct test skip count
[bioperl-live.git] / Bio / OntologyIO / goflat.pm
blob4d4edad0807971a5f7a7ccfe46f521a5bdf8c2bd
2 # BioPerl module for Bio::OntologyIO::goflat
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Christian M. Zmasek <czmasek-at-burnham.org> or <cmzmasek@yahoo.com>
8 # (c) Christian M. Zmasek, czmasek-at-burnham.org, 2002.
9 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
11 # You may distribute this module under the same terms as perl itself.
12 # Refer to the Perl Artistic License (see the license accompanying this
13 # software package, or see http://www.perl.com/language/misc/Artistic.html)
14 # for the terms under which you may use, modify, and redistribute this module.
16 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
17 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 # You may distribute this module under the same terms as perl itself
22 # POD documentation - main docs before the code
24 =head1 NAME
26 Bio::OntologyIO::goflat - a parser for the Gene Ontology flat-file format
28 =head1 SYNOPSIS
30 use Bio::OntologyIO;
32 # do not use directly -- use via Bio::OntologyIO
33 my $parser = Bio::OntologyIO->new
34 ( -format => "go",
35 -defs_file => "/home/czmasek/GO/GO.defs",
36 -files => ["/home/czmasek/GO/component.ontology",
37 "/home/czmasek/GO/function.ontology",
38 "/home/czmasek/GO/process.ontology"] );
40 my $go_ontology = $parser->next_ontology();
42 my $IS_A = Bio::Ontology::RelationshipType->get_instance( "IS_A" );
43 my $PART_OF = Bio::Ontology::RelationshipType->get_instance( "PART_OF" );
45 =head1 DESCRIPTION
47 Needs Graph.pm from CPAN.
49 This is essentially a very thin derivation of the dagflat parser.
51 =head1 FEEDBACK
53 =head2 Mailing Lists
55 User feedback is an integral part of the evolution of this and other
56 Bioperl modules. Send your comments and suggestions preferably to the
57 Bioperl mailing lists Your participation is much appreciated.
59 bioperl-l@bioperl.org - General discussion
60 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
62 =head2 Support
64 Please direct usage questions or support issues to the mailing list:
66 I<bioperl-l@bioperl.org>
68 rather than to the module maintainer directly. Many experienced and
69 reponsive experts will be able look at the problem and quickly
70 address it. Please include a thorough description of the problem
71 with code and data examples if at all possible.
73 =head2 Reporting Bugs
75 Report bugs to the Bioperl bug tracking system to help us keep track
76 the bugs and their resolution. Bug reports can be submitted via the
77 web:
79 https://redmine.open-bio.org/projects/bioperl/
81 =head1 AUTHOR
83 Christian M. Zmasek
85 Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
87 WWW: http://monochrome-effect.net/
89 Address:
91 Genomics Institute of the Novartis Research Foundation
92 10675 John Jay Hopkins Drive
93 San Diego, CA 92121
95 =head2 CONTRIBUTOR
97 Hilmar Lapp, hlapp at gmx.net
99 =head1 APPENDIX
101 The rest of the documentation details each of the object
102 methods. Internal methods are usually preceded with a _
104 =cut
107 # Let the code begin...
110 package Bio::OntologyIO::goflat;
112 use strict;
114 use Bio::Ontology::TermFactory;
116 use constant TRUE => 1;
117 use constant FALSE => 0;
120 use base qw(Bio::OntologyIO::dagflat);
123 =head2 new
125 Title : new
126 Usage : $parser = Bio::OntologyIO->new(
127 -format => "go",
128 -defs_file => "/path/to/GO.defs",
129 -files => ["/path/to/component.ontology",
130 "/path/to/function.ontology",
131 "/path/to/process.ontology"] );
132 Function: Creates a new goflat parser.
133 Returns : A new goflat parser object, implementing Bio::OntologyIO.
134 Args : -defs_file => the name of the file holding the term
135 definitions
136 -files => a single ontology flat file holding the
137 term relationships, or an array ref holding
138 the file names (for GO, there will usually be
139 3 files: component.ontology, function.ontology,
140 process.ontology)
141 -file => if there is only a single flat file, it may
142 also be specified via the -file parameter
143 -ontology_name => the name of the ontology; if not specified the
144 parser will auto-discover it by using the term
145 that starts with a $, and converting underscores
146 to spaces
147 -engine => the Bio::Ontology::OntologyEngineI object
148 to be reused (will be created otherwise); note
149 that every Bio::Ontology::OntologyI will
150 qualify as well since that one inherits from the
151 former.
153 See L<Bio::OntologyIO>.
155 =cut
157 # in reality, we let OntologyIO::new do the instantiation, and override
158 # _initialize for all initialization work
159 sub _initialize {
160 my ($self, @args) = @_;
162 $self->SUPER::_initialize( @args );
164 # default term object factory
165 $self->term_factory(Bio::Ontology::TermFactory->new(
166 -type => "Bio::Ontology::GOterm"))
167 unless $self->term_factory();
169 } # _initialize