from Bio.Sequencing import Ace

fn = '/home/sb/bt/biopython-1.50/Tests/Ace/contig1.ace'
acefilerecord = Ace.read(open(fn))

# For each contig:
for ctg in acefilerecord.contigs:
    print '=========================================='
    print 'Contig name: %s'%ctg.name
    print 'Bases: %s'%ctg.nbases
    print 'Reads: %s'%ctg.nreads
    print 'Segments: %s'%ctg.nsegments
    print 'Sequence: %s'%ctg.sequence
    print 'Quality: %s'%ctg.quality
    # For each read in contig:
    for read in ctg.reads:
        print 'Read name: %s'%read.rd.name
        print 'Align start: %s'%read.qa.align_clipping_start
        print 'Align end: %s'%read.qa.align_clipping_end
        print 'Qual start: %s'%read.qa.qual_clipping_start
        print 'Qual end: %s'%read.qa.qual_clipping_end
        print 'Read sequence: %s'%read.rd.sequence
        print '=========================================='

This code is part of the book "Python for Bioinformatics", by Sebastian Bassi (sbassi@genesdigitales.com). Return to home page.