[Bioperl-l] Representation of phylogenetic trees
Jason Stajich
jason@cgt.mc.duke.edu
Tue, 17 Dec 2002 08:04:57 -0500 (EST)
All the methods that objects support is also documented, I would suggest
this first before just blindly dumping out with Data::Dumper which is
going to show you a lot of the internal data structures which you
shouldn't need to deal with:
% perldoc Bio::Tree::Tree
% perldoc Bio::Tree::Node
You can also see these and click through the inheritance heirarchy (in
Object-Oriented programming objects can inherit methods from their
'parent') at http://docs.bioperl.org.
-jason
On Tue, 17 Dec 2002, Marc Logghe wrote:
> Hi Jutta,
> I think you first have to find out which kind of object you are dealing
> with. That is easy to find out with ref() or even better 'use Data::Dumper'
> for that.
> Suppose you get a $taxon object some way or another, do:
> print Data::Dumper->Dump([$taxon],['taxon']);
> You don't really want to know the attributes of your objects, get to know
> the available methods instead.
> Once you have found out the class of your object you can use bptutorial to
> get the methods, e.g.:
> >bptutorial.pl 100 Bio::Tree::Tree
>
> Another option is to use a little script based on Class::Inspector, the one
> that Heikki posted for instance
> (http://bioperl.org/pipermail/bioperl-l/2002-November/010076.html).
> I used his script as a base for the 'methods' script I use almost daily:
>
> #!/usr/bin/perl -w
> # $Id: methods,v 1.2 2002/12/16 03:36:46 marcl Exp $
> # Script to display the available methods of a Perl module
> use strict;
> use Class::Inspector;
> use Getopt::Long;
>
> my $PRIVATE = '';
>
> GetOptions(
> 'private' => \$PRIVATE,
> )
> && @ARGV
> or print <<USAGE and exit;
> $0 [--private -p] class
> prints a list of the available public/private methods of 'class'
> --private -p : private methods
> USAGE
>
> my $class = $ARGV[-1];
> eval "require $class";
> if ($@)
> {
> print "class '$class' not found\n";
> }
> else
> {
> print join ("\n", sort @{Class::Inspector->methods($class,'full', $PRIVATE
> ? 'private' : 'public')}),
> "\n";
> }
>
> HTH and good luck,
> Marc
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu