2 # BioPerl module for Bio::Tools::Phylo::Phylip::ProtDist
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Shawn Hoon <shawnh@fugu-sg.org>
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::Tools::Phylo::Phylip::ProtDist - parser for ProtDist output
20 use Bio::Tools::Phylo::Phylip::ProtDist;
21 my $parser = Bio::Tools::Phylo::Phylip::ProtDist->new(-file => 'outfile');
22 while( my $result = $parser->next_matrix) {
23 # do something with it
28 A parser for ProtDist output into a L<Bio::Matrix::PhylipDist> object.
29 See also L<Bio::Matrix::IO::phylip> this module may go away.
35 User feedback is an integral part of the evolution of this and other
36 Bioperl modules. Send your comments and suggestions preferably to
37 the Bioperl mailing list. Your participation is much appreciated.
39 bioperl-l@bioperl.org - General discussion
40 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
44 Please direct usage questions or support issues to the mailing list:
46 L<bioperl-l@bioperl.org>
48 rather than to the module maintainer directly. Many experienced and
49 reponsive experts will be able look at the problem and quickly
50 address it. Please include a thorough description of the problem
51 with code and data examples if at all possible.
55 Report bugs to the Bioperl bug tracking system to help us keep track
56 of the bugs and their resolution. Bug reports can be submitted via the
59 http://bugzilla.open-bio.org/
61 =head1 AUTHOR - Shawn Hoon
63 Email shawnh@fugu-sg.org
67 The rest of the documentation details each of the object methods.
68 Internal methods are usually preceded with a _
73 # Let the code begin...
76 package Bio
::Tools
::Phylo
::Phylip
::ProtDist
;
79 use Bio
::Matrix
::PhylipDist
;
82 use base
qw(Bio::Root::Root Bio::Root::IO);
87 Usage : my $obj = Bio::Tools::Phylo::Phylip::ProtDist->new();
88 Function: Builds a new Bio::Tools::Phylo::Phylip::ProtDist object
89 Returns : Bio::Tools::ProtDist
90 Args : -fh/-file => $val, # for initing input, see Bio::Root::IO
91 -program => 'programname' # name of the program
96 my($class,@args) = @_;
98 my $self = $class->SUPER::new
(@args);
99 $self->_initialize_io(@args);
100 my ($prog) = $self->_rearrange([qw(PROGRAM)], @args);
101 $self->{'_program'} = $prog;
108 Usage : my $matrix = $parser->next_matrix
109 Function: Get the next result set from parser data
110 Returns : L<Bio::Matrix::PhylipDist>
122 while ($entry=$self->_readline) {
123 if($#names >=0 && $entry =~/^\s+\d+\n$/){
124 $self->_pushback($entry);
126 } elsif($entry=~/^\s+(\d+)\n$/){
129 } elsif( $entry =~ s/^\s+(\-?\d+\.\d+)/$1/ ) {
130 my (@line) = split( /\s+/,$entry);
131 push @
{$values[-1]}, @line;
134 my ($n,@line) = split( /\s+/,$entry);
137 push @values, [@line];
139 if( scalar @names != $size ) {
140 $self->warn("The number of entries ".(scalar @names).
141 " is not the same $size");
143 $#names>=0 || return;
146 for my $name (@names){
149 $dist{$name}{$n} = [$i,$j];
154 return Bio
::Matrix
::PhylipDist
->new(-program
=> $self->{'_program'},
157 -values => \
@values);