DOKK / manpages / debian 10 / libbio-perl-perl / Bio::NexmlIO.3pm.en
Bio::NexmlIO(3pm) User Contributed Perl Documentation Bio::NexmlIO(3pm)

Bio::NexmlIO - stream handler for NeXML documents

    #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();

Bio::NexmlIO is an I/O handler for a NeXML document. A NeXML document can represent three different data types: simple sequences, alignments, and trees. NexmlIO has four main methods next_tree, next_seq, next_aln, and write. NexmlIO returns bioperl seq, tree, and aln objects which can be manipulated then passed to the write method of a new NexmlIO instance to allow the creation of a NeXML document.

Each bioperl object contains all the information necessary to recreate a Bio::Phylo::Taxa object, so each time a bioperl object is converted to a biophylo object, the bioperl object is checked to see if its associated taxa has already been created (against a hash using the NexmlIO_ID and Taxa_ID to create a unique string). If not, it is created; if so, that taxa object is used to link the Bio::Phylo tree or matrix.

For more information on the NeXML format, see <http://www.nexml.org>.

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists.

Your participation is much appreciated.

  bioperl-l@bioperl.org                  - General discussion
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:

  https://github.com/bioperl/bioperl-live/issues

Email chmille4@gmail.com

Mark A. Jensen, maj -at- fortinbras -dot- com

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

 Title   : new
 Usage   : my $in_nexmlIO = Bio::NexmlIO->new(-file => 'data.nexml.xml');
 Function: Creates a L<Bio::NexmlIO> object linked to a stream
 Returns : a L<Bio::NexmlIO> object
 Args    : file name
 
 See L<Bio::Root::IO>

 Title   : doc
 Usage   : my $nexml_doc = $in_nexmlIO->doc();
 Function: returns a L<Bio::Phylo::Project> object that contains all the Bio::Phylo data objects parsed from the stream
 Returns : a L<Bio::Phylo::Project> object
 Args    : none

 Title   : next_tree
 Usage   : $tree = $stream->next_tree
 Function: Reads the next tree object from the stream and returns it.
 Returns : a L<Bio::Tree::Tree> object
 Args    : none

See Bio::Root::IO, Bio::Tree::Tree

 Title   : next_seq
 Usage   : $seq = $stream->next_seq
 Function: Reads the next seq object from the stream and returns it.
 Returns : a L<Bio::Seq> object
 Args    : none

See Bio::Root::IO, Bio::Seq

 Title   : next_aln
 Usage   : $aln = $stream->next_aln
 Function: Reads the next aln object from the stream and returns it.
 Returns : a L<Bio::SimpleAlign> object
 Args    : none

See Bio::Root::IO, Bio::SimpleAlign

 Title   : rewind_seq
 Usage   : $stream->rewind_seq
 Function: Resets the stream for seqs
 Returns : none
 Args    : none

See Bio::Root::IO, Bio::Seq

 Title   : rewind_aln
 Usage   : $stream->rewind_aln
 Function: Resets the stream for alns
 Returns : none
 Args    : none

See Bio::Root::IO, Bio::Simple::Align

 Title   : rewind_tree
 Usage   : $stream->rewind_tree
 Function: Resets the stream for trees
 Returns : none
 Args    : none

See Bio::Root::IO, Bio::tree::tree

 Title   : write
 Usage   : $stream->write(-alns => $alns,-seqs => $seqs,-trees => $trees)
 Function: converts BioPerl seq, tree, and aln objects into Bio::Phylo
           seq, tree, and aln objects, constructs a Bio::Phylo::Project 
           object made up of the newly created Bio::Phylo objects, and 
           writes the Bio::Phylo:Project object to the stream as a valid 
           nexml document
 Returns : none
 Args    : \@L<Bio::Seq>, \@L<Bio::SimpleAlign>, \@L<Bio::Tree::Tree>

See Bio::Root::IO, Bio::tree::tree, Bio::Seq, Bio::SimpleAlign

 Title   : extract_seqs
 Usage   : $nexmlIO->extract_seqs(-file => ">$outfile", -format => $format)
 Function: converts BioPerl seqs stored in the NexmlIO object into the provided 
                   format and writes it to the provided file. Uses L<Bio::SeqIO> to do 
                   the conversion and writing.
 Returns : none
 Args    : file to write to, format to be converted to

See Bio::Seq, Bio::SeqIO

 Title   : extract_alns
 Usage   : $nexmlIO->extract_alns(-file => ">$outfile", -format => $format)
 Function: converts BioPerl alns stored in the NexmlIO object into the provided 
                   format and writes it to the provided file. Uses L<Bio::AlignIO> to do 
                   the conversion and writing.
 Returns : none
 Args    : file to write to, format to be converted to

See Bio::SimpleAlign, Bio::AlignIO

 Title   : extract_trees
 Usage   : $nexmlIO->extract_trees(-file => ">$outfile", -format => $format)
 Function: converts BioPerl trees stored in the NexmlIO object into the provided 
                   format and writes it to the provided file. Uses L<Bio::TreeIO> to do 
                   the conversion and writing.
 Returns : none
 Args    : file to write to, format to be converted to

See Bio::Tree::Tree, Bio::TreeIO

2018-10-27 perl v5.26.2