Difference between revisions of "PhyloSoC:BioPerl integration of the NeXML exchange standard and Bio::Phylo toolkit/HOWTO"

From Phyloinformatics
Jump to: navigation, search
m (Reading/Writing Entire Nexml Documents)
m (Example Code)
Line 26: Line 26:
 
  #Instantiate a Bio::Nexml object and link it to a file
 
  #Instantiate a Bio::Nexml object and link it to a file
 
  my $in_nexml = Bio::Nexml->new(-file => 'nexml_doc.xml', -format => 'Nexml');
 
  my $in_nexml = Bio::Nexml->new(-file => 'nexml_doc.xml', -format => 'Nexml');
+
 
 
  #Read in some data
 
  #Read in some data
 
  my $bptree1 = $in_nexml->next_tree();
 
  my $bptree1 = $in_nexml->next_tree();
 
  my $bpaln1  = $in_nexml->next_aln();
 
  my $bpaln1  = $in_nexml->next_aln();
 
  my $bpseq1  = $in_nexml->next_seq();
 
  my $bpseq1  = $in_nexml->next_seq();
+
 
  #Use data
+
  #Use/manipulate data
 
  ...
 
  ...
+
 
 
  #Write data to nexml file
 
  #Write data to nexml file
 
  my $out_nexml = Bio::Nexml->new(-file => '>new_nexml_doc.xml', -format => 'Nexml');
 
  my $out_nexml = Bio::Nexml->new(-file => '>new_nexml_doc.xml', -format => 'Nexml');

Revision as of 08:02, 27 July 2009

Abstract

This is a HOWTO about the Template:PM module, and how to use it to read and write complete Nexml documents. We will also describe how the Template:PM, Template:PM, and Template:PM modules work for outputting individual objects to nexml.

Authors

Chase Miller

Introduction

These nexml modules integrate the NeXML exchange standard into BioPerl, facilitating the adoption of this standard and easing the transition from the overworked NEXUS standard. A wrapper was used to allow BioPerl native access to the preferred NeXML parser (Bio::Phylo), allowing Bio::Phylo and NeXML to co-evolve without being encumbered by BioPerl

Nexml functionality in bioperl consists of four modules that allow the user to interact with nexml data in two different ways. Bio::nexml allows users to read/write an entire nexml document, whereas Bio::SeqIO::nexml, Bio::AlignIO::nexml, and Bio::TreeIO::nexml allow the user to only read/write one data type (seqs, alns, or trees, respectively).

Design

Coming...

Example Nexml Documents

Example documents to use with the example code can be found at http://www.nexml.org/nexml/examples/

Reading/Writing Entire Nexml Documents

Reading and writing a whole nexml document is accomplished with the Bio::Nexml module. The Bio::Nexml module can read a nexml document and maintain many of the data associations allowable by Bio::Phylo (however at this point not all data associations are maintained[link to list]). Once read the data can be converted into BioPerl objects (i.e Bio::Tree::Tree, Bio::SimpleAlign, and Bio::Seq) and manipulated before writing back to a nexml document.

Example Code

#Instantiate a Bio::Nexml object and link it to a file
my $in_nexml = Bio::Nexml->new(-file => 'nexml_doc.xml', -format => 'Nexml');
#Read in some data
my $bptree1 = $in_nexml->next_tree();
my $bpaln1  = $in_nexml->next_aln();
my $bpseq1  = $in_nexml->next_seq();
#Use/manipulate data
...
#Write data to nexml file
my $out_nexml = Bio::Nexml->new(-file => '>new_nexml_doc.xml', -format => 'Nexml');
$out_nexml->to_xml();

Reading/Writing Individual Datatypes (e.g. trees)

Differences in Roundtrip (BETTER NAME)

Some things in biophylo were not implemented in Bioperl because it either was very diffcult or did not make sense to

Associations Maintained

Associations Not Maintained

Alignments and Sequences of odd type (i.e. not DNA, RNA, or Protein)