| 1 | # | ||||||||||
| 2 | # BioPerl module for Bio::OntologyIO::soflat | ||||||||||
| 3 | # | ||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||
| 5 | # | ||||||||||
| 6 | # Cared for by Christian M. Zmasek <czmasek-at-burnham.org> or <cmzmasek@yahoo.com> | ||||||||||
| 7 | # | ||||||||||
| 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. | ||||||||||
| 11 | # | ||||||||||
| 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. | ||||||||||
| 16 | # | ||||||||||
| 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. | ||||||||||
| 20 | # | ||||||||||
| 21 | # You may distribute this module under the same terms as perl itself | ||||||||||
| 22 | |||||||||||
| 23 | # POD documentation - main docs before the code | ||||||||||
| 24 | |||||||||||
| 25 | =head1 NAME | ||||||||||
| 26 | |||||||||||
| 27 | Bio::OntologyIO::soflat - a parser for the Sequence Ontology flat-file format | ||||||||||
| 28 | |||||||||||
| 29 | =head1 SYNOPSIS | ||||||||||
| 30 | |||||||||||
| 31 | use Bio::OntologyIO; | ||||||||||
| 32 | |||||||||||
| 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" ); | ||||||||||
| 38 | |||||||||||
| 39 | my $sofa_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 base-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://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||
| 60 | |||||||||||
| 61 | =head2 Support | ||||||||||
| 62 | |||||||||||
| 63 | Please direct usage questions or support issues to the mailing list: | ||||||||||
| 64 | |||||||||||
| 65 | I<bioperl-l@bioperl.org> | ||||||||||
| 66 | |||||||||||
| 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. | ||||||||||
| 71 | |||||||||||
| 72 | =head2 Reporting Bugs | ||||||||||
| 73 | |||||||||||
| 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: | ||||||||||
| 77 | |||||||||||
| 78 | https://github.com/bioperl/bioperl-live/issues | ||||||||||
| 79 | |||||||||||
| 80 | =head1 AUTHOR | ||||||||||
| 81 | |||||||||||
| 82 | Christian M. Zmasek | ||||||||||
| 83 | |||||||||||
| 84 | Email: czmasek-at-burnham.org or cmzmasek@yahoo.com | ||||||||||
| 85 | |||||||||||
| 86 | WWW: http://monochrome-effect.net/ | ||||||||||
| 87 | |||||||||||
| 88 | Address: | ||||||||||
| 89 | |||||||||||
| 90 | Genomics Institute of the Novartis Research Foundation | ||||||||||
| 91 | 10675 John Jay Hopkins Drive | ||||||||||
| 92 | San Diego, CA 92121 | ||||||||||
| 93 | |||||||||||
| 94 | =head2 CONTRIBUTOR | ||||||||||
| 95 | |||||||||||
| 96 | Hilmar Lapp, hlapp at gmx.net | ||||||||||
| 97 | |||||||||||
| 98 | =head1 APPENDIX | ||||||||||
| 99 | |||||||||||
| 100 | The rest of the documentation details each of the object | ||||||||||
| 101 | methods. Internal methods are usually preceded with a _ | ||||||||||
| 102 | |||||||||||
| 103 | =cut | ||||||||||
| 104 | |||||||||||
| 105 | |||||||||||
| 106 | # Let the code begin... | ||||||||||
| 107 | |||||||||||
| 108 | |||||||||||
| 109 | package Bio::OntologyIO::soflat; | ||||||||||
| 110 | 3 | $Bio::OntologyIO::soflat::VERSION = '1.7.8'; | |||||||||
| 111 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 112 | |||||||||||
| 113 | 3 | ▶ | use Bio::Ontology::TermFactory; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 114 | |||||||||||
| 115 | 3 | ▶ | use constant TRUE => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 116 | 3 | ▶ | use constant FALSE => 0; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 117 | |||||||||||
| 118 | |||||||||||
| 119 | 3 | ▶ | use base qw(Bio::OntologyIO::dagflat); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 120 | |||||||||||
| 121 | |||||||||||
| 122 | =head2 new | ||||||||||
| 123 | |||||||||||
| 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. | ||||||||||
| 146 | |||||||||||
| 147 | See L<Bio::Ontology::OntologyI>. | ||||||||||
| 148 | |||||||||||
| 149 | =cut | ||||||||||
| 150 | |||||||||||
| 151 | # in reality, we let OntologyIO::new do the instantiation, and override | ||||||||||
| 152 | # _initialize for all initialization work | ||||||||||
| 153 | 2 | ▶ | sub _initialize { | ||||||||
|
Subroutine
_initialize: called CC=2 SCAR=7.1
| |||||||||||
| 154 | 2 | my ($self, @args) = @_; | |||||||||
| 155 | |||||||||||
| 156 | 2 | $self->SUPER::_initialize( @args ); | |||||||||
| 157 | |||||||||||
| 158 | # default term object factory | ||||||||||
| 159 | 2 | ▶ | $self->term_factory(Bio::Ontology::TermFactory->new( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 160 | -type => "Bio::Ontology::GOterm")) | ||||||||||
| 161 | unless $self->term_factory(); | ||||||||||
| 162 | |||||||||||
| 163 | } # _initialize | ||||||||||
| 164 | |||||||||||
| 165 | |||||||||||
| 166 | 3 | 1; | |||||||||