Bio::Assembly::IO::phrap(3) driver to load phrap.out files.


# Building an input stream
use Bio::Assembly::IO;
# Assembly loading methods
my $io = Bio::Assembly::IO->new( -file => 'results.phrap',
-format => 'phrap');
# Read the entire scaffold
my $scaffold = $io->next_assembly;
# Or read one contig at a time to save resources
while ( my $contig = $io->next_contig ) {
# Do something ...


This package was developed to load the phrap.out files from the (phred/phrap/consed) package by Phill Green. This files contain just the messages printed to standard out by phrap when building an assembly. This output is redirected by phredPhrap perl-script to a file in the project's directory and hold some bit of information regarding assembly quality, connections between contigs and clone's position inside contigs. It should be noted that such files have no data about the sequence. neither for contig consensus nor for any aligned sequence. Anyway, such information may be loaded from Fasta files in the projects directory and added to the assembly object later.

Note that, because no sequence is loaded for the contig consensus and locations for aligned sequences are only given in ``ungapped consensus'' coordinates in a phrap.out file, you can't make coordinate changes in assemblies loaded by, unless you add an aligned coordinates for each sequence to each contig's features collection yourself. See Bio::Assembly::Contig::Coordinate_Systems and Bio::Assembly::Contig::Feature_collection..

This driver also loads singlets into the assembly contigs as Bio::Assembly::Singlet objects, although without their sequence strings. It also adds a feature for the entire sequence, thus storing the singlet length in its end position, and adds a tag '_nof_trimmed_nonX' to the feature, which stores the number of non-vector bases in the singlet.


Assemblies are loaded into Bio::Assembly::Scaffold objects composed by Bio::Assembly::Contig objects. No features are added to Bio::Assembly::Contig ``_aligned_coord:$seqID'' feature class, therefore you can't make coordinate changes in contigs loaded by this module. Contig objects created by this module will have the following special feature classes, identified by their primary tags, in their features collection:

``_main_contig_feature:$ID'' : main feature for contig $ID. This
                              feature is used to store information
                              about the entire consensus
                              sequence. This feature always start at
                              base 1 and its end position is the
                              consensus sequence length. A tag,
                              'trimmed_length' holds the length of the
                              trimmed good quality region inside the
                              consensus sequence.

``_covered_region:$index'' : coordinates for valid clones inside the
                              contig. $index is the covered region
                              number, starting at 1 for the covered
                              region closest to the consensus sequence
                              first base.

``_unalign_coord:$seqID'' : location of a sequence in ``ungapped
                              consensus'' coordinates (consensus
                              sequence without gaps).  Primary and
                              secondary scores, indel and
                              substitutions statistics are stored as
                              feature tags.

``_internal_clones:$cloneID'' : clones inside contigs $cloneID should be
                              used as the unique id for each
                              clone. These features have six tags:
                              '_1st_name', which is the id of the
                              upstream (5') aligned sequence
                              delimiting the clone; '_1st_strand', the
                              upstream sequence strand in the
                              alignment; '_2nd_name', downstream (3')
                              sequence id; '_2nd_strand', the
                              downstream sequence strand in the
                              alignment; '_length', unaligned clone
                              length; '_rejected', a boolean flag,
                              which is false if the clone is valid and
                              true if it was rejected.

All coordinates for the features above are expressed as ``ungapped consensus'' coordinates (See Bio::Assembly::Contig::Coordinate_Systems..

Feature collection



Mailing Lists

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

  [email protected]                  - General discussion  - About the mailing lists


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

[email protected]

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:

AUTHOR - Robson Francisco de Souza

Email [email protected]


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

Parser methods


 Title   : next_assembly
 Usage   : $scaffold = $stream->next_assembly()
 Function: returns the next assembly in the stream
 Returns : a Bio::Assembly::Scaffold object
 Args    : none


 Title   : next_contig
 Usage   : $scaffold = $stream->next_contig()
 Function: Returns the next contig or singlet in the PHRAP stream.
 Returns : a Bio::Assembly::Contig or Bio::Assembly::Single object
 Args    : none


 Title   : scaffold_annotations
 Usage   : $stream->scaffold_annotations($scaffold)
 Function: Adds ssembly and contig annotations to a scaffold. In the PHRAP
           format, this is the section starting with "INTERNAL"
 Returns : 1 for success
 Args    : a Bio::Assembly::Scaffold object to attach the annotations to

write_assembly (NOT IMPLEMENTED)

    Title   : write_assembly
    Usage   : $ass_io->write_assembly($assembly)
    Function: Write the assembly object in Phrap compatible ACE format
    Returns : 1 on success, 0 for error
    Args    : A Bio::Assembly::Scaffold object