squash waffling test
[bioperl-live.git] / Bio / OntologyIO / soflat.pm
blob3094d6643b010e26812ad54f28435ee65c02d35e
2 # BioPerl module for Bio::OntologyIO::soflat
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) Hilmar Lapp, hlapp at gnf.org, 2003.
10 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002-3.
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::soflat - a parser for the Sequence 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 => "so", # or soflat
36 -defs_file => "/home/czmasek/SO/SO.defs",
37 -file => "/home/czmasek/SO/sofa.ontology" );
39 my $sofa_ontology = $parser->next_ontology();
41 my $IS_A = Bio::Ontology::RelationshipType->get_instance( "IS_A" );
42 my $PART_OF = Bio::Ontology::RelationshipType->get_instance( "PART_OF" );
44 =head1 DESCRIPTION
46 Needs Graph.pm from CPAN.
48 This is essentially a very thin derivation of the dagflat base-parser.
50 =head1 FEEDBACK
52 =head2 Mailing Lists
54 User feedback is an integral part of the evolution of this and other
55 Bioperl modules. Send your comments and suggestions preferably to the
56 Bioperl mailing lists Your participation is much appreciated.
58 bioperl-l@bioperl.org - General discussion
59 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
61 =head2 Support
63 Please direct usage questions or support issues to the mailing list:
65 I<bioperl-l@bioperl.org>
67 rather than to the module maintainer directly. Many experienced and
68 reponsive experts will be able look at the problem and quickly
69 address it. Please include a thorough description of the problem
70 with code and data examples if at all possible.
72 =head2 Reporting Bugs
74 Report bugs to the Bioperl bug tracking system to help us keep track
75 the bugs and their resolution. Bug reports can be submitted via the
76 web:
78 https://github.com/bioperl/bioperl-live/issues
80 =head1 AUTHOR
82 Christian M. Zmasek
84 Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
86 WWW: http://monochrome-effect.net/
88 Address:
90 Genomics Institute of the Novartis Research Foundation
91 10675 John Jay Hopkins Drive
92 San Diego, CA 92121
94 =head2 CONTRIBUTOR
96 Hilmar Lapp, hlapp at gmx.net
98 =head1 APPENDIX
100 The rest of the documentation details each of the object
101 methods. Internal methods are usually preceded with a _
103 =cut
106 # Let the code begin...
109 package Bio::OntologyIO::soflat;
111 use strict;
113 use Bio::Ontology::TermFactory;
115 use constant TRUE => 1;
116 use constant FALSE => 0;
119 use base qw(Bio::OntologyIO::dagflat);
122 =head2 new
124 Title : new
125 Usage : $parser = Bio::OntologyIO->new(
126 -format => "soflat",
127 -files => ["/path/to/sofa.ontology"] );
128 Function: Creates a new soflat parser.
129 Returns : A new soflat parser object, implementing Bio::OntologyIO.
130 Args : -defs_file => the name of the file holding the term
131 definitions
132 -files => a single ontology flat file holding the
133 term relationships, or an array ref holding
134 the file names
135 -file => if there is only a single flat file, it may
136 also be specified via the -file parameter
137 -ontology_name => the name of the ontology; if not specified the
138 parser will auto-discover it by using the term
139 that starts with a $, and converting underscores
140 to spaces
141 -engine => the Bio::Ontology::OntologyEngineI object
142 to be reused (will be created otherwise); note
143 that every Bio::Ontology::OntologyI will
144 qualify as well since that one inherits from the
145 former.
147 See L<Bio::Ontology::OntologyI>.
149 =cut
151 # in reality, we let OntologyIO::new do the instantiation, and override
152 # _initialize for all initialization work
153 sub _initialize {
154 my ($self, @args) = @_;
156 $self->SUPER::_initialize( @args );
158 # default term object factory
159 $self->term_factory(Bio::Ontology::TermFactory->new(
160 -type => "Bio::Ontology::GOterm"))
161 unless $self->term_factory();
163 } # _initialize