0
|
1 # $Id: goflat.pm,v 1.1.2.3 2003/05/27 22:00:52 lapp Exp $
|
|
2 #
|
|
3 # BioPerl module for Bio::OntologyIO::goflat
|
|
4 #
|
|
5 # Cared for by Christian M. Zmasek <czmasek@gnf.org> or <cmzmasek@yahoo.com>
|
|
6 #
|
|
7 # (c) Christian M. Zmasek, czmasek@gnf.org, 2002.
|
|
8 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
|
|
9 #
|
|
10 # You may distribute this module under the same terms as perl itself.
|
|
11 # Refer to the Perl Artistic License (see the license accompanying this
|
|
12 # software package, or see http://www.perl.com/language/misc/Artistic.html)
|
|
13 # for the terms under which you may use, modify, and redistribute this module.
|
|
14 #
|
|
15 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
16 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
17 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
18 #
|
|
19 # You may distribute this module under the same terms as perl itself
|
|
20
|
|
21 # POD documentation - main docs before the code
|
|
22
|
|
23 =head1 NAME
|
|
24
|
|
25 goflat - a parser for the Gene Ontology flat-file format
|
|
26
|
|
27 =head1 SYNOPSIS
|
|
28
|
|
29 use Bio::OntologyIO;
|
|
30
|
|
31 # do not use directly -- use via Bio::OntologyIO
|
|
32 my $parser = Bio::OntologyIO->new
|
|
33 ( -format => "go",
|
|
34 -defs_file => "/home/czmasek/GO/GO.defs",
|
|
35 -files => ["/home/czmasek/GO/component.ontology",
|
|
36 "/home/czmasek/GO/function.ontology",
|
|
37 "/home/czmasek/GO/process.ontology"] );
|
|
38
|
|
39 my $go_ontology = $parser->next_ontology();
|
|
40
|
|
41 my $IS_A = Bio::Ontology::RelationshipType->get_instance( "IS_A" );
|
|
42 my $PART_OF = Bio::Ontology::RelationshipType->get_instance( "PART_OF" );
|
|
43
|
|
44 =head1 DESCRIPTION
|
|
45
|
|
46 Needs Graph.pm from CPAN.
|
|
47
|
|
48 This is essentially a very thin derivation of the dagflat parser.
|
|
49
|
|
50 =head1 FEEDBACK
|
|
51
|
|
52 =head2 Mailing Lists
|
|
53
|
|
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.
|
|
57
|
|
58 bioperl-l@bioperl.org - General discussion
|
|
59 http://bio.perl.org/MailList.html - About the mailing lists
|
|
60
|
|
61 =head2 Reporting Bugs
|
|
62
|
|
63 report bugs to the Bioperl bug tracking system to help us keep track
|
|
64 the bugs and their resolution. Bug reports can be submitted via
|
|
65 email or the web:
|
|
66
|
|
67 bioperl-bugs@bio.perl.org
|
|
68 http://bugzilla.bioperl.org/
|
|
69
|
|
70 =head1 AUTHOR
|
|
71
|
|
72 Christian M. Zmasek
|
|
73
|
|
74 Email: czmasek@gnf.org or cmzmasek@yahoo.com
|
|
75
|
|
76 WWW: http://www.genetics.wustl.edu/eddy/people/zmasek/
|
|
77
|
|
78 Address:
|
|
79
|
|
80 Genomics Institute of the Novartis Research Foundation
|
|
81 10675 John Jay Hopkins Drive
|
|
82 San Diego, CA 92121
|
|
83
|
|
84 =head2 CONTRIBUTOR
|
|
85
|
|
86 Hilmar Lapp, hlapp at gmx.net
|
|
87
|
|
88 =head1 APPENDIX
|
|
89
|
|
90 The rest of the documentation details each of the object
|
|
91 methods. Internal methods are usually preceded with a _
|
|
92
|
|
93 =cut
|
|
94
|
|
95
|
|
96 # Let the code begin...
|
|
97
|
|
98
|
|
99 package Bio::OntologyIO::goflat;
|
|
100
|
|
101 use vars qw( @ISA );
|
|
102 use strict;
|
|
103
|
|
104 use Bio::Ontology::TermFactory;
|
|
105 use Bio::OntologyIO::dagflat;
|
|
106
|
|
107 use constant TRUE => 1;
|
|
108 use constant FALSE => 0;
|
|
109
|
|
110
|
|
111 @ISA = qw( Bio::OntologyIO::dagflat );
|
|
112
|
|
113
|
|
114 =head2 new
|
|
115
|
|
116 Title : new
|
|
117 Usage : $parser = Bio::OntologyIO->new(
|
|
118 -format => "go",
|
|
119 -defs_file => "/path/to/GO.defs",
|
|
120 -files => ["/path/to/component.ontology",
|
|
121 "/path/to/function.ontology",
|
|
122 "/path/to/process.ontology"] );
|
|
123 Function: Creates a new goflat parser.
|
|
124 Returns : A new goflat parser object, implementing L<Bio::OntologyIO>.
|
|
125 Args : -defs_file => the name of the file holding the term
|
|
126 definitions
|
|
127 -files => a single ontology flat file holding the
|
|
128 term relationships, or an array ref holding
|
|
129 the file names (for GO, there will usually be
|
|
130 3 files: component.ontology, function.ontology,
|
|
131 process.ontology)
|
|
132 -file => if there is only a single flat file, it may
|
|
133 also be specified via the -file parameter
|
|
134 -ontology_name => the name of the ontology; if not specified the
|
|
135 parser will auto-discover it by using the term
|
|
136 that starts with a '$', and converting underscores
|
|
137 to spaces
|
|
138 -engine => the Bio::Ontology::OntologyEngineI object
|
|
139 to be reused (will be created otherwise); note
|
|
140 that every Bio::Ontology::OntologyI will
|
|
141 qualify as well since that one inherits from the
|
|
142 former.
|
|
143
|
|
144 =cut
|
|
145
|
|
146 # in reality, we let OntologyIO::new do the instantiation, and override
|
|
147 # _initialize for all initialization work
|
|
148 sub _initialize {
|
|
149 my ($self, @args) = @_;
|
|
150
|
|
151 $self->SUPER::_initialize( @args );
|
|
152
|
|
153 # default term object factory
|
|
154 $self->term_factory(Bio::Ontology::TermFactory->new(
|
|
155 -type => "Bio::Ontology::GOterm"))
|
|
156 unless $self->term_factory();
|
|
157
|
|
158 } # _initialize
|
|
159
|
|
160
|
|
161 1;
|