[Bioperl-l] Representation of phylogenetic trees
Marc Logghe
Marc.Logghe@devgen.com
Tue, 17 Dec 2002 09:25:08 +0100
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