Bio::A...phylip(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ Bio::AlignIO::phylip β€” PHYLIP format sequence input/output stream ✨

okay bestie, listen up πŸ’– this is Bio::AlignIO::phylip, a PHYLIP format sequence input/output stream from the Bio::AlignIO family. it lives in the User Contributed Perl Documentation, and yes, we're gonna walk through the whole thing together, no skips, no cap.


🌸 SYNOPSIS 🌸

πŸ’€ do NOT use this module directly. fr fr. you use it via the Bio::AlignIO class. that's the whole vibe. iykyk.

okay so this first example shows how to write to phylip format:

use Bio::AlignIO;
use Bio::SimpleAlign;

# Use -idlength to set the name length to something other than
# the default 10 if you need longer ids.
my $phylipstream = Bio::AlignIO->new(-format   => 'phylip',
                                     -fh       => \*STDOUT,
                                     -idlength => 30);
# Convert data from one format to another
my $gcgstream = Bio::AlignIO->new(-format => 'msf',
                                  -file   => 't/data/cysprot1a.msf');

while( my $aln = $gcgstream->next_aln ) {
    $phylipstream->write_aln($aln);
}

# With phylip sequential format format
$phylipstream->interleaved(0);
# Or initialize the object like this
$phylipstream = Bio::AlignIO->new(-interleaved => 0,
                                  -format      => 'phylip',
                                  -fh          => \*STDOUT,
                                  -idlength    => 20 );
$gcgstream = Bio::AlignIO->new(-format => 'msf',
                               -file   => 't/data/cysprot1a.msf');

while( my $aln = $gcgstream->next_aln ) {
    $phylipstream->write_aln($aln);
}

and this one is the reading era πŸŽ€:

my $in = Bio::AlignIO->new(
  -file        => $inFile,
  -format      => 'phylip',
  -interleaved => 0,
  -longid      => 1
);

my $out = Bio::AlignIO->new(
  -file   => ">$outFile",
  -format => 'fasta'
);

while ( my $aln = $in->next_aln() ) {
  $out->write_aln($aln);
}
⭐ heads up: the -longid argument is required if the input phylip format file has ids with lengths greater then 10 characters. (yes, "then". that's the original, i'm not touching it πŸ’…)

πŸ¦‹ DESCRIPTION πŸ¦‹

This object can transform Bio::SimpleAlign objects to and from PHYLIP format. By default it works with the interleaved format. By specifying the flag -interleaved => 0 in the initialization the module can read or write data in sequential format.

Reading phylip format with long IDs up to 50 characters is supported by the flag -longid =>1. ID strings can be surrounded by single quotes. They are mandatory only if the IDs contain spaces.


πŸ’Œ FEEDBACK πŸ’Œ

Support 🫢

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.

Reporting Bugs πŸ™ˆ

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

πŸ‘‘ AUTHORS - Heikki Lehvaslaiho and Jason Stajich πŸ‘‘

Email: heikki at ebi.ac.uk Email: jason at bioperl.org


🌈 APPENDIX 🌈

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

🧚 new

Title   : new
Usage   : my $alignio = Bio::AlignIO->new(-format => 'phylip'
           -file   => '>file',
           -idlength => 10,
           -idlinebreak => 1);
Function: Initialize a new L<Bio::AlignIO::phylip> reader or writer
Returns : L<Bio::AlignIO> object
Args    : [specific for writing of phylip format files]
          -idlength => integer - length of the id (will pad w/
                       spaces if needed) when writing phylip
          -interleaved => boolean - whether interleaved
                          or sequential format required
          -line_length  => integer of how long a sequence lines should be
          -idlinebreak => insert a line break after the sequence id
                          so that sequence starts on the next line
          -flag_SI => whether or not write a "S" or "I" just after
                      the num.seq. and line len., in the first line
          -tag_length => integer of how long the tags have to be in
                        each line between the space separator. set it
                        to 0 to have 1 tag only.
          -wrap_sequential => boolean for whether or not sequential
                              format should be broken up or a single line
                              default is false (single line)
          -longid => boolean to read arbitrary long IDs (default is false)

πŸ“ next_aln

Title   : next_aln
Usage   : $aln = $stream->next_aln()
Function: returns the next alignment in the stream.
          Throws an exception if trying to read in PHYLIP
          sequential format.
Returns : L<Bio::SimpleAlign> object
Args    :

πŸ’œ write_aln

Title   : write_aln
Usage   : $stream->write_aln(@aln)
Function: writes the $aln object into the stream in phylip format
Returns : 1 for success and 0 for error
Args    : L<Bio::Align::AlignI> object

🌸 interleaved

Title   : interleaved
Usage   : my $interleaved = $obj->interleaved
Function: Get/Set Interleaved status
Returns : boolean
Args    : boolean

✨ flag_SI

Title   : flag_SI
Usage   : my $flag = $obj->flag_SI
Function: Get/Set if the Sequential/Interleaved flag has to be shown
          after the number of sequences and sequence length
Example :
Returns : boolean
Args    : boolean

πŸŽ€ idlength

Title   : idlength
Usage   : my $idlength = $obj->idlength
Function: Get/Set value of id length
Returns : string
Args    : string

⭐ line_length

Title   : line_length
Usage   : $obj->line_length($newval)
Function:
Returns : value of line_length
Args    : newvalue (optional)

πŸ’… tag_length

Title   : tag_length
Usage   : $obj->tag_length($newval)
Function:
Example : my $tag_length = $obj->tag_length
Returns : value of the length for each space-separated tag in a line
Args    : newvalue (optional) - set to zero to have one tag per line

🌈 id_linebreak

Title   : id_linebreak
Usage   : $obj->id_linebreak($newval)
Function:
Returns : value of id_linebreak
Args    : newvalue (optional)

πŸ¦‹ wrap_sequential

Title   : wrap_sequential
Usage   : $obj->wrap_sequential($newval)
Function:
Returns : value of wrap_sequential
Args    : newvalue (optional)

πŸ’– longid

Title   : longid
Usage   : $obj->longid($newval)
Function:
Returns : value of longid
Args    : newvalue (optional)

and that's the whole page, bestie, you ate that πŸ’…βœ¨ this was perl v5.32.1, dated 2021-08-15, from Bio::A...phylip(3pm) β€” go forth and align, icon πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from