Archive Ensembl HomeArchive Ensembl Home
Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter Class Reference
Inheritance diagram for Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter:

List of all members.


Class Summary

Synopsis

  use Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter;
  
  my $string_handle = IO::String-\>new();
  my $w = Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter-\>new(
    -SOURCE =\> 'Ensembl', -ALIGNED =\> 1, -HANDLE =\> $string_handle
  );
  
  my $pt = $dba-\>get_ProteinTreeAdaptor()-\>fetch_node_by_node_id(2);
  
  $w-\>write_trees($pt);
  $w-\>finish(); #YOU MUST CALL THIS TO WRITE THE FINAL TAG
  
  my $xml_scalar_ref = $string_handle-\>string_ref();
  
  #Or to write to a file via IO::File
  my $file_handle = IO::File-\>new('output.xml', 'w');
  $w = Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter-\>new(
    -SOURCE =\> 'Ensembl', -ALIGNED =\> 1, -HANDLE =\> $file_handle
  );
  $w-\>write_trees($pt);
  $w-\>finish(); #YOU MUST CALL THIS TO WRITE THE FINAL TAG
  $file_handle-\>close();
  
  #Or letting this deal with it
  $w = Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter-\>new(
    -SOURCE =\> 'Ensembl', -ALIGNED =\> 1, -FILE =\> 'loc.xml'
  );
  $w-\>write_trees($pt);
  $w-\>finish(); #YOU MUST CALL THIS TO WRITE THE FINAL TAG
  $w-\>handle()-\>close();

Description

Used as a way of emitting Compara GeneTrees in a format which conforms
to PhyloXML|http://www.phyloxml.org/. The code is built to work with
instances of Bio::EnsEMBL::Compara::GeneTree but can be extended to
operate on any tree structure provided by the Compara Graph infrastructure.
The code provides a number of property extensions to the existing PhyloXML
standard:
=over 8
=item Compara:genome_db_name
Used to show the name of the GenomeDB of the species found. Useful when 
taxonomy is not exact
=item Compara:dubious_duplication
Indicates locations of potential duplications we are unsure about
=back
The same document is persistent between write_trees() calls so to create
a new XML document create a new instance of this object.
 

Definition at line 70 of file PhyloXMLWriter.pm.

Available Methods

protected _build_writer ()
protected _dispatch_body ()
protected _dispatch_tag ()
protected _genetreemember_body ()
protected _genetreemember_tag ()
protected _genetreenode_body ()
protected _genetreenode_tag ()
protected _process ()
protected _write_closing ()
protected _write_opening ()
protected _write_taxonomy ()
protected _write_tree ()
protected _writer ()
public Boolean aligned ()
public Boolean cdna ()
public String file ()
public Nothing finish ()
public IO::Handle handle ()
public namespaces ()
public Instance new ()
public Boolean no_release_trees ()
public Boolean no_sequences ()
public String source ()
public void write_trees ()
public xml_schema_namespace ()

Method Documentation

protected Bio::EnsEMBL::Compara::Graph::BaseXMLWriter::_build_writer ( ) [inherited]
Builds the XML::Writer instance taking into account the handle to use and the
namespaces to register. Override to provide a custom writer instance
 
Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_dispatch_body ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_dispatch_tag ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_genetreemember_body ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_genetreemember_tag ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_genetreenode_body ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_genetreenode_tag ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_process ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_write_closing ( )

Undocumented method

Code:
click to view

Reimplemented from Bio::EnsEMBL::Compara::Graph::BaseXMLWriter.

protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_write_opening ( )

Undocumented method

Code:
click to view

Reimplemented from Bio::EnsEMBL::Compara::Graph::BaseXMLWriter.

protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_write_taxonomy ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::_write_tree ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::BaseXMLWriter::_writer ( ) [inherited]
Used to get the writer instance to use
 
Code:
click to view
public Boolean Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::aligned ( )
  Arg[0] : The value to set this to
  Description : Indicates if we want to push aligned sequences into the XML
  Returntype : Boolean
  Exceptions : None
  Status     : Stable
 
Code:
click to view
public Boolean Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::cdna ( )
  Arg[0] : The value to set this to
  Description : Indicates if we want CDNA sequence in the XML. If false
  the code will dump peptide data
  Returntype : Boolean
  Exceptions : None
  Status     : Stable
 
Code:
click to view
public String Bio::EnsEMBL::Compara::Graph::BaseXMLWriter::file ( ) [inherited]
  Arg[0] : Set the file location
  Description : Sets the file location to write to. Will undefine handle
  Returntype : String
  Exceptions : None
  Status     : Stable
 
Code:
click to view
public Nothing Bio::EnsEMBL::Compara::Graph::BaseXMLWriter::finish ( ) [inherited]
  Description : An important method which will write the final element. This
  allows you to stream any number of trees into one XML file and then call
  finish once you are done with it. B<Always call this method when you are
  done otherwise your XML will not be valid>.
  Returntype : Nothing
  Exceptions : Thrown if you are not finishing the file off with the correct
  end element
  Status     : Stable
 
Code:
click to view
public IO::Handle Bio::EnsEMBL::Compara::Graph::BaseXMLWriter::handle ( ) [inherited]
  Arg[0] : The handle to set
  Description : Mutator for the handle backing this writer. If invoked without
  giving it an instance of a handler it will use the FILE attribute to open
  an instance of IO::File
  Returntype : IO::Handle
  Exceptions : Thrown if we cannot open a file handle
  Status     : Stable
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::namespaces ( )
Provides the namespaces used in this writer (the PhyloXML namespace)
 
Code:
click to view

Reimplemented from Bio::EnsEMBL::Compara::Graph::BaseXMLWriter.

public Instance Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::new ( )
  Arg[CDNA]             : Boolean; indicates if we want CDNA emitted or peptide.
                          Defaults to false. 
  Arg[SOURCE]           : String; the source of the stable identifiers.
                          Defaults to Unknown.
  Arg[ALIGNED]          : Boolean; indicates if we want to emit aligned
                          sequence. Defaults to false.
  Arg[NO_SEQUENCES]     : Boolean; indicates we want to ignore sequence 
                          dumping. Defaults to false.
  Arg[HANDLE]           : IO::Handle; pass in an instance of IO::File or
                          an instance of IO::String so long as it behaves
                          the same as IO::Handle. Can be left blank in 
                          favour of the -FILE parameter
  Arg[FILE]             : Scalar; file to write to              
  Arg[NO_RELEASE_TREES] : Boolean; if set to true this will force the writer
                          to avoid calling release_tree() on every tree
                          given. Defaults to false
  Description : Creates a new tree writer object. 
  Returntype  : Instance of the writer
  Exceptions  : None
  Example     : my $w = Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter->new(
                  -SOURCE => 'Ensembl', -ALIGNED => 1, -HANDLE => $handle
                );
  Status      : Stable
 
Code:
click to view

Reimplemented from Bio::EnsEMBL::Compara::Graph::BaseXMLWriter.

public Boolean Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::no_release_trees ( )
  Arg [0] : Boolean; indiciates if we need to avoid releasing trees
  Returntype : Boolean
  Exceptions : None
  Status     : Stable
 
Code:
click to view
public Boolean Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::no_sequences ( )
  Arg[0] : The value to set this to
  Description : Indicates if we do not want to perform sequence dumping 
  Returntype  : Boolean
  Exceptions  : None
  Status      : Stable
 
Code:
click to view
public String Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::source ( )
  Arg[0] : The value to set this to
  Description : Indicates the source of the stable identifiers for the 
                peptides.
  Returntype : String
  Exceptions : None
  Status     : Stable
 
Code:
click to view
public void Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter::write_trees ( )
  Arg[0]      : The tree to write. Can be a single Tree or an ArrayRef
  Description : Writes a tree into the backing document representation
  Returntype  : None
  Exceptions  : Possible if there is an issue with retrieving data from the tree
  instance
  Example     : $writer->write_trees($tree);
                $writer->write_trees([$tree_one, $tree_two]);
  Status      : Stable
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::BaseXMLWriter::xml_schema_namespace ( ) [inherited]
Returns the namespace of the XML schema (currently W3C 2001)
 
Code:
click to view

The documentation for this class was generated from the following file: