Package Bio :: Package Sequencing :: Module Ace
[hide private]
[frames] | no frames]

Module Ace

source code


Parser for (new) ACE files output by PHRAP.

version 1.3, 05/06/2004
Written by Frank Kauff (fkauff@duke.edu) and
Cymon J. Cox (cymon@duke.edu)

Uses the Biopython Parser interface: ParserSupport.py

Usage:

There are two ways of reading an ace file: The ACEParser() reads
the whole file at once and the RecordParser() reads contig after
contig.
    
1) Parse whole ace file at once:
        aceparser=Ace.ACEParser()
        acefilerecord=aceparser.parse(open('my_ace_file.ace','r'))

gives you 
        acefilerecord.ncontigs (the number of contigs in the ace file)
        acefilerecord.nreads (the number of reads in the ace file)
        acefilerecord.contigs[] (one instance of the Contig class for each contig)
        The Contig class holds the info of the CO tag, CT and WA tags, and all the reads used
        for this contig in a list of instances of the Read class, e.g.:
        contig3=acefilerecord.contigs[2]
        read4=contig3.reads[3]
        RD_of_read4=read4.rd
        DS_of_read4=read4.ds

        CT, WA, RT tags from the end of the file can appear anywhere are automatically
        sorted into the right place.

        see _RecordConsumer for details.

2) *** DEPRECATED: not entirely suitable for ACE files! 
        Or you can iterate over the contigs of an ace file one by one in the ususal way:        
        recordparser=Ace.RecordParser()
        iterator=Ace.Iterator(open('my_ace_file.ace','r'),recordparser)
        while 1:
            contig=iterator.next()
            if contig is None:
                break
            ...

        if WA, CT, RT, WR tags are at the end and the iterator is used, they will be returned
        with the last contig record. This is is necessarily the case when using an interator.
        Thus an ace file does not entirerly suit the concept of iterating. If WA, CT, RT, WR tags
        are needed, the ACEParser instead of the RecordParser might be appropriate.
        

Classes [hide private]
  rd
  qa
  ds
  af
  bs
  rt
  ct
  wa
  wr
  Reads
  Contig
Hold information from a ACE record
  Iterator
Iterates over a ACE-file with multiple contigs
  RecordParser
Parses ACE file data into a Record object
  ACEFileRecord
Holds data of ACE file.
  ACEParser
Parses full ACE file in list of contigs.
  _Scanner
Scans a ACE-formatted file
  _RecordConsumer
Reads the ace tags into data records.
Variables [hide private]
  xml_support = 1