---
name: "Bio::Assembly::IO::phrap"
section: "3pm"
platform: "linux"
package: "libbio-perl-perl"
version: "1.7.2-3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/Bio::Assembly::IO::phrap"
---

# Bio::Assembly::IO::phrap(3pm)

driver to load phrap.out files.

## NAME

Bio::Assembly::IO::phrap - driver to load phrap.out files.

## SYNOPSIS

```
    # 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 ...
    }
```

## DESCRIPTION

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 pharp.pm, 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.

### Implementation

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

\#

## FEEDBACK

### 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.

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

### 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
```

## AUTHOR - Robson Francisco de Souza

Email rfsouza@citri.iq.usp.br

head1 APPENDIX

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

## Parser methods

### next\_assembly

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

### next\_contig

```
 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
```

### scaffold\_annotations

```
 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
```
