The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::NEXUS::Import - Extends Bio::NEXUS with parsers for file formats of popular phylogeny programs

VERSION

This document describes Bio::NEXUS::Import version 0.1.0

SYNOPSIS

    use Bio::NEXUS::Import;

    # a PHYLIP-TO-NEXUS converter:
    #
    # load a PHYLIP file
    my $nexus = Bio::NEXUS::Import->new('example.phy');
    
    # and write it as NEXUS formatted file
    $nexus->write('example.nex');

DESCRIPTION

A module that extends Bio::NEXUS with parsers for file formats of popular phylogeny programs.

INTERFACE

new

 Title   : new
 Usage   : Bio::NEXUS::Import->new($filename, $fileformat, $verbose);
 Function: If $filename is defined, then this function calls import_file 
 Returns : an Bio::NEXUS object
 Args    : $filename, $fileformat, $verbose, or none
 See also: import_file for a list of supported fileformats, for examples see
           APPENDIX: SUPPORTED FILE FORMATS.

import_file

 Title   : import_file
 Usage   : Bio::NEXUS::Import->import_file($filename, $fileformat, $verbose);
 Function: Reads the contents of the specified file and populate the data 
           in the Bio::NEXUS object.
           Supported fileformats are NEXUS, PHYLIP_DIST_SQUARE, 
           PHYLIP_DIST_SQUARE_BLANK, PHYLIP_DIST_LOWER,
           PHYLIP_DIST_LOWER_BLANK, PHYLIP_SEQ_INTERLEAVED,
           PHYLIP_SEQ_INTERLEAVED_BLANK, PHYLIP_SEQ_SEQUENTIAL, 
           PHYLIP_SEQ_SEQUENTIAL_BLANK.
           If $fileformat is not defined, then this function tries to
           detect the correct format. NEXUS files are parsed with
           Bio::NEXUS->read_file();
 Returns : None
 Args    : $filename,  optional: $fileformat, $verbose. 

DIAGNOSTICS

ERROR: $filename is not a valid filename.

The file you have specified in "new" or "import_file" does not exist.

ERROR: $fileformat is not supported.

The fileformat you have specified in "new" or "import_file" is not supported. See "APPENDIX: SUPPORTED FILE FORMATS" for a list of supported formats.

ERROR: First line must contain number of taxa.

You tried to import a file with the PHYLIP parser but the file does not look like a PHYLIP file. See "APPENDIX: SUPPORTED FILE FORMATS" for valid PHYLIP files.

ERROR: First line must contain number of characters.

You tried to import a file with the PHYLIP parser for sequence data but the file does not look like a PHYLIP file. See "APPENDIX: SUPPORTED FILE FORMATS" for valid PHYLIP files.

ERROR: Could not parse $filename. Number taxa not correct.

There is a different number of taxa in the PHYLIP file than specified in the header. Check your input file.

ERROR: Could not detect file format.

You haven't specified a file format and Bio::NEXUS::Import could not detect the format of your file.

CONFIGURATION AND ENVIRONMENT

Bio::NEXUS::Import requires no configuration files or environment variables.

DEPENDENCIES

Bio::NEXUS

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-bio-nexus-import@rt.cpan.org, or through the web interface at http://rt.cpan.org.

SEE ALSO

Bio::NEXUS, Bio::Phylo.

The PHYLIP program seqboot can also convert a PHYLIP molecular sequences or discrete characters morphology data file into the NEXUS format.

APPENDIX: SUPPORTED FILE FORMATS

This appendix lists examples of all supported file formats. The PHYLIP_*_BLANK formats are modifications of the PHYLIP formats to support longer labels than the 10 characters. The end of a label is marked with a white space character such as a blank.

PHYLIP_DIST_SQUARE
        5
    Alpha      0.000 1.000 2.000 3.000 3.000
    Beta       1.000 0.000 2.000 3.000 3.000
    Gamma      2.000 2.000 0.000 3.000 3.000
    Delta      3.000 3.000 0.000 0.000 1.000
    Epsilon    3.000 3.000 3.000 1.000 0.000
PHYLIP_DIST_SQUARE_BLANK
        5
    Alpha_Long_Taxon 0.000 1.000 2.000 3.000 3.000
    Beta 1.000 0.000 2.000 3.000 3.000
    Gamma 2.000 2.000 0.000 3.000 3.000
    Delta 3.000 3.000 0.000 0.000 1.000
    Epsilon 3.000 3.000 3.000 1.000 0.000
PHYLIP_DIST_LOWER
        5
    Alpha      
    Beta       1.00
    Gamma      3.00 3.00
    Delta      3.00 3.00 2.00
    Epsilon    3.00 3.00 2.00 1.00
PHYLIP_DIST_LOWER_BLANK
        5
    Alpha_Long_Taxon      
    Beta       1.00
    Gamma      3.00 3.00
    Delta      3.00 3.00 2.00
    Epsilon    3.00 3.00 2.00 1.00
PHYLIP_SEQ_INTERLEAVED
        5    42
    Turkey    AAGCTNGGGC ATTTCAGGGT
    Salmo gairAAGCCTTGGC AGTGCAGGGT
    H. SapiensACCGGTTGGC CGTTCAGGGT
    Chimp     AAACCCTTGC CGTTACGCTT
    Gorilla   AAACCCTTGC CGGTACGCTT

    GAGCCCGGGC AATACAGGGT AT
    GAGCCGTGGC CGGGCACGGT AT
    ACAGGTTGGC CGTTCAGGGT AA
    AAACCGAGGC CGGGACACTC AT
    AAACCATTGC CGGTACGCTT AA
PHYLIP_SEQ_SEQUENTIAL
        5    42
    Turkey    AAGCTNGGGC ATTTCAGGGT
    GAGCCCGGGC AATACAGGGT AT
    Salmo gairAAGCCTTGGC AGTGCAGGGT
    GAGCCGTGGC CGGGCACGGT AT
    H. SapiensACCGGTTGGC CGTTCAGGGT
    ACAGGTTGGC CGTTCAGGGT AA
    Chimp     AAACCCTTGC CGTTACGCTT
    AAACCGAGGC CGGGACACTC AT
    Gorilla   AAACCCTTGC CGGTACGCTT
    AAACCATTGC CGGTACGCTT AA

LICENCE AND COPYRIGHT

Copyright (c) 2007-2011, <limaone@cpan.org>.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.