tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / Bio / OntologyIO / soflat.pm
blobd1304864a9bae564c90394438234682a72643643
1 # $Id$
3 # BioPerl module for Bio::OntologyIO::soflat
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) Hilmar Lapp, hlapp at gnf.org, 2003.
11 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002-3.
13 # You may distribute this module under the same terms as perl itself.
14 # Refer to the Perl Artistic License (see the license accompanying this
15 # software package, or see http://www.perl.com/language/misc/Artistic.html)
16 # for the terms under which you may use, modify, and redistribute this module.
18 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
19 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 # You may distribute this module under the same terms as perl itself
24 # POD documentation - main docs before the code
26 =head1 NAME
28 Bio::OntologyIO::soflat - a parser for the Sequence Ontology flat-file format
30 =head1 SYNOPSIS
32 use Bio::OntologyIO;
34 # do not use directly -- use via Bio::OntologyIO
35 my $parser = Bio::OntologyIO->new
36 ( -format => "so", # or soflat
37 -defs_file => "/home/czmasek/SO/SO.defs",
38 -file => "/home/czmasek/SO/sofa.ontology" );
40 my $sofa_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 base-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 http://bugzilla.open-bio.org/
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::soflat;
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 => "soflat",
128 -files => ["/path/to/sofa.ontology"] );
129 Function: Creates a new soflat parser.
130 Returns : A new soflat parser object, implementing Bio::OntologyIO.
131 Args : -defs_file => the name of the file holding the term
132 definitions
133 -files => a single ontology flat file holding the
134 term relationships, or an array ref holding
135 the file names
136 -file => if there is only a single flat file, it may
137 also be specified via the -file parameter
138 -ontology_name => the name of the ontology; if not specified the
139 parser will auto-discover it by using the term
140 that starts with a $, and converting underscores
141 to spaces
142 -engine => the Bio::Ontology::OntologyEngineI object
143 to be reused (will be created otherwise); note
144 that every Bio::Ontology::OntologyI will
145 qualify as well since that one inherits from the
146 former.
148 See L<Bio::Ontology::OntologyI>.
150 =cut
152 # in reality, we let OntologyIO::new do the instantiation, and override
153 # _initialize for all initialization work
154 sub _initialize {
155 my ($self, @args) = @_;
157 $self->SUPER::_initialize( @args );
159 # default term object factory
160 $self->term_factory(Bio::Ontology::TermFactory->new(
161 -type => "Bio::Ontology::GOterm"))
162 unless $self->term_factory();
164 } # _initialize