| 1 | # $Id: GraphAdaptor02.pm 10525 2006-09-26 22:03:22Z sendu $ | ||
| 2 | # | ||
| 3 | # BioPerl adaptor for old Graph verions (0.2x) for use in | ||
| 4 | # FAST::Bio::Ontology::SimpleGOEngine | ||
| 5 | # | ||
| 6 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||
| 7 | # | ||
| 8 | # Cared for by Nat Goodman <natg at shore.net> | ||
| 9 | # | ||
| 10 | # (c) Nathan Goodman natg@shore.net 2005 | ||
| 11 | # (c) ISB, Institute for Systems Biology 2005 | ||
| 12 | # | ||
| 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. | ||
| 17 | # | ||
| 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. | ||
| 21 | # | ||
| 22 | # You may distribute this module under the same terms as perl itself | ||
| 23 | |||
| 24 | # POD documentation - main docs before the code | ||
| 25 | |||
| 26 | =head1 NAME | ||
| 27 | |||
| 28 | FAST::Bio::Ontology::SimpleGOEngine::GraphAdaptor02 - Graph adaptor (v02.x) for | ||
| 29 | FAST::Bio::Ontology::SimpleGOEngine | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | Internal subclass of FAST::Bio::Ontology::SimpleGOEngine::GraphAdaptor for | ||
| 34 | Graph v0.2x. | ||
| 35 | |||
| 36 | Call this via FAST::Bio::Ontology::SimpleGOEngine::GraphAdaptor | ||
| 37 | |||
| 38 | =head1 FEEDBACK | ||
| 39 | |||
| 40 | =head2 Mailing Lists | ||
| 41 | |||
| 42 | User feedback is an integral part of the evolution of this and other | ||
| 43 | Bioperl modules. Send your comments and suggestions preferably to the | ||
| 44 | Bioperl mailing lists Your participation is much appreciated. | ||
| 45 | |||
| 46 | bioperl-l@bioperl.org - General discussion | ||
| 47 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||
| 48 | |||
| 49 | =head2 Support | ||
| 50 | |||
| 51 | Please direct usage questions or support issues to the mailing list: | ||
| 52 | |||
| 53 | I<bioperl-l@bioperl.org> | ||
| 54 | |||
| 55 | rather than to the module maintainer directly. Many experienced and | ||
| 56 | reponsive experts will be able look at the problem and quickly | ||
| 57 | address it. Please include a thorough description of the problem | ||
| 58 | with code and data examples if at all possible. | ||
| 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 the | ||
| 64 | web: | ||
| 65 | |||
| 66 | https://redmine.open-bio.org/projects/bioperl/ | ||
| 67 | |||
| 68 | =head1 AUTHOR | ||
| 69 | |||
| 70 | Nat Goodman | ||
| 71 | |||
| 72 | Email: natg at shore.net | ||
| 73 | |||
| 74 | Address: | ||
| 75 | |||
| 76 | Institute for Systems Biology | ||
| 77 | 1441 N 34th St | ||
| 78 | Seattle, WA 98103-8904 | ||
| 79 | |||
| 80 | =head1 APPENDIX | ||
| 81 | |||
| 82 | The rest of the documentation details each of the object | ||
| 83 | methods. Internal methods are usually preceded with a _ | ||
| 84 | |||
| 85 | =cut | ||
| 86 | |||
| 87 | # Let the code begin... | ||
| 88 | |||
| 89 | package FAST::Bio::Ontology::SimpleGOEngine::GraphAdaptor02; | ||
| 90 | |||
| 91 | |||
| 92 | use strict; | ||
| 93 | |||
| 94 | use base qw(FAST::Bio::Ontology::SimpleGOEngine::GraphAdaptor); | ||
| 95 | |||
| 96 | # edges | ||
| 97 | # v0.2x returns (u0,v0, u1,v1, ...) | ||
| 98 | # v0.5x returns ([u0,v0], [u1,v1], ...) | ||
| 99 | sub edges { | ||
| 100 | my $self=shift; | ||
| 101 | my @edges02=$self->_graph->edges(@_); | ||
| 102 | my @edges; | ||
| 103 | while (@edges02) { | ||
| 104 | my($u,$v)=(shift @edges02,shift @edges02); | ||
| 105 | push(@edges,[$u,$v]); | ||
| 106 | } | ||
| 107 | @edges; | ||
| 108 | } | ||
| 109 | |||
| 110 | # edges_at | ||
| 111 | # v0.2x uses edges() method and returns (u0,v0, u1,v1, ...) | ||
| 112 | # v0.5x returns ([u0,v0], [u1,v1], ...) | ||
| 113 | sub edges_at { | ||
| 114 | my $self=shift; | ||
| 115 | $self->edges(@_); | ||
| 116 | } | ||
| 117 | |||
| 118 | # set_vertex_attribute | ||
| 119 | # v0.2x uses set_attribute($attribute,$v,$value) | ||
| 120 | sub set_vertex_attribute { | ||
| 121 | my($self,$v,$attribute,$value)=@_; | ||
| 122 | $self->_graph->set_attribute($attribute,$v,$value); | ||
| 123 | } | ||
| 124 | |||
| 125 | # get_vertex_attribute | ||
| 126 | # v0.2x uses get_attribute($attribute,$v) | ||
| 127 | sub get_vertex_attribute { | ||
| 128 | my($self,$v,$attribute)=@_; | ||
| 129 | $self->_graph->get_attribute($attribute,$v); | ||
| 130 | } | ||
| 131 | |||
| 132 | # set_edge_attribute | ||
| 133 | # v0.2x uses set_attribute($attribute,$u,$v,$value) | ||
| 134 | sub set_edge_attribute { | ||
| 135 | my($self,$u,$v,$attribute,$value)=@_; | ||
| 136 | $self->_graph->set_attribute($attribute,$u,$v,$value); | ||
| 137 | } | ||
| 138 | |||
| 139 | # get_edge_attribute | ||
| 140 | # v0.2x uses get_attribute($attribute,$u,$v) | ||
| 141 | sub get_edge_attribute { | ||
| 142 | my($self,$u,$v,$attribute)=@_; | ||
| 143 | $self->_graph->get_attribute($attribute,$u,$v); | ||
| 144 | } | ||
| 145 | |||
| 146 | 1; |