comparison variant_effect_predictor/Bio/OntologyIO/soflat.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 # $Id: soflat.pm,v 1.1.2.3 2003/05/27 22:00:52 lapp Exp $
2 #
3 # BioPerl module for Bio::OntologyIO::soflat
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) Hilmar Lapp, hlapp at gnf.org, 2003.
9 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002-3.
10 #
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.
15 #
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.
19 #
20 # You may distribute this module under the same terms as perl itself
21
22 # POD documentation - main docs before the code
23
24 =head1 NAME
25
26 soflat - a parser for the Sequence Ontology flat-file format
27
28 =head1 SYNOPSIS
29
30 use Bio::OntologyIO;
31
32 # do not use directly -- use via Bio::OntologyIO
33 my $parser = Bio::OntologyIO->new
34 ( -format => "so", # or soflat
35 -defs_file => "/home/czmasek/SO/SO.defs",
36 -file => "/home/czmasek/SO/sofa.ontology" );
37
38 my $sofa_ontology = $parser->next_ontology();
39
40 my $IS_A = Bio::Ontology::RelationshipType->get_instance( "IS_A" );
41 my $PART_OF = Bio::Ontology::RelationshipType->get_instance( "PART_OF" );
42
43 =head1 DESCRIPTION
44
45 Needs Graph.pm from CPAN.
46
47 This is essentially a very thin derivation of the dagflat base-parser.
48
49 =head1 FEEDBACK
50
51 =head2 Mailing Lists
52
53 User feedback is an integral part of the evolution of this and other
54 Bioperl modules. Send your comments and suggestions preferably to the
55 Bioperl mailing lists Your participation is much appreciated.
56
57 bioperl-l@bioperl.org - General discussion
58 http://bio.perl.org/MailList.html - About the mailing lists
59
60 =head2 Reporting Bugs
61
62 report bugs to the Bioperl bug tracking system to help us keep track
63 the bugs and their resolution. Bug reports can be submitted via
64 email or the web:
65
66 bioperl-bugs@bio.perl.org
67 http://bugzilla.bioperl.org/
68
69 =head1 AUTHOR
70
71 Christian M. Zmasek
72
73 Email: czmasek@gnf.org or cmzmasek@yahoo.com
74
75 WWW: http://www.genetics.wustl.edu/eddy/people/zmasek/
76
77 Address:
78
79 Genomics Institute of the Novartis Research Foundation
80 10675 John Jay Hopkins Drive
81 San Diego, CA 92121
82
83 =head2 CONTRIBUTOR
84
85 Hilmar Lapp, hlapp at gmx.net
86
87 =head1 APPENDIX
88
89 The rest of the documentation details each of the object
90 methods. Internal methods are usually preceded with a _
91
92 =cut
93
94
95 # Let the code begin...
96
97
98 package Bio::OntologyIO::soflat;
99
100 use vars qw( @ISA );
101 use strict;
102
103 use Bio::Ontology::TermFactory;
104 use Bio::OntologyIO::dagflat;
105
106 use constant TRUE => 1;
107 use constant FALSE => 0;
108
109
110 @ISA = qw( Bio::OntologyIO::dagflat );
111
112
113 =head2 new
114
115 Title : new
116 Usage : $parser = Bio::OntologyIO->new(
117 -format => "soflat",
118 -files => ["/path/to/sofa.ontology"] );
119 Function: Creates a new soflat parser.
120 Returns : A new soflat parser object, implementing Bio::OntologyIO.
121 Args : -defs_file => the name of the file holding the term
122 definitions
123 -files => a single ontology flat file holding the
124 term relationships, or an array ref holding
125 the file names
126 -file => if there is only a single flat file, it may
127 also be specified via the -file parameter
128 -ontology_name => the name of the ontology; if not specified the
129 parser will auto-discover it by using the term
130 that starts with a '$', and converting underscores
131 to spaces
132 -engine => the L<Bio::Ontology::OntologyEngineI> object
133 to be reused (will be created otherwise); note
134 that every L<Bio::Ontology::OntologyI> will
135 qualify as well since that one inherits from the
136 former.
137
138 =cut
139
140 # in reality, we let OntologyIO::new do the instantiation, and override
141 # _initialize for all initialization work
142 sub _initialize {
143 my ($self, @args) = @_;
144
145 $self->SUPER::_initialize( @args );
146
147 # default term object factory
148 $self->term_factory(Bio::Ontology::TermFactory->new(
149 -type => "Bio::Ontology::GOterm"))
150 unless $self->term_factory();
151
152 } # _initialize
153
154
155 1;