NAME

Bio::Phylo::Project - Container for related data

SYNOPSIS

use Bio::Phylo::Factory;
my $fac  = Bio::Phylo::Factory->new;
my $proj = $fac->create_project;
my $taxa = $fac->create_taxa;
$proj->insert($taxa);
$proj->insert($fac->create_matrix->set_taxa($taxa));
$proj->insert($fac->create_forest->set_taxa($taxa));
print $proj->to_xml;

DESCRIPTION

The project module is used to collect taxa blocks, tree blocks and matrices.

METHODS

MUTATORS

set_datasource()

Project constructor.

Type    : Constructor
Title   : set_datasource
Usage   : $project->set_datasource( -file => $file, -format => 'nexus' )
Function: Populates a Bio::Phylo::Project object from a data source
Returns : A Bio::Phylo::Project object.
Args    : Arguments as must be passed to Bio::Phylo::IO::parse
reset_xml_ids()

Resets all xml ids to default values

Type    : Mutator
Title   : reset_xml_ids
Usage   : $project->reset_xml_ids
Function: Resets all xml ids to default values
Returns : A Bio::Phylo::Project object.
Args    : None

ACCESSORS

get_taxa()

Getter for taxa objects

Type    : Accessor
Title   : get_taxa
Usage   : my $taxa = $proj->get_taxa;
Function: Getter for taxa objects
Returns : An array reference of taxa objects
Args    : NONE.
get_forests()

Getter for forest objects

Type    : Accessor
Title   : get_forests
Usage   : my $forest = $proj->get_forests;
Function: Getter for forest objects
Returns : An array reference of forest objects
Args    : NONE.
get_matrices()

Getter for matrix objects

Type    : Accessor
Title   : get_matrices
Usage   : my $matrix = $proj->get_matrices;
Function: Getter for matrix objects
Returns : An array reference of matrix objects
Args    : NONE.
get_items()

Gets all items of the specified type, recursively. This method can be used to get things like all the trees in all the forest objects as one flat list (or, indeed, all nodes, all taxon objects, etc.)

Type    : Accessor
Title   : get_items
Usage   : my @nodes = @{ $proj->get_items(_NODE_) };
Function: Getter for items of specified type
Returns : An array reference of objects
Args    : A type constant as defined in Bio::Phylo::Util::CONSTANT
get_document()
Type    : Serializer
Title   : doc
Usage   : $proj->get_document()
Function: Creates a DOM Document object, containing the 
          present state of the project by default
Returns : a Document object
Args    : a DOM factory object
          Optional: pass 1 to obtain a document node without 
          content
get_attributes()

Retrieves attributes for the element.

Type    : Accessor
Title   : get_attributes
Usage   : my %attrs = %{ $obj->get_attributes };
Function: Gets the xml attributes for the object;
Returns : A hash reference
Args    : None.
Comments: throws ObjectMismatch if no linked taxa object 
          can be found
is_identifiable()

By default, all XMLWritable objects are identifiable when serialized, i.e. they have a unique id attribute. However, in some cases a serialized object may not have an id attribute (governed by the nexml schema). This method indicates whether that is the case.

Type    : Test
Title   : is_identifiable
Usage   : if ( $obj->is_identifiable ) { ... }
Function: Indicates whether IDs are generated
Returns : BOOLEAN
Args    : NONE

SERIALIZERS

to_xml()

Serializes invocant to XML.

Type    : XML serializer
Title   : to_xml
Usage   : my $xml = $obj->to_xml;
Function: Serializes $obj to xml
Returns : An xml string
Args    : Same arguments as can be passed to individual contained objects
to_nexus()

Serializes invocant to NEXUS.

Type    : NEXUS serializer
Title   : to_nexus
Usage   : my $nexus = $obj->to_nexus;
Function: Serializes $obj to nexus
Returns : An nexus string
Args    : Same arguments as can be passed to individual contained objects
to_dom()
Type    : Serializer
Title   : to_dom
Usage   : $node->to_dom
Function: Generates a DOM subtree from the invocant
          and its contained objects
Returns : an XML::LibXML::Element object
Args    : a DOM factory object

SEE ALSO

There is a mailing list at https://groups.google.com/forum/#!forum/bio-phylo for any user or developer questions and discussions.

Bio::Phylo::Listable

The Bio::Phylo::Project object inherits from the Bio::Phylo::Listable object. Look there for more methods applicable to the project object.

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com.

CITATION

If you use Bio::Phylo in published research, please cite it:

Rutger A Vos, Jason Caravas, Klaas Hartmann, Mark A Jensen and Chase Miller, 2011. Bio::Phylo - phyloinformatic analysis using Perl. BMC Bioinformatics 12:63. http://dx.doi.org/10.1186/1471-2105-12-63