Back to index

python-biopython  1.60
test_Ace.py
Go to the documentation of this file.
00001 import os
00002 import sys
00003 import unittest
00004 
00005 from Bio.Sequencing import Ace
00006 
00007 
00008 class AceTestOne(unittest.TestCase):
00009     def setUp(self):
00010         self.handle = open("Ace/contig1.ace")
00011 
00012     def tearDown(self):
00013         self.handle.close()
00014 
00015     def test_check_ACEParser(self):
00016         """Test to check that ACEParser can parse the whole file into one record."""
00017         record = Ace.read(self.handle)
00018         self.assertEqual(record.ncontigs, 2)
00019         self.assertEqual(record.nreads, 16)
00020         self.assertEqual(len(record.wa), 1)
00021         self.assertEqual(record.wa[0].tag_type, "phrap_params")
00022         self.assertEqual(record.wa[0].program, "phrap")
00023         self.assertEqual(record.wa[0].date, "040203:114710")
00024         self.assertEqual(record.wa[0].info, ['phrap 304_nuclsu.fasta.screen -new_ace -retain_duplicates', 'phrap version 0.990329'])
00025         self.assertEqual(len(record.contigs), 2)
00026         self.assertEqual(len(record.contigs[0].reads), 2)
00027         self.assertEqual(record.contigs[0].name, "Contig1")
00028         self.assertEqual(record.contigs[0].nbases, 856)
00029         self.assertEqual(record.contigs[0].nreads, 2)
00030         self.assertEqual(record.contigs[0].nsegments, 31)
00031         self.assertEqual(record.contigs[0].uorc, 'U')
00032         center = len(record.contigs[0].sequence)//2
00033         self.assertEqual(record.contigs[0].sequence[:10], "aatacgGGAT")
00034         self.assertEqual(record.contigs[0].sequence[center-5:center+5], "ACATCATCTG")
00035         self.assertEqual(record.contigs[0].sequence[-10:], "cATCTAGtac")
00036         center = len(record.contigs[0].quality)//2
00037         self.assertEqual(record.contigs[0].quality[:10], [0, 0, 0, 0, 0, 0, 22, 23, 25, 28])
00038         self.assertEqual(record.contigs[0].quality[center-5:center+5], [90, 90, 90, 90, 90, 90, 90, 90, 90, 90])
00039         self.assertEqual(record.contigs[0].quality[-10:], [15, 22, 30, 24, 28, 22, 21, 15, 19, 0])
00040         self.assertEqual(len(record.contigs[0].af), 2)
00041         self.assertEqual(record.contigs[0].af[1].name, "BL060c3-LR0R.b.ab1")
00042         self.assertEqual(record.contigs[0].af[1].coru, "U")
00043         self.assertEqual(record.contigs[0].af[1].padded_start, 1)
00044         self.assertEqual(len(record.contigs[0].bs), 31)
00045         self.assertEqual(record.contigs[0].bs[15].name, "BL060c3-LR5.g.ab1")
00046         self.assertEqual(record.contigs[0].bs[15].padded_start, 434)
00047         self.assertEqual(record.contigs[0].bs[15].padded_end, 438)
00048         self.assertEqual(record.contigs[0].bs[30].name, "BL060c3-LR0R.b.ab1")
00049         self.assertEqual(record.contigs[0].bs[30].padded_start, 823)
00050         self.assertEqual(record.contigs[0].bs[30].padded_end, 856)
00051         self.assertEqual(len(record.contigs[0].ct), 1)
00052         self.assertEqual(record.contigs[0].ct[0].name, "Contig1")
00053         self.assertEqual(record.contigs[0].ct[0].tag_type, "repeat")
00054         self.assertEqual(record.contigs[0].ct[0].program, "phrap")
00055         self.assertEqual(record.contigs[0].ct[0].padded_start, 52)
00056         self.assertEqual(record.contigs[0].ct[0].padded_end, 53)
00057         self.assertEqual(record.contigs[0].ct[0].date, "555456:555432")
00058         self.assertEqual(record.contigs[0].ct[0].info, ['This is the forst line of comment for c1', 'and this the second for c1'])
00059         self.assertEqual(record.contigs[0].wa, None)
00060         self.assertEqual(len(record.contigs[0].reads), 2)
00061         self.assertEqual(record.contigs[0].reads[0].rd.name, "BL060c3-LR5.g.ab1")
00062         self.assertEqual(record.contigs[0].reads[0].rd.padded_bases, 868)
00063         self.assertEqual(record.contigs[0].reads[0].rd.info_items, 0)
00064         self.assertEqual(record.contigs[0].reads[0].rd.read_tags, 0)
00065         center = len(record.contigs[0].reads[0].rd.sequence)//2
00066         self.assertEqual(record.contigs[0].reads[0].rd.sequence[:10], "tagcgaggaa")
00067         self.assertEqual(record.contigs[0].reads[0].rd.sequence[center-5:center+5], "CCGAGGCCAA")
00068         self.assertEqual(record.contigs[0].reads[0].rd.sequence[-10:], "gaaccatcag")
00069         self.assertEqual(record.contigs[0].reads[0].qa.qual_clipping_start, 80)
00070         self.assertEqual(record.contigs[0].reads[0].qa.qual_clipping_end, 853)
00071         self.assertEqual(record.contigs[0].reads[0].qa.align_clipping_start, 22)
00072         self.assertEqual(record.contigs[0].reads[0].qa.align_clipping_end, 856)
00073         self.assertEqual(record.contigs[0].reads[0].ds, None)
00074         self.assertEqual(len(record.contigs[0].reads[0].rt), 4)
00075         self.assertEqual(record.contigs[0].reads[0].rt[0].name, "BL060c3-LR5.g.ab1")
00076         self.assertEqual(record.contigs[0].reads[0].rt[0].tag_type, "matchElsewhereHighQual")
00077         self.assertEqual(record.contigs[0].reads[0].rt[0].program, "phrap")
00078         self.assertEqual(record.contigs[0].reads[0].rt[0].padded_start, 590)
00079         self.assertEqual(record.contigs[0].reads[0].rt[0].padded_end, 607)
00080         self.assertEqual(record.contigs[0].reads[0].rt[0].date, "040217:110357")
00081         self.assertEqual(record.contigs[0].reads[0].rt[1].name, "BL060c3-LR5.g.ab1")
00082         self.assertEqual(record.contigs[0].reads[0].rt[1].tag_type, "matchElsewhereHighQual")
00083         self.assertEqual(record.contigs[0].reads[0].rt[1].program, "phrap")
00084         self.assertEqual(record.contigs[0].reads[0].rt[1].padded_start, 617)
00085         self.assertEqual(record.contigs[0].reads[0].rt[1].padded_end, 631)
00086         self.assertEqual(record.contigs[0].reads[0].rt[1].date, "040217:110357")
00087         self.assertEqual(record.contigs[0].reads[0].rt[2].name, "BL060c3-LR5.g.ab1")
00088         self.assertEqual(record.contigs[0].reads[0].rt[2].tag_type, "matchElsewhereHighQual")
00089         self.assertEqual(record.contigs[0].reads[0].rt[2].program, "phrap")
00090         self.assertEqual(record.contigs[0].reads[0].rt[2].padded_start, 617)
00091         self.assertEqual(record.contigs[0].reads[0].rt[2].padded_end, 631)
00092         self.assertEqual(record.contigs[0].reads[0].rt[2].date, "040217:110357")
00093         self.assertEqual(record.contigs[0].reads[0].rt[3].name, "BL060c3-LR5.g.ab1")
00094         self.assertEqual(record.contigs[0].reads[0].rt[3].tag_type, "matchElsewhereHighQual")
00095         self.assertEqual(record.contigs[0].reads[0].rt[3].program, "phrap")
00096         self.assertEqual(record.contigs[0].reads[0].rt[3].padded_start, 617)
00097         self.assertEqual(record.contigs[0].reads[0].rt[3].padded_end, 631)
00098         self.assertEqual(record.contigs[0].reads[0].rt[3].date, "040217:110357")
00099 
00100         self.assertEqual(len(record.contigs[0].reads[0].wr), 1)
00101         self.assertEqual(record.contigs[0].reads[0].wr[0].name, "BL060c3-LR5.g.ab1")
00102         self.assertEqual(record.contigs[0].reads[0].wr[0].aligned, "unaligned")
00103         self.assertEqual(record.contigs[0].reads[0].wr[0].program, "phrap")
00104         self.assertEqual(record.contigs[0].reads[0].wr[0].date, "040217:110357")
00105         self.assertEqual(record.contigs[0].reads[1].rd.name, "BL060c3-LR0R.b.ab1")
00106         self.assertEqual(record.contigs[0].reads[1].rd.padded_bases, 856)
00107         self.assertEqual(record.contigs[0].reads[1].rd.info_items, 0)
00108         self.assertEqual(record.contigs[0].reads[1].rd.read_tags, 0)
00109         center = len(record.contigs[0].reads[1].rd.sequence)//2
00110         self.assertEqual(record.contigs[0].reads[1].rd.sequence[:10], "aatacgGGAT")
00111         self.assertEqual(record.contigs[0].reads[1].rd.sequence[center-5:center+5], "ACATCATCTG")
00112         self.assertEqual(record.contigs[0].reads[1].rd.sequence[-10:], "cATCTAGtac")
00113         self.assertEqual(record.contigs[0].reads[1].qa.qual_clipping_start, 7)
00114         self.assertEqual(record.contigs[0].reads[1].qa.qual_clipping_end, 778)
00115         self.assertEqual(record.contigs[0].reads[1].qa.align_clipping_start, 1)
00116         self.assertEqual(record.contigs[0].reads[1].qa.align_clipping_end, 856)
00117         self.assertEqual(record.contigs[0].reads[1].ds, None)
00118         self.assertEqual(record.contigs[0].reads[1].rt, None)
00119         self.assertEqual(record.contigs[0].reads[1].wr, None)
00120 
00121         self.assertEqual(len(record.contigs[1].reads), 14)
00122         self.assertEqual(record.contigs[1].name, "Contig2")
00123         self.assertEqual(record.contigs[1].nbases, 3296)
00124         self.assertEqual(record.contigs[1].nreads, 14)
00125         self.assertEqual(record.contigs[1].nsegments, 214)
00126         self.assertEqual(record.contigs[1].uorc, 'U')
00127         center = len(record.contigs[1].sequence) // 2
00128         self.assertEqual(record.contigs[1].sequence[:10], "cacggatgat")
00129         self.assertEqual(record.contigs[1].sequence[center-5:center+5], "TTTGAATATT")
00130         self.assertEqual(record.contigs[1].sequence[-10:], "Atccttgtag")
00131         center = len(record.contigs[1].quality) // 2
00132         self.assertEqual(record.contigs[1].quality[:10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
00133         self.assertEqual(record.contigs[1].quality[center-5:center+5], [90, 90, 90, 90, 90, 90, 90, 90, 90, 90])
00134         self.assertEqual(record.contigs[1].quality[-10:], [24, 0, 0, 0, 0, 0, 0, 0, 0, 0])
00135         self.assertEqual(len(record.contigs[1].af), 14)
00136         self.assertEqual(record.contigs[1].af[7].name, "BL060-LR3R.b.ab1")
00137         self.assertEqual(record.contigs[1].af[7].coru, "C")
00138         self.assertEqual(record.contigs[1].af[7].padded_start, 1601)
00139         self.assertEqual(record.contigs[1].af[13].name, "BL060c2-LR0R.b.ab1")
00140         self.assertEqual(record.contigs[1].af[13].coru, "C")
00141         self.assertEqual(record.contigs[1].af[13].padded_start, 2445)
00142         self.assertEqual(len(record.contigs[1].bs), 214)
00143         self.assertEqual(record.contigs[1].bs[107].name, "BL060-c1-LR3R.b.ab1")
00144         self.assertEqual(record.contigs[1].bs[107].padded_start, 2286)
00145         self.assertEqual(record.contigs[1].bs[107].padded_end, 2292)
00146         self.assertEqual(record.contigs[1].bs[213].name, "BL060c2-LR0R.b.ab1")
00147         self.assertEqual(record.contigs[1].bs[213].padded_start, 3236)
00148         self.assertEqual(record.contigs[1].bs[213].padded_end, 3296)
00149         self.assertEqual(len(record.contigs[1].ct), 1)
00150         self.assertEqual(record.contigs[1].ct[0].name, "Contig2")
00151         self.assertEqual(record.contigs[1].ct[0].tag_type, "repeat")
00152         self.assertEqual(record.contigs[1].ct[0].program, "phrap")
00153         self.assertEqual(record.contigs[1].ct[0].padded_start, 42)
00154         self.assertEqual(record.contigs[1].ct[0].padded_end, 43)
00155         self.assertEqual(record.contigs[1].ct[0].date, "123456:765432")
00156         self.assertEqual(record.contigs[1].ct[0].info, ['This is the forst line of comment for c2', 'and this the second for c2'])
00157         self.assertEqual(len(record.contigs[1].wa), 1)
00158         self.assertEqual(record.contigs[1].wa[0].tag_type, "phrap_params")
00159         self.assertEqual(record.contigs[1].wa[0].program, "phrap")
00160         self.assertEqual(record.contigs[1].wa[0].date, "040203:114710")
00161         self.assertEqual(record.contigs[1].wa[0].info, ['phrap 304_nuclsu.fasta.screen -new_ace -retain_duplicates', 'phrap version 0.990329'])
00162 
00163         self.assertEqual(len(record.contigs[1].reads), 14)
00164 
00165         # Read 0
00166         self.assertEqual(record.contigs[1].reads[0].rd.name, "BL060-c1-LR12.g.ab1")
00167         self.assertEqual(record.contigs[1].reads[0].rd.padded_bases, 862)
00168         self.assertEqual(record.contigs[1].reads[0].rd.info_items, 0)
00169         self.assertEqual(record.contigs[1].reads[0].rd.read_tags, 0)
00170         center = len(record.contigs[1].reads[0].rd.sequence)//2
00171         self.assertEqual(record.contigs[1].reads[0].rd.sequence[:10], "cacggatgat")
00172         self.assertEqual(record.contigs[1].reads[0].rd.sequence[center-5:center+5], "GTTCTCGTTG")
00173         self.assertEqual(record.contigs[1].reads[0].rd.sequence[-10:], "CGTTTACCcg")
00174         self.assertEqual(record.contigs[1].reads[0].qa.qual_clipping_start, 81)
00175         self.assertEqual(record.contigs[1].reads[0].qa.qual_clipping_end, 842)
00176         self.assertEqual(record.contigs[1].reads[0].qa.align_clipping_start, 1)
00177         self.assertEqual(record.contigs[1].reads[0].qa.align_clipping_end, 862)
00178         self.assertEqual(record.contigs[1].reads[0].ds.chromat_file, "BL060-c1-LR12.g.ab1")
00179         self.assertEqual(record.contigs[1].reads[0].ds.phd_file, "BL060-c1-LR12.g.ab1.phd.1")
00180         self.assertEqual(record.contigs[1].reads[0].ds.time, "Tue Feb  3 11:01:16 2004")
00181         self.assertEqual(record.contigs[1].reads[0].ds.chem, "term")
00182         self.assertEqual(record.contigs[1].reads[0].ds.dye, "big")
00183         self.assertEqual(record.contigs[1].reads[0].ds.template, "")
00184         self.assertEqual(record.contigs[1].reads[0].ds.direction, "")
00185         self.assertEqual(record.contigs[1].reads[0].rt, None)
00186         self.assertEqual(record.contigs[1].reads[0].wr, None)
00187 
00188         # Read 1
00189         self.assertEqual(record.contigs[1].reads[1].rd.name, "BL060-c1-LR11.g.ab1")
00190         self.assertEqual(record.contigs[1].reads[1].rd.padded_bases, 880)
00191         self.assertEqual(record.contigs[1].reads[1].rd.info_items, 0)
00192         self.assertEqual(record.contigs[1].reads[1].rd.read_tags, 0)
00193         center = len(record.contigs[1].reads[1].rd.sequence)//2
00194         self.assertEqual(record.contigs[1].reads[1].rd.sequence[:10], "ctttctgacC")
00195         self.assertEqual(record.contigs[1].reads[1].rd.sequence[center-5:center+5], "CTGTGGTTTC")
00196         self.assertEqual(record.contigs[1].reads[1].rd.sequence[-10:], "cggagttacg")
00197         self.assertEqual(record.contigs[1].reads[1].qa.qual_clipping_start, 11)
00198         self.assertEqual(record.contigs[1].reads[1].qa.qual_clipping_end, 807)
00199         self.assertEqual(record.contigs[1].reads[1].qa.align_clipping_start, 8)
00200         self.assertEqual(record.contigs[1].reads[1].qa.align_clipping_end, 880)
00201         self.assertEqual(record.contigs[1].reads[1].ds.chromat_file, "BL060-c1-LR11.g.ab1")
00202         self.assertEqual(record.contigs[1].reads[1].ds.phd_file, "BL060-c1-LR11.g.ab1.phd.1")
00203         self.assertEqual(record.contigs[1].reads[1].ds.time, "Tue Feb  3 11:01:16 2004")
00204         self.assertEqual(record.contigs[1].reads[1].ds.chem, "term")
00205         self.assertEqual(record.contigs[1].reads[1].ds.dye, "big")
00206         self.assertEqual(record.contigs[1].reads[1].ds.template, "")
00207         self.assertEqual(record.contigs[1].reads[1].ds.direction, "")
00208         self.assertEqual(len(record.contigs[1].reads[1].rt), 0)
00209         self.assertEqual(record.contigs[1].reads[1].wr, None)
00210 
00211         # Read 2
00212         self.assertEqual(record.contigs[1].reads[2].rd.name, "BL060-c1-LR9.g.ab1")
00213         self.assertEqual(record.contigs[1].reads[2].rd.padded_bases, 864)
00214         self.assertEqual(record.contigs[1].reads[2].rd.info_items, 0)
00215         self.assertEqual(record.contigs[1].reads[2].rd.read_tags, 0)
00216         center = len(record.contigs[1].reads[2].rd.sequence)//2
00217         self.assertEqual(record.contigs[1].reads[2].rd.sequence[:10], "cacccaCTTT")
00218         self.assertEqual(record.contigs[1].reads[2].rd.sequence[center-5:center+5], "ACCAAACATT")
00219         self.assertEqual(record.contigs[1].reads[2].rd.sequence[-10:], "GGTAGCACgc")
00220         self.assertEqual(record.contigs[1].reads[2].qa.qual_clipping_start, 7)
00221         self.assertEqual(record.contigs[1].reads[2].qa.qual_clipping_end, 840)
00222         self.assertEqual(record.contigs[1].reads[2].qa.align_clipping_start, 4)
00223         self.assertEqual(record.contigs[1].reads[2].qa.align_clipping_end, 864)
00224         self.assertEqual(record.contigs[1].reads[2].ds.chromat_file, "BL060-c1-LR9.g.ab1")
00225         self.assertEqual(record.contigs[1].reads[2].ds.phd_file, "BL060-c1-LR9.g.ab1.phd.1")
00226         self.assertEqual(record.contigs[1].reads[2].ds.time, "Tue Feb  3 11:01:16 2004")
00227         self.assertEqual(record.contigs[1].reads[2].ds.chem, "term")
00228         self.assertEqual(record.contigs[1].reads[2].ds.dye, "big")
00229         self.assertEqual(record.contigs[1].reads[2].ds.template, "")
00230         self.assertEqual(record.contigs[1].reads[2].ds.direction, "")
00231         self.assertEqual(record.contigs[1].reads[2].rt, None)
00232         self.assertEqual(record.contigs[1].reads[2].wr, None)
00233 
00234         # Read 3
00235         self.assertEqual(record.contigs[1].reads[3].rd.name, "BL060-c1-LR17R.b.ab1")
00236         self.assertEqual(record.contigs[1].reads[3].rd.padded_bases, 863)
00237         self.assertEqual(record.contigs[1].reads[3].rd.info_items, 0)
00238         self.assertEqual(record.contigs[1].reads[3].rd.read_tags, 0)
00239         center = len(record.contigs[1].reads[3].rd.sequence)//2
00240         self.assertEqual(record.contigs[1].reads[3].rd.sequence[:10], "ctaattggcc")
00241         self.assertEqual(record.contigs[1].reads[3].rd.sequence[center-5:center+5], "GGAACCTTTC")
00242         self.assertEqual(record.contigs[1].reads[3].rd.sequence[-10:], "CAACCTgact")
00243         self.assertEqual(record.contigs[1].reads[3].qa.qual_clipping_start, 63)
00244         self.assertEqual(record.contigs[1].reads[3].qa.qual_clipping_end, 857)
00245         self.assertEqual(record.contigs[1].reads[3].qa.align_clipping_start, 1)
00246         self.assertEqual(record.contigs[1].reads[3].qa.align_clipping_end, 861)
00247         self.assertEqual(record.contigs[1].reads[3].ds.chromat_file, "BL060-c1-LR17R.b.ab1")
00248         self.assertEqual(record.contigs[1].reads[3].ds.phd_file, "BL060-c1-LR17R.b.ab1.phd.1")
00249         self.assertEqual(record.contigs[1].reads[3].ds.time, "Tue Feb  3 11:01:16 2004")
00250         self.assertEqual(record.contigs[1].reads[3].ds.chem, "term")
00251         self.assertEqual(record.contigs[1].reads[3].ds.dye, "big")
00252         self.assertEqual(record.contigs[1].reads[3].ds.template, "")
00253         self.assertEqual(record.contigs[1].reads[3].ds.direction, "")
00254         self.assertEqual(record.contigs[1].reads[3].rt, [])
00255         self.assertEqual(record.contigs[1].reads[3].wr, None)
00256 
00257         # Read 4
00258         self.assertEqual(record.contigs[1].reads[4].rd.name, "BL060-LR8.5.g.ab1")
00259         self.assertEqual(record.contigs[1].reads[4].rd.padded_bases, 877)
00260         self.assertEqual(record.contigs[1].reads[4].rd.info_items, 0)
00261         self.assertEqual(record.contigs[1].reads[4].rd.read_tags, 0)
00262         center = len(record.contigs[1].reads[4].rd.sequence)//2
00263         self.assertEqual(record.contigs[1].reads[4].rd.sequence[:10], "tgCTGCGGTT")
00264         self.assertEqual(record.contigs[1].reads[4].rd.sequence[center-5:center+5], "GGCAGTTTCA")
00265         self.assertEqual(record.contigs[1].reads[4].rd.sequence[-10:], "tactcataaa")
00266         self.assertEqual(record.contigs[1].reads[4].qa.qual_clipping_start, 13)
00267         self.assertEqual(record.contigs[1].reads[4].qa.qual_clipping_end, 729)
00268         self.assertEqual(record.contigs[1].reads[4].qa.align_clipping_start, 1)
00269         self.assertEqual(record.contigs[1].reads[4].qa.align_clipping_end, 877)
00270         self.assertEqual(record.contigs[1].reads[4].ds.chromat_file, "BL060-LR8.5.g.ab1")
00271         self.assertEqual(record.contigs[1].reads[4].ds.phd_file, "BL060-LR8.5.g.ab1.phd.1")
00272         self.assertEqual(record.contigs[1].reads[4].ds.time, "Fri Nov 14 09:46:03 2003")
00273         self.assertEqual(record.contigs[1].reads[4].ds.chem, "term")
00274         self.assertEqual(record.contigs[1].reads[4].ds.dye, "big")
00275         self.assertEqual(record.contigs[1].reads[4].ds.template, "")
00276         self.assertEqual(record.contigs[1].reads[4].ds.direction, "")
00277         self.assertEqual(record.contigs[1].reads[4].rt, None)
00278         self.assertEqual(record.contigs[1].reads[4].wr, None)
00279 
00280         # Read 5
00281         self.assertEqual(record.contigs[1].reads[5].rd.name, "BL060-LR3R.b.ab1")
00282         self.assertEqual(record.contigs[1].reads[5].rd.padded_bases, 874)
00283         self.assertEqual(record.contigs[1].reads[5].rd.info_items, 0)
00284         self.assertEqual(record.contigs[1].reads[5].rd.read_tags, 0)
00285         center = len(record.contigs[1].reads[5].rd.sequence)//2
00286         self.assertEqual(record.contigs[1].reads[5].rd.sequence[:10], "ctCTTAGGAT")
00287         self.assertEqual(record.contigs[1].reads[5].rd.sequence[center-5:center+5], "AACTCACATT")
00288         self.assertEqual(record.contigs[1].reads[5].rd.sequence[-10:], "*CACCCAAac")
00289         self.assertEqual(record.contigs[1].reads[5].qa.qual_clipping_start, 65)
00290         self.assertEqual(record.contigs[1].reads[5].qa.qual_clipping_end, 874)
00291         self.assertEqual(record.contigs[1].reads[5].qa.align_clipping_start, 1)
00292         self.assertEqual(record.contigs[1].reads[5].qa.align_clipping_end, 874)
00293         self.assertEqual(record.contigs[1].reads[5].ds.chromat_file, "BL060-LR3R.b.ab1")
00294         self.assertEqual(record.contigs[1].reads[5].ds.phd_file, "BL060-LR3R.b.ab1.phd.1")
00295         self.assertEqual(record.contigs[1].reads[5].ds.time, "Fri Nov 14 09:46:03 2003")
00296         self.assertEqual(record.contigs[1].reads[5].ds.chem, "term")
00297         self.assertEqual(record.contigs[1].reads[5].ds.dye, "big")
00298         self.assertEqual(record.contigs[1].reads[5].ds.template, "")
00299         self.assertEqual(record.contigs[1].reads[5].ds.direction, "")
00300         self.assertEqual(record.contigs[1].reads[5].rt, None)
00301         self.assertEqual(record.contigs[1].reads[5].wr, None)
00302 
00303         # Read 6
00304         self.assertEqual(record.contigs[1].reads[6].rd.name, "BL060-c1-LR3R.b.ab1")
00305         self.assertEqual(record.contigs[1].reads[6].rd.padded_bases, 864)
00306         self.assertEqual(record.contigs[1].reads[6].rd.info_items, 0)
00307         self.assertEqual(record.contigs[1].reads[6].rd.read_tags, 0)
00308         center = len(record.contigs[1].reads[6].rd.sequence)//2
00309         self.assertEqual(record.contigs[1].reads[6].rd.sequence[:10], "CCaTGTCCAA")
00310         self.assertEqual(record.contigs[1].reads[6].rd.sequence[center-5:center+5], "AAGGGTT*CA")
00311         self.assertEqual(record.contigs[1].reads[6].rd.sequence[-10:], "ACACTCGCga")
00312         self.assertEqual(record.contigs[1].reads[6].qa.qual_clipping_start, 73)
00313         self.assertEqual(record.contigs[1].reads[6].qa.qual_clipping_end, 862)
00314         self.assertEqual(record.contigs[1].reads[6].qa.align_clipping_start, 1)
00315         self.assertEqual(record.contigs[1].reads[6].qa.align_clipping_end, 863)
00316         self.assertEqual(record.contigs[1].reads[6].ds.chromat_file, "BL060-c1-LR3R.b.ab1")
00317         self.assertEqual(record.contigs[1].reads[6].ds.phd_file, "BL060-c1-LR3R.b.ab1.phd.1")
00318         self.assertEqual(record.contigs[1].reads[6].ds.time, "Tue Feb  3 11:01:16 2004")
00319         self.assertEqual(record.contigs[1].reads[6].ds.chem, "term")
00320         self.assertEqual(record.contigs[1].reads[6].ds.dye, "big")
00321         self.assertEqual(record.contigs[1].reads[6].ds.template, "")
00322         self.assertEqual(record.contigs[1].reads[6].ds.direction, "")
00323         self.assertEqual(record.contigs[1].reads[6].rt, None)
00324         self.assertEqual(record.contigs[1].reads[6].wr, None)
00325 
00326         # Read 7
00327         self.assertEqual(record.contigs[1].reads[7].rd.name, "BL060-LR3R.b.ab1")
00328         self.assertEqual(record.contigs[1].reads[7].rd.padded_bases, 857)
00329         self.assertEqual(record.contigs[1].reads[7].rd.info_items, 0)
00330         self.assertEqual(record.contigs[1].reads[7].rd.read_tags, 0)
00331         center = len(record.contigs[1].reads[7].rd.sequence)//2
00332         self.assertEqual(record.contigs[1].reads[7].rd.sequence[:10], "agaaagagga")
00333         self.assertEqual(record.contigs[1].reads[7].rd.sequence[center-5:center+5], "nnnannnnnn")
00334         self.assertEqual(record.contigs[1].reads[7].rd.sequence[-10:], "gtctttgctc")
00335         self.assertEqual(record.contigs[1].reads[7].qa.qual_clipping_start, 548)
00336         self.assertEqual(record.contigs[1].reads[7].qa.qual_clipping_end, 847)
00337         self.assertEqual(record.contigs[1].reads[7].qa.align_clipping_start, 442)
00338         self.assertEqual(record.contigs[1].reads[7].qa.align_clipping_end, 854)
00339         self.assertEqual(record.contigs[1].reads[7].ds.chromat_file, "BL060-LR3R.b.ab1")
00340         self.assertEqual(record.contigs[1].reads[7].ds.phd_file, "BL060-LR3R.b.ab1.phd.1")
00341         self.assertEqual(record.contigs[1].reads[7].ds.time, "Fri Jan 16 09:01:10 2004")
00342         self.assertEqual(record.contigs[1].reads[7].ds.chem, "term")
00343         self.assertEqual(record.contigs[1].reads[7].ds.dye, "big")
00344         self.assertEqual(record.contigs[1].reads[7].ds.template, "")
00345         self.assertEqual(record.contigs[1].reads[7].ds.direction, "")
00346         self.assertEqual(record.contigs[1].reads[7].rt, None)
00347         self.assertEqual(record.contigs[1].reads[7].wr, None)
00348 
00349         # Read 8
00350         self.assertEqual(record.contigs[1].reads[8].rd.name, "BL060-c1-LR7.g.ab1")
00351         self.assertEqual(record.contigs[1].reads[8].rd.padded_bases, 878)
00352         self.assertEqual(record.contigs[1].reads[8].rd.info_items, 0)
00353         self.assertEqual(record.contigs[1].reads[8].rd.read_tags, 0)
00354         center = len(record.contigs[1].reads[8].rd.sequence)//2
00355         self.assertEqual(record.contigs[1].reads[8].rd.sequence[:10], "agTttc*ctc")
00356         self.assertEqual(record.contigs[1].reads[8].rd.sequence[center-5:center+5], "TCATAAAACT")
00357         self.assertEqual(record.contigs[1].reads[8].rd.sequence[-10:], "xxxxxxxxxx")
00358         self.assertEqual(record.contigs[1].reads[8].qa.qual_clipping_start, 20)
00359         self.assertEqual(record.contigs[1].reads[8].qa.qual_clipping_end, 798)
00360         self.assertEqual(record.contigs[1].reads[8].qa.align_clipping_start, 1)
00361         self.assertEqual(record.contigs[1].reads[8].qa.align_clipping_end, 798)
00362         self.assertEqual(record.contigs[1].reads[8].ds.chromat_file, "BL060-c1-LR7.g.ab1")
00363         self.assertEqual(record.contigs[1].reads[8].ds.phd_file, "BL060-c1-LR7.g.ab1.phd.1")
00364         self.assertEqual(record.contigs[1].reads[8].ds.time, "Tue Feb  3 11:01:16 2004")
00365         self.assertEqual(record.contigs[1].reads[8].ds.chem, "term")
00366         self.assertEqual(record.contigs[1].reads[8].ds.dye, "big")
00367         self.assertEqual(record.contigs[1].reads[8].ds.template, "")
00368         self.assertEqual(record.contigs[1].reads[8].ds.direction, "")
00369         self.assertEqual(record.contigs[1].reads[8].rt, None)
00370         self.assertEqual(record.contigs[1].reads[8].wr, None)
00371 
00372         # Read 9
00373         self.assertEqual(record.contigs[1].reads[9].rd.name, "BL060-LR7.g.ab1")
00374         self.assertEqual(record.contigs[1].reads[9].rd.padded_bases, 880)
00375         self.assertEqual(record.contigs[1].reads[9].rd.info_items, 0)
00376         self.assertEqual(record.contigs[1].reads[9].rd.read_tags, 0)
00377         center = len(record.contigs[1].reads[9].rd.sequence)//2
00378         self.assertEqual(record.contigs[1].reads[9].rd.sequence[:10], "ggctaCGCCc")
00379         self.assertEqual(record.contigs[1].reads[9].rd.sequence[center-5:center+5], "ATTGAGTTTC")
00380         self.assertEqual(record.contigs[1].reads[9].rd.sequence[-10:], "tggcgttgcg")
00381         self.assertEqual(record.contigs[1].reads[9].qa.qual_clipping_start, 14)
00382         self.assertEqual(record.contigs[1].reads[9].qa.qual_clipping_end, 765)
00383         self.assertEqual(record.contigs[1].reads[9].qa.align_clipping_start, 4)
00384         self.assertEqual(record.contigs[1].reads[9].qa.align_clipping_end, 765)
00385         self.assertEqual(record.contigs[1].reads[9].ds.chromat_file, "BL060-LR7.g.ab1")
00386         self.assertEqual(record.contigs[1].reads[9].ds.phd_file, "BL060-LR7.g.ab1.phd.1")
00387         self.assertEqual(record.contigs[1].reads[9].ds.time, "Fri Nov 14 09:46:03 2003")
00388         self.assertEqual(record.contigs[1].reads[9].ds.chem, "term")
00389         self.assertEqual(record.contigs[1].reads[9].ds.dye, "big")
00390         self.assertEqual(record.contigs[1].reads[9].ds.template, "")
00391         self.assertEqual(record.contigs[1].reads[9].ds.direction, "")
00392         self.assertEqual(record.contigs[1].reads[9].rt, None)
00393         self.assertEqual(record.contigs[1].reads[9].wr, None)
00394 
00395         # Read 10
00396         self.assertEqual(record.contigs[1].reads[10].rd.name, "BL060c5-LR5.g.ab1")
00397         self.assertEqual(record.contigs[1].reads[10].rd.padded_bases, 871)
00398         self.assertEqual(record.contigs[1].reads[10].rd.info_items, 0)
00399         self.assertEqual(record.contigs[1].reads[10].rd.read_tags, 0)
00400         center = len(record.contigs[1].reads[10].rd.sequence)//2
00401         self.assertEqual(record.contigs[1].reads[10].rd.sequence[:10], "ggtTCGATTA")
00402         self.assertEqual(record.contigs[1].reads[10].rd.sequence[center-5:center+5], "ACCAATTGAC")
00403         self.assertEqual(record.contigs[1].reads[10].rd.sequence[-10:], "ACCACCCatt")
00404         self.assertEqual(record.contigs[1].reads[10].qa.qual_clipping_start, 12)
00405         self.assertEqual(record.contigs[1].reads[10].qa.qual_clipping_end, 767)
00406         self.assertEqual(record.contigs[1].reads[10].qa.align_clipping_start, 1)
00407         self.assertEqual(record.contigs[1].reads[10].qa.align_clipping_end, 871)
00408         self.assertEqual(record.contigs[1].reads[10].ds.chromat_file, "BL060c5-LR5.g.ab1")
00409         self.assertEqual(record.contigs[1].reads[10].ds.phd_file, "BL060c5-LR5.g.ab1.phd.1")
00410         self.assertEqual(record.contigs[1].reads[10].ds.time, "Fri Nov 14 09:46:03 2003")
00411         self.assertEqual(record.contigs[1].reads[10].ds.chem, "term")
00412         self.assertEqual(record.contigs[1].reads[10].ds.dye, "big")
00413         self.assertEqual(record.contigs[1].reads[10].ds.template, "")
00414         self.assertEqual(record.contigs[1].reads[10].ds.direction, "")
00415         self.assertEqual(record.contigs[1].reads[10].rt, None)
00416         self.assertEqual(record.contigs[1].reads[10].wr, None)
00417 
00418         # Read 11
00419         self.assertEqual(record.contigs[1].reads[11].rd.name, "BL060c2-LR5.g.ab1")
00420         self.assertEqual(record.contigs[1].reads[11].rd.padded_bases, 839)
00421         self.assertEqual(record.contigs[1].reads[11].rd.info_items, 0)
00422         self.assertEqual(record.contigs[1].reads[11].rd.read_tags, 0)
00423         center = len(record.contigs[1].reads[11].rd.sequence)//2
00424         self.assertEqual(record.contigs[1].reads[11].rd.sequence[:10], "ggttcatatg")
00425         self.assertEqual(record.contigs[1].reads[11].rd.sequence[center-5:center+5], "TAAAATCAGT")
00426         self.assertEqual(record.contigs[1].reads[11].rd.sequence[-10:], "TCTTGCaata")
00427         self.assertEqual(record.contigs[1].reads[11].qa.qual_clipping_start, 11)
00428         self.assertEqual(record.contigs[1].reads[11].qa.qual_clipping_end, 757)
00429         self.assertEqual(record.contigs[1].reads[11].qa.align_clipping_start, 10)
00430         self.assertEqual(record.contigs[1].reads[11].qa.align_clipping_end, 835)
00431         self.assertEqual(record.contigs[1].reads[11].ds, None)
00432         self.assertEqual(len(record.contigs[1].reads[11].rt), 1)
00433         self.assertEqual(record.contigs[1].reads[11].rt[0].name, "BL060c2-LR5.g.ab1")
00434         self.assertEqual(record.contigs[1].reads[11].rt[0].tag_type, "matchElsewhereHighQual")
00435         self.assertEqual(record.contigs[1].reads[11].rt[0].program, "phrap")
00436         self.assertEqual(record.contigs[1].reads[11].rt[0].padded_start, 617)
00437         self.assertEqual(record.contigs[1].reads[11].rt[0].padded_end, 631)
00438         self.assertEqual(record.contigs[1].reads[11].rt[0].date, "040217:110357")
00439         self.assertEqual(record.contigs[1].reads[11].wr, None) 
00440 
00441         # Read 12
00442         self.assertEqual(record.contigs[1].reads[12].rd.name, "BL060c5-LR0R.b.ab1")
00443         self.assertEqual(record.contigs[1].reads[12].rd.padded_bases, 855)
00444         self.assertEqual(record.contigs[1].reads[12].rd.info_items, 0)
00445         self.assertEqual(record.contigs[1].reads[12].rd.read_tags, 0)
00446         center = len(record.contigs[1].reads[12].rd.sequence)//2
00447         self.assertEqual(record.contigs[1].reads[12].rd.sequence[:10], "cACTCGCGTA")
00448         self.assertEqual(record.contigs[1].reads[12].rd.sequence[center-5:center+5], "CTCGTAAAAT")
00449         self.assertEqual(record.contigs[1].reads[12].rd.sequence[-10:], "aacccctgca")
00450         self.assertEqual(record.contigs[1].reads[12].qa.qual_clipping_start, 94)
00451         self.assertEqual(record.contigs[1].reads[12].qa.qual_clipping_end, 835)
00452         self.assertEqual(record.contigs[1].reads[12].qa.align_clipping_start, 1)
00453         self.assertEqual(record.contigs[1].reads[12].qa.align_clipping_end, 847)
00454         self.assertEqual(record.contigs[1].reads[12].ds.chromat_file, "BL060c5-LR0R.b.ab1")
00455         self.assertEqual(record.contigs[1].reads[12].ds.phd_file, "BL060c5-LR0R.b.ab1.phd.1")
00456         self.assertEqual(record.contigs[1].reads[12].ds.time, "Wed Nov 12 08:16:30 2003")
00457         self.assertEqual(record.contigs[1].reads[12].ds.chem, "term")
00458         self.assertEqual(record.contigs[1].reads[12].ds.dye, "big")
00459         self.assertEqual(record.contigs[1].reads[12].ds.template, "")
00460         self.assertEqual(record.contigs[1].reads[12].ds.direction, "")
00461         self.assertEqual(len(record.contigs[1].reads[12].rt), 1)
00462         self.assertEqual(record.contigs[1].reads[12].rt[0].name, "BL060c5-LR0R.b.ab1")
00463         self.assertEqual(record.contigs[1].reads[12].rt[0].tag_type, "matchElsewhereHighQual")
00464         self.assertEqual(record.contigs[1].reads[12].rt[0].program, "phrap")
00465         self.assertEqual(record.contigs[1].reads[12].rt[0].padded_start, 617)
00466         self.assertEqual(record.contigs[1].reads[12].rt[0].padded_end, 631)
00467         self.assertEqual(record.contigs[1].reads[12].rt[0].date, "040217:110357")
00468         self.assertEqual(record.contigs[1].reads[12].wr, None)
00469 
00470         # Read 13
00471         self.assertEqual(record.contigs[1].reads[13].rd.name, "BL060c2-LR0R.b.ab1")
00472         self.assertEqual(record.contigs[1].reads[13].rd.padded_bases, 852)
00473         self.assertEqual(record.contigs[1].reads[13].rd.info_items, 0)
00474         self.assertEqual(record.contigs[1].reads[13].rd.read_tags, 0)
00475         center = len(record.contigs[1].reads[13].rd.sequence)//2
00476         self.assertEqual(record.contigs[1].reads[13].rd.sequence[:10], "cgCGTa*tTG")
00477         self.assertEqual(record.contigs[1].reads[13].rd.sequence[center-5:center+5], "GTAAAATATT")
00478         self.assertEqual(record.contigs[1].reads[13].rd.sequence[-10:], "Atccttgtag")
00479         self.assertEqual(record.contigs[1].reads[13].qa.qual_clipping_start, 33)
00480         self.assertEqual(record.contigs[1].reads[13].qa.qual_clipping_end, 831)
00481         self.assertEqual(record.contigs[1].reads[13].qa.align_clipping_start, 1)
00482         self.assertEqual(record.contigs[1].reads[13].qa.align_clipping_end, 852)
00483         self.assertEqual(record.contigs[1].reads[13].ds.chromat_file, "BL060c2-LR0R.b.ab1")
00484         self.assertEqual(record.contigs[1].reads[13].ds.phd_file, "BL060c2-LR0R.b.ab1.phd.1")
00485         self.assertEqual(record.contigs[1].reads[13].ds.time, "Wed Nov 12 08:16:29 2003")
00486         self.assertEqual(record.contigs[1].reads[13].ds.chem, "term")
00487         self.assertEqual(record.contigs[1].reads[13].ds.dye, "big")
00488         self.assertEqual(record.contigs[1].reads[13].ds.template, "")
00489         self.assertEqual(record.contigs[1].reads[13].ds.direction, "")
00490         self.assertEqual(record.contigs[1].reads[13].rt, [])
00491         self.assertEqual(len(record.contigs[1].reads[13].wr), 1)
00492         self.assertEqual(record.contigs[1].reads[13].wr[0].name, "BL060c2-LR0R.b.ab1")
00493         self.assertEqual(record.contigs[1].reads[13].wr[0].aligned, "unaligned")
00494         self.assertEqual(record.contigs[1].reads[13].wr[0].program, "phrap")
00495         self.assertEqual(record.contigs[1].reads[13].wr[0].date, "040217:110357")
00496     
00497     def test_check_record_parser(self):
00498         """Test to check that contig parser parses each contig into a contig."""
00499         contigs=Ace.parse(self.handle)
00500 
00501         # First contig
00502         contig = contigs.next()
00503         self.assertEqual(len(contig.reads), 2)
00504         self.assertEqual(contig.name, "Contig1")
00505         self.assertEqual(contig.nbases, 856)
00506         self.assertEqual(contig.nreads, 2)
00507         self.assertEqual(contig.nsegments, 31)
00508         self.assertEqual(contig.uorc, 'U')
00509         center = len(contig.sequence)//2
00510         self.assertEqual(contig.sequence[:10], "aatacgGGAT")
00511         self.assertEqual(contig.sequence[center-5:center+5], "ACATCATCTG")
00512         self.assertEqual(contig.sequence[-10:], "cATCTAGtac")
00513         center = len(contig.quality)//2
00514         self.assertEqual(contig.quality[:10], [0, 0, 0, 0, 0, 0, 22, 23, 25, 28])
00515         self.assertEqual(contig.quality[center-5:center+5], [90, 90, 90, 90, 90, 90, 90, 90, 90, 90])
00516         self.assertEqual(contig.quality[-10:], [15, 22, 30, 24, 28, 22, 21, 15, 19, 0])
00517         self.assertEqual(len(contig.af), 2)
00518         self.assertEqual(contig.af[1].name, "BL060c3-LR0R.b.ab1")
00519         self.assertEqual(contig.af[1].coru, "U")
00520         self.assertEqual(contig.af[1].padded_start, 1)
00521         self.assertEqual(len(contig.bs), 31)
00522         self.assertEqual(contig.bs[15].name, "BL060c3-LR5.g.ab1")
00523         self.assertEqual(contig.bs[15].padded_start, 434)
00524         self.assertEqual(contig.bs[15].padded_end, 438)
00525         self.assertEqual(contig.bs[30].name, "BL060c3-LR0R.b.ab1")
00526         self.assertEqual(contig.bs[30].padded_start, 823)
00527         self.assertEqual(contig.bs[30].padded_end, 856)
00528         self.assertEqual(contig.ct, None)
00529         self.assertEqual(contig.wa, None)
00530         self.assertEqual(len(contig.reads), 2)
00531         self.assertEqual(contig.reads[0].rd.name, "BL060c3-LR5.g.ab1")
00532         self.assertEqual(contig.reads[0].rd.padded_bases, 868)
00533         self.assertEqual(contig.reads[0].rd.info_items, 0)
00534         self.assertEqual(contig.reads[0].rd.read_tags, 0)
00535         center = len(contig.reads[0].rd.sequence)//2
00536         self.assertEqual(contig.reads[0].rd.sequence[:10], "tagcgaggaa")
00537         self.assertEqual(contig.reads[0].rd.sequence[center-5:center+5], "CCGAGGCCAA")
00538         self.assertEqual(contig.reads[0].rd.sequence[-10:], "gaaccatcag")
00539         self.assertEqual(contig.reads[0].qa.qual_clipping_start, 80)
00540         self.assertEqual(contig.reads[0].qa.qual_clipping_end, 853)
00541         self.assertEqual(contig.reads[0].qa.align_clipping_start, 22)
00542         self.assertEqual(contig.reads[0].qa.align_clipping_end, 856)
00543         self.assertEqual(contig.reads[0].ds, None)
00544         self.assertEqual(len(contig.reads[0].rt), 2)
00545         self.assertEqual(contig.reads[0].rt[0].name, "BL060c3-LR5.g.ab1")
00546         self.assertEqual(contig.reads[0].rt[0].tag_type, "matchElsewhereHighQual")
00547         self.assertEqual(contig.reads[0].rt[0].program, "phrap")
00548         self.assertEqual(contig.reads[0].rt[0].padded_start, 590)
00549         self.assertEqual(contig.reads[0].rt[0].padded_end, 607)
00550         self.assertEqual(contig.reads[0].rt[0].date, "040217:110357")
00551         self.assertEqual(contig.reads[0].rt[1].name, "BL060c3-LR5.g.ab1")
00552         self.assertEqual(contig.reads[0].rt[1].tag_type, "matchElsewhereHighQual")
00553         self.assertEqual(contig.reads[0].rt[1].program, "phrap")
00554         self.assertEqual(contig.reads[0].rt[1].padded_start, 617)
00555         self.assertEqual(contig.reads[0].rt[1].padded_end, 631)
00556         self.assertEqual(contig.reads[0].rt[1].date, "040217:110357")
00557 
00558         self.assertEqual(len(contig.reads[0].wr), 1)
00559         self.assertEqual(contig.reads[0].wr[0].name, "BL060c3-LR5.g.ab1")
00560         self.assertEqual(contig.reads[0].wr[0].aligned, "unaligned")
00561         self.assertEqual(contig.reads[0].wr[0].program, "phrap")
00562         self.assertEqual(contig.reads[0].wr[0].date, "040217:110357")
00563 
00564         self.assertEqual(contig.reads[1].rd.name, "BL060c3-LR0R.b.ab1")
00565         self.assertEqual(contig.reads[1].rd.padded_bases, 856)
00566         self.assertEqual(contig.reads[1].rd.info_items, 0)
00567         self.assertEqual(contig.reads[1].rd.read_tags, 0)
00568         center = len(contig.reads[1].rd.sequence)//2
00569         self.assertEqual(contig.reads[1].rd.sequence[:10], "aatacgGGAT")
00570         self.assertEqual(contig.reads[1].rd.sequence[center-5:center+5], "ACATCATCTG")
00571         self.assertEqual(contig.reads[1].rd.sequence[-10:], "cATCTAGtac")
00572         self.assertEqual(contig.reads[1].qa.qual_clipping_start, 7)
00573         self.assertEqual(contig.reads[1].qa.qual_clipping_end, 778)
00574         self.assertEqual(contig.reads[1].qa.align_clipping_start, 1)
00575         self.assertEqual(contig.reads[1].qa.align_clipping_end, 856)
00576         self.assertEqual(contig.reads[1].ds, None)
00577         self.assertEqual(contig.reads[1].rt, None)
00578         self.assertEqual(contig.reads[1].wr, None)
00579 
00580         # Second contig
00581         contig = contigs.next()
00582         self.assertEqual(len(contig.reads), 14)
00583         self.assertEqual(contig.name, "Contig2")
00584         self.assertEqual(contig.nbases, 3296)
00585         self.assertEqual(contig.nreads, 14)
00586         self.assertEqual(contig.nsegments, 214)
00587         self.assertEqual(contig.uorc, 'U')
00588         center = len(contig.sequence) // 2
00589         self.assertEqual(contig.sequence[:10], "cacggatgat")
00590         self.assertEqual(contig.sequence[center-5:center+5], "TTTGAATATT")
00591         self.assertEqual(contig.sequence[-10:], "Atccttgtag")
00592         center = len(contig.quality) // 2
00593         self.assertEqual(contig.quality[:10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
00594         self.assertEqual(contig.quality[center-5:center+5], [90, 90, 90, 90, 90, 90, 90, 90, 90, 90])
00595         self.assertEqual(contig.quality[-10:], [24, 0, 0, 0, 0, 0, 0, 0, 0, 0])
00596         self.assertEqual(len(contig.af), 14)
00597         self.assertEqual(contig.af[7].name, "BL060-LR3R.b.ab1")
00598         self.assertEqual(contig.af[7].coru, "C")
00599         self.assertEqual(contig.af[7].padded_start, 1601)
00600         self.assertEqual(contig.af[13].name, "BL060c2-LR0R.b.ab1")
00601         self.assertEqual(contig.af[13].coru, "C")
00602         self.assertEqual(contig.af[13].padded_start, 2445)
00603         self.assertEqual(len(contig.bs), 214)
00604         self.assertEqual(contig.bs[107].name, "BL060-c1-LR3R.b.ab1")
00605         self.assertEqual(contig.bs[107].padded_start, 2286)
00606         self.assertEqual(contig.bs[107].padded_end, 2292)
00607         self.assertEqual(contig.bs[213].name, "BL060c2-LR0R.b.ab1")
00608         self.assertEqual(contig.bs[213].padded_start, 3236)
00609         self.assertEqual(contig.bs[213].padded_end, 3296)
00610         self.assertEqual(len(contig.ct), 3)
00611         self.assertEqual(contig.ct[0].name, "Contig2")
00612         self.assertEqual(contig.ct[0].tag_type, "repeat")
00613         self.assertEqual(contig.ct[0].program, "phrap")
00614         self.assertEqual(contig.ct[0].padded_start, 42)
00615         self.assertEqual(contig.ct[0].padded_end, 43)
00616         self.assertEqual(contig.ct[0].date, "123456:765432")
00617         self.assertEqual(contig.ct[0].info, ['This is the forst line of comment for c2', 'and this the second for c2'])
00618         self.assertEqual(contig.ct[1].name, "unrelated_Contig")
00619         self.assertEqual(contig.ct[1].tag_type, "repeat")
00620         self.assertEqual(contig.ct[1].program, "phrap")
00621         self.assertEqual(contig.ct[1].padded_start, 1142)
00622         self.assertEqual(contig.ct[1].padded_end, 143)
00623         self.assertEqual(contig.ct[1].date, "122226:722232")
00624         self.assertEqual(contig.ct[1].info, ['This is the forst line of comment for the unrelated ct tag', 'and this the second'])
00625 
00626         self.assertEqual(contig.ct[2].name, "Contig1")
00627         self.assertEqual(contig.ct[2].tag_type, "repeat")
00628         self.assertEqual(contig.ct[2].program, "phrap")
00629         self.assertEqual(contig.ct[2].padded_start, 52)
00630         self.assertEqual(contig.ct[2].padded_end, 53)
00631         self.assertEqual(contig.ct[2].date, "555456:555432")
00632         self.assertEqual(contig.ct[2].info, ['This is the forst line of comment for c1', 'and this the second for c1'])
00633 
00634         self.assertEqual(len(contig.wa), 1)
00635         self.assertEqual(contig.wa[0].tag_type, "phrap_params")
00636         self.assertEqual(contig.wa[0].program, "phrap")
00637         self.assertEqual(contig.wa[0].date, "040203:114710")
00638         self.assertEqual(contig.wa[0].info, ['phrap 304_nuclsu.fasta.screen -new_ace -retain_duplicates', 'phrap version 0.990329'])
00639 
00640         self.assertEqual(len(contig.reads), 14)
00641 
00642         # Read 0
00643         self.assertEqual(contig.reads[0].rd.name, "BL060-c1-LR12.g.ab1")
00644         self.assertEqual(contig.reads[0].rd.padded_bases, 862)
00645         self.assertEqual(contig.reads[0].rd.info_items, 0)
00646         self.assertEqual(contig.reads[0].rd.read_tags, 0)
00647         center = len(contig.reads[0].rd.sequence)//2
00648         self.assertEqual(contig.reads[0].rd.sequence[:10], "cacggatgat")
00649         self.assertEqual(contig.reads[0].rd.sequence[center-5:center+5], "GTTCTCGTTG")
00650         self.assertEqual(contig.reads[0].rd.sequence[-10:], "CGTTTACCcg")
00651         self.assertEqual(contig.reads[0].qa.qual_clipping_start, 81)
00652         self.assertEqual(contig.reads[0].qa.qual_clipping_end, 842)
00653         self.assertEqual(contig.reads[0].qa.align_clipping_start, 1)
00654         self.assertEqual(contig.reads[0].qa.align_clipping_end, 862)
00655         self.assertEqual(contig.reads[0].ds.chromat_file, "BL060-c1-LR12.g.ab1")
00656         self.assertEqual(contig.reads[0].ds.phd_file, "BL060-c1-LR12.g.ab1.phd.1")
00657         self.assertEqual(contig.reads[0].ds.time, "Tue Feb  3 11:01:16 2004")
00658         self.assertEqual(contig.reads[0].ds.chem, "term")
00659         self.assertEqual(contig.reads[0].ds.dye, "big")
00660         self.assertEqual(contig.reads[0].ds.template, "")
00661         self.assertEqual(contig.reads[0].ds.direction, "")
00662         self.assertEqual(contig.reads[0].rt, None)
00663         self.assertEqual(contig.reads[0].wr, None)
00664 
00665         # Read 1
00666         self.assertEqual(contig.reads[1].rd.name, "BL060-c1-LR11.g.ab1")
00667         self.assertEqual(contig.reads[1].rd.padded_bases, 880)
00668         self.assertEqual(contig.reads[1].rd.info_items, 0)
00669         self.assertEqual(contig.reads[1].rd.read_tags, 0)
00670         center = len(contig.reads[1].rd.sequence)//2
00671         self.assertEqual(contig.reads[1].rd.sequence[:10], "ctttctgacC")
00672         self.assertEqual(contig.reads[1].rd.sequence[center-5:center+5], "CTGTGGTTTC")
00673         self.assertEqual(contig.reads[1].rd.sequence[-10:], "cggagttacg")
00674         self.assertEqual(contig.reads[1].qa.qual_clipping_start, 11)
00675         self.assertEqual(contig.reads[1].qa.qual_clipping_end, 807)
00676         self.assertEqual(contig.reads[1].qa.align_clipping_start, 8)
00677         self.assertEqual(contig.reads[1].qa.align_clipping_end, 880)
00678         self.assertEqual(contig.reads[1].ds.chromat_file, "BL060-c1-LR11.g.ab1")
00679         self.assertEqual(contig.reads[1].ds.phd_file, "BL060-c1-LR11.g.ab1.phd.1")
00680         self.assertEqual(contig.reads[1].ds.time, "Tue Feb  3 11:01:16 2004")
00681         self.assertEqual(contig.reads[1].ds.chem, "term")
00682         self.assertEqual(contig.reads[1].ds.dye, "big")
00683         self.assertEqual(contig.reads[1].ds.template, "")
00684         self.assertEqual(contig.reads[1].ds.direction, "")
00685         self.assertEqual(len(contig.reads[1].rt), 1)
00686         self.assertEqual(contig.reads[1].rt[0].name, "BL060c3-LR5.g.ab1")
00687         self.assertEqual(contig.reads[1].rt[0].tag_type, "matchElsewhereHighQual")
00688         self.assertEqual(contig.reads[1].rt[0].program, "phrap")
00689         self.assertEqual(contig.reads[1].rt[0].padded_start, 617)
00690         self.assertEqual(contig.reads[1].rt[0].padded_end, 631)
00691         self.assertEqual(contig.reads[1].rt[0].date, "040217:110357")
00692         self.assertEqual(contig.reads[1].wr, None)
00693 
00694         # Read 2
00695         self.assertEqual(contig.reads[2].rd.name, "BL060-c1-LR9.g.ab1")
00696         self.assertEqual(contig.reads[2].rd.padded_bases, 864)
00697         self.assertEqual(contig.reads[2].rd.info_items, 0)
00698         self.assertEqual(contig.reads[2].rd.read_tags, 0)
00699         center = len(contig.reads[2].rd.sequence)//2
00700         self.assertEqual(contig.reads[2].rd.sequence[:10], "cacccaCTTT")
00701         self.assertEqual(contig.reads[2].rd.sequence[center-5:center+5], "ACCAAACATT")
00702         self.assertEqual(contig.reads[2].rd.sequence[-10:], "GGTAGCACgc")
00703         self.assertEqual(contig.reads[2].qa.qual_clipping_start, 7)
00704         self.assertEqual(contig.reads[2].qa.qual_clipping_end, 840)
00705         self.assertEqual(contig.reads[2].qa.align_clipping_start, 4)
00706         self.assertEqual(contig.reads[2].qa.align_clipping_end, 864)
00707         self.assertEqual(contig.reads[2].ds.chromat_file, "BL060-c1-LR9.g.ab1")
00708         self.assertEqual(contig.reads[2].ds.phd_file, "BL060-c1-LR9.g.ab1.phd.1")
00709         self.assertEqual(contig.reads[2].ds.time, "Tue Feb  3 11:01:16 2004")
00710         self.assertEqual(contig.reads[2].ds.chem, "term")
00711         self.assertEqual(contig.reads[2].ds.dye, "big")
00712         self.assertEqual(contig.reads[2].ds.template, "")
00713         self.assertEqual(contig.reads[2].ds.direction, "")
00714         self.assertEqual(contig.reads[2].rt, None)
00715         self.assertEqual(contig.reads[2].wr, None)
00716 
00717         # Read 3
00718         self.assertEqual(contig.reads[3].rd.name, "BL060-c1-LR17R.b.ab1")
00719         self.assertEqual(contig.reads[3].rd.padded_bases, 863)
00720         self.assertEqual(contig.reads[3].rd.info_items, 0)
00721         self.assertEqual(contig.reads[3].rd.read_tags, 0)
00722         center = len(contig.reads[3].rd.sequence)//2
00723         self.assertEqual(contig.reads[3].rd.sequence[:10], "ctaattggcc")
00724         self.assertEqual(contig.reads[3].rd.sequence[center-5:center+5], "GGAACCTTTC")
00725         self.assertEqual(contig.reads[3].rd.sequence[-10:], "CAACCTgact")
00726         self.assertEqual(contig.reads[3].qa.qual_clipping_start, 63)
00727         self.assertEqual(contig.reads[3].qa.qual_clipping_end, 857)
00728         self.assertEqual(contig.reads[3].qa.align_clipping_start, 1)
00729         self.assertEqual(contig.reads[3].qa.align_clipping_end, 861)
00730         self.assertEqual(contig.reads[3].ds.chromat_file, "BL060-c1-LR17R.b.ab1")
00731         self.assertEqual(contig.reads[3].ds.phd_file, "BL060-c1-LR17R.b.ab1.phd.1")
00732         self.assertEqual(contig.reads[3].ds.time, "Tue Feb  3 11:01:16 2004")
00733         self.assertEqual(contig.reads[3].ds.chem, "term")
00734         self.assertEqual(contig.reads[3].ds.dye, "big")
00735         self.assertEqual(contig.reads[3].ds.template, "")
00736         self.assertEqual(contig.reads[3].ds.direction, "")
00737         self.assertEqual(len(contig.reads[3].rt), 1)
00738         self.assertEqual(contig.reads[3].rt[0].name, "BL060c3-LR5.g.ab1")
00739         self.assertEqual(contig.reads[3].rt[0].tag_type, "matchElsewhereHighQual")
00740         self.assertEqual(contig.reads[3].rt[0].program, "phrap")
00741         self.assertEqual(contig.reads[3].rt[0].padded_start, 617)
00742         self.assertEqual(contig.reads[3].rt[0].padded_end, 631)
00743         self.assertEqual(contig.reads[3].rt[0].date, "040217:110357")
00744         self.assertEqual(contig.reads[3].wr, None)
00745 
00746         # Read 4
00747         self.assertEqual(contig.reads[4].rd.name, "BL060-LR8.5.g.ab1")
00748         self.assertEqual(contig.reads[4].rd.padded_bases, 877)
00749         self.assertEqual(contig.reads[4].rd.info_items, 0)
00750         self.assertEqual(contig.reads[4].rd.read_tags, 0)
00751         center = len(contig.reads[4].rd.sequence)//2
00752         self.assertEqual(contig.reads[4].rd.sequence[:10], "tgCTGCGGTT")
00753         self.assertEqual(contig.reads[4].rd.sequence[center-5:center+5], "GGCAGTTTCA")
00754         self.assertEqual(contig.reads[4].rd.sequence[-10:], "tactcataaa")
00755         self.assertEqual(contig.reads[4].qa.qual_clipping_start, 13)
00756         self.assertEqual(contig.reads[4].qa.qual_clipping_end, 729)
00757         self.assertEqual(contig.reads[4].qa.align_clipping_start, 1)
00758         self.assertEqual(contig.reads[4].qa.align_clipping_end, 877)
00759         self.assertEqual(contig.reads[4].ds.chromat_file, "BL060-LR8.5.g.ab1")
00760         self.assertEqual(contig.reads[4].ds.phd_file, "BL060-LR8.5.g.ab1.phd.1")
00761         self.assertEqual(contig.reads[4].ds.time, "Fri Nov 14 09:46:03 2003")
00762         self.assertEqual(contig.reads[4].ds.chem, "term")
00763         self.assertEqual(contig.reads[4].ds.dye, "big")
00764         self.assertEqual(contig.reads[4].ds.template, "")
00765         self.assertEqual(contig.reads[4].ds.direction, "")
00766         self.assertEqual(contig.reads[4].rt, None)
00767         self.assertEqual(contig.reads[4].wr, None)
00768 
00769         # Read 5
00770         self.assertEqual(contig.reads[5].rd.name, "BL060-LR3R.b.ab1")
00771         self.assertEqual(contig.reads[5].rd.padded_bases, 874)
00772         self.assertEqual(contig.reads[5].rd.info_items, 0)
00773         self.assertEqual(contig.reads[5].rd.read_tags, 0)
00774         center = len(contig.reads[5].rd.sequence)//2
00775         self.assertEqual(contig.reads[5].rd.sequence[:10], "ctCTTAGGAT")
00776         self.assertEqual(contig.reads[5].rd.sequence[center-5:center+5], "AACTCACATT")
00777         self.assertEqual(contig.reads[5].rd.sequence[-10:], "*CACCCAAac")
00778         self.assertEqual(contig.reads[5].qa.qual_clipping_start, 65)
00779         self.assertEqual(contig.reads[5].qa.qual_clipping_end, 874)
00780         self.assertEqual(contig.reads[5].qa.align_clipping_start, 1)
00781         self.assertEqual(contig.reads[5].qa.align_clipping_end, 874)
00782         self.assertEqual(contig.reads[5].ds.chromat_file, "BL060-LR3R.b.ab1")
00783         self.assertEqual(contig.reads[5].ds.phd_file, "BL060-LR3R.b.ab1.phd.1")
00784         self.assertEqual(contig.reads[5].ds.time, "Fri Nov 14 09:46:03 2003")
00785         self.assertEqual(contig.reads[5].ds.chem, "term")
00786         self.assertEqual(contig.reads[5].ds.dye, "big")
00787         self.assertEqual(contig.reads[5].ds.template, "")
00788         self.assertEqual(contig.reads[5].ds.direction, "")
00789         self.assertEqual(contig.reads[5].rt, None)
00790         self.assertEqual(contig.reads[5].wr, None)
00791 
00792         # Read 6
00793         self.assertEqual(contig.reads[6].rd.name, "BL060-c1-LR3R.b.ab1")
00794         self.assertEqual(contig.reads[6].rd.padded_bases, 864)
00795         self.assertEqual(contig.reads[6].rd.info_items, 0)
00796         self.assertEqual(contig.reads[6].rd.read_tags, 0)
00797         center = len(contig.reads[6].rd.sequence)//2
00798         self.assertEqual(contig.reads[6].rd.sequence[:10], "CCaTGTCCAA")
00799         self.assertEqual(contig.reads[6].rd.sequence[center-5:center+5], "AAGGGTT*CA")
00800         self.assertEqual(contig.reads[6].rd.sequence[-10:], "ACACTCGCga")
00801         self.assertEqual(contig.reads[6].qa.qual_clipping_start, 73)
00802         self.assertEqual(contig.reads[6].qa.qual_clipping_end, 862)
00803         self.assertEqual(contig.reads[6].qa.align_clipping_start, 1)
00804         self.assertEqual(contig.reads[6].qa.align_clipping_end, 863)
00805         self.assertEqual(contig.reads[6].ds.chromat_file, "BL060-c1-LR3R.b.ab1")
00806         self.assertEqual(contig.reads[6].ds.phd_file, "BL060-c1-LR3R.b.ab1.phd.1")
00807         self.assertEqual(contig.reads[6].ds.time, "Tue Feb  3 11:01:16 2004")
00808         self.assertEqual(contig.reads[6].ds.chem, "term")
00809         self.assertEqual(contig.reads[6].ds.dye, "big")
00810         self.assertEqual(contig.reads[6].ds.template, "")
00811         self.assertEqual(contig.reads[6].ds.direction, "")
00812         self.assertEqual(contig.reads[6].rt, None)
00813         self.assertEqual(contig.reads[6].wr, None)
00814 
00815         # Read 7
00816         self.assertEqual(contig.reads[7].rd.name, "BL060-LR3R.b.ab1")
00817         self.assertEqual(contig.reads[7].rd.padded_bases, 857)
00818         self.assertEqual(contig.reads[7].rd.info_items, 0)
00819         self.assertEqual(contig.reads[7].rd.read_tags, 0)
00820         center = len(contig.reads[7].rd.sequence)//2
00821         self.assertEqual(contig.reads[7].rd.sequence[:10], "agaaagagga")
00822         self.assertEqual(contig.reads[7].rd.sequence[center-5:center+5], "nnnannnnnn")
00823         self.assertEqual(contig.reads[7].rd.sequence[-10:], "gtctttgctc")
00824         self.assertEqual(contig.reads[7].qa.qual_clipping_start, 548)
00825         self.assertEqual(contig.reads[7].qa.qual_clipping_end, 847)
00826         self.assertEqual(contig.reads[7].qa.align_clipping_start, 442)
00827         self.assertEqual(contig.reads[7].qa.align_clipping_end, 854)
00828         self.assertEqual(contig.reads[7].ds.chromat_file, "BL060-LR3R.b.ab1")
00829         self.assertEqual(contig.reads[7].ds.phd_file, "BL060-LR3R.b.ab1.phd.1")
00830         self.assertEqual(contig.reads[7].ds.time, "Fri Jan 16 09:01:10 2004")
00831         self.assertEqual(contig.reads[7].ds.chem, "term")
00832         self.assertEqual(contig.reads[7].ds.dye, "big")
00833         self.assertEqual(contig.reads[7].ds.template, "")
00834         self.assertEqual(contig.reads[7].ds.direction, "")
00835         self.assertEqual(contig.reads[7].rt, None)
00836         self.assertEqual(contig.reads[7].wr, None)
00837 
00838         # Read 8
00839         self.assertEqual(contig.reads[8].rd.name, "BL060-c1-LR7.g.ab1")
00840         self.assertEqual(contig.reads[8].rd.padded_bases, 878)
00841         self.assertEqual(contig.reads[8].rd.info_items, 0)
00842         self.assertEqual(contig.reads[8].rd.read_tags, 0)
00843         center = len(contig.reads[8].rd.sequence)//2
00844         self.assertEqual(contig.reads[8].rd.sequence[:10], "agTttc*ctc")
00845         self.assertEqual(contig.reads[8].rd.sequence[center-5:center+5], "TCATAAAACT")
00846         self.assertEqual(contig.reads[8].rd.sequence[-10:], "xxxxxxxxxx")
00847         self.assertEqual(contig.reads[8].qa.qual_clipping_start, 20)
00848         self.assertEqual(contig.reads[8].qa.qual_clipping_end, 798)
00849         self.assertEqual(contig.reads[8].qa.align_clipping_start, 1)
00850         self.assertEqual(contig.reads[8].qa.align_clipping_end, 798)
00851         self.assertEqual(contig.reads[8].ds.chromat_file, "BL060-c1-LR7.g.ab1")
00852         self.assertEqual(contig.reads[8].ds.phd_file, "BL060-c1-LR7.g.ab1.phd.1")
00853         self.assertEqual(contig.reads[8].ds.time, "Tue Feb  3 11:01:16 2004")
00854         self.assertEqual(contig.reads[8].ds.chem, "term")
00855         self.assertEqual(contig.reads[8].ds.dye, "big")
00856         self.assertEqual(contig.reads[8].ds.template, "")
00857         self.assertEqual(contig.reads[8].ds.direction, "")
00858         self.assertEqual(contig.reads[8].rt, None)
00859         self.assertEqual(contig.reads[8].wr, None)
00860 
00861         # Read 9
00862         self.assertEqual(contig.reads[9].rd.name, "BL060-LR7.g.ab1")
00863         self.assertEqual(contig.reads[9].rd.padded_bases, 880)
00864         self.assertEqual(contig.reads[9].rd.info_items, 0)
00865         self.assertEqual(contig.reads[9].rd.read_tags, 0)
00866         center = len(contig.reads[9].rd.sequence)//2
00867         self.assertEqual(contig.reads[9].rd.sequence[:10], "ggctaCGCCc")
00868         self.assertEqual(contig.reads[9].rd.sequence[center-5:center+5], "ATTGAGTTTC")
00869         self.assertEqual(contig.reads[9].rd.sequence[-10:], "tggcgttgcg")
00870         self.assertEqual(contig.reads[9].qa.qual_clipping_start, 14)
00871         self.assertEqual(contig.reads[9].qa.qual_clipping_end, 765)
00872         self.assertEqual(contig.reads[9].qa.align_clipping_start, 4)
00873         self.assertEqual(contig.reads[9].qa.align_clipping_end, 765)
00874         self.assertEqual(contig.reads[9].ds.chromat_file, "BL060-LR7.g.ab1")
00875         self.assertEqual(contig.reads[9].ds.phd_file, "BL060-LR7.g.ab1.phd.1")
00876         self.assertEqual(contig.reads[9].ds.time, "Fri Nov 14 09:46:03 2003")
00877         self.assertEqual(contig.reads[9].ds.chem, "term")
00878         self.assertEqual(contig.reads[9].ds.dye, "big")
00879         self.assertEqual(contig.reads[9].ds.template, "")
00880         self.assertEqual(contig.reads[9].ds.direction, "")
00881         self.assertEqual(contig.reads[9].rt, None)
00882         self.assertEqual(contig.reads[9].wr, None)
00883 
00884         # Read 10
00885         self.assertEqual(contig.reads[10].rd.name, "BL060c5-LR5.g.ab1")
00886         self.assertEqual(contig.reads[10].rd.padded_bases, 871)
00887         self.assertEqual(contig.reads[10].rd.info_items, 0)
00888         self.assertEqual(contig.reads[10].rd.read_tags, 0)
00889         center = len(contig.reads[10].rd.sequence)//2
00890         self.assertEqual(contig.reads[10].rd.sequence[:10], "ggtTCGATTA")
00891         self.assertEqual(contig.reads[10].rd.sequence[center-5:center+5], "ACCAATTGAC")
00892         self.assertEqual(contig.reads[10].rd.sequence[-10:], "ACCACCCatt")
00893         self.assertEqual(contig.reads[10].qa.qual_clipping_start, 12)
00894         self.assertEqual(contig.reads[10].qa.qual_clipping_end, 767)
00895         self.assertEqual(contig.reads[10].qa.align_clipping_start, 1)
00896         self.assertEqual(contig.reads[10].qa.align_clipping_end, 871)
00897         self.assertEqual(contig.reads[10].ds.chromat_file, "BL060c5-LR5.g.ab1")
00898         self.assertEqual(contig.reads[10].ds.phd_file, "BL060c5-LR5.g.ab1.phd.1")
00899         self.assertEqual(contig.reads[10].ds.time, "Fri Nov 14 09:46:03 2003")
00900         self.assertEqual(contig.reads[10].ds.chem, "term")
00901         self.assertEqual(contig.reads[10].ds.dye, "big")
00902         self.assertEqual(contig.reads[10].ds.template, "")
00903         self.assertEqual(contig.reads[10].ds.direction, "")
00904         self.assertEqual(contig.reads[10].rt, None)
00905         self.assertEqual(contig.reads[10].wr, None)
00906 
00907         # Read 11
00908         self.assertEqual(contig.reads[11].rd.name, "BL060c2-LR5.g.ab1")
00909         self.assertEqual(contig.reads[11].rd.padded_bases, 839)
00910         self.assertEqual(contig.reads[11].rd.info_items, 0)
00911         self.assertEqual(contig.reads[11].rd.read_tags, 0)
00912         center = len(contig.reads[11].rd.sequence)//2
00913         self.assertEqual(contig.reads[11].rd.sequence[:10], "ggttcatatg")
00914         self.assertEqual(contig.reads[11].rd.sequence[center-5:center+5], "TAAAATCAGT")
00915         self.assertEqual(contig.reads[11].rd.sequence[-10:], "TCTTGCaata")
00916         self.assertEqual(contig.reads[11].qa.qual_clipping_start, 11)
00917         self.assertEqual(contig.reads[11].qa.qual_clipping_end, 757)
00918         self.assertEqual(contig.reads[11].qa.align_clipping_start, 10)
00919         self.assertEqual(contig.reads[11].qa.align_clipping_end, 835)
00920         self.assertEqual(contig.reads[11].ds, None)
00921         self.assertEqual(len(contig.reads[11].rt), 1)
00922         self.assertEqual(contig.reads[11].rt[0].name, "BL060c2-LR5.g.ab1")
00923         self.assertEqual(contig.reads[11].rt[0].tag_type, "matchElsewhereHighQual")
00924         self.assertEqual(contig.reads[11].rt[0].program, "phrap")
00925         self.assertEqual(contig.reads[11].rt[0].padded_start, 617)
00926         self.assertEqual(contig.reads[11].rt[0].padded_end, 631)
00927         self.assertEqual(contig.reads[11].rt[0].date, "040217:110357")
00928         self.assertEqual(contig.reads[11].wr, None) 
00929 
00930         # Read 12
00931         self.assertEqual(contig.reads[12].rd.name, "BL060c5-LR0R.b.ab1")
00932         self.assertEqual(contig.reads[12].rd.padded_bases, 855)
00933         self.assertEqual(contig.reads[12].rd.info_items, 0)
00934         self.assertEqual(contig.reads[12].rd.read_tags, 0)
00935         center = len(contig.reads[12].rd.sequence)//2
00936         self.assertEqual(contig.reads[12].rd.sequence[:10], "cACTCGCGTA")
00937         self.assertEqual(contig.reads[12].rd.sequence[center-5:center+5], "CTCGTAAAAT")
00938         self.assertEqual(contig.reads[12].rd.sequence[-10:], "aacccctgca")
00939         self.assertEqual(contig.reads[12].qa.qual_clipping_start, 94)
00940         self.assertEqual(contig.reads[12].qa.qual_clipping_end, 835)
00941         self.assertEqual(contig.reads[12].qa.align_clipping_start, 1)
00942         self.assertEqual(contig.reads[12].qa.align_clipping_end, 847)
00943         self.assertEqual(contig.reads[12].ds.chromat_file, "BL060c5-LR0R.b.ab1")
00944         self.assertEqual(contig.reads[12].ds.phd_file, "BL060c5-LR0R.b.ab1.phd.1")
00945         self.assertEqual(contig.reads[12].ds.time, "Wed Nov 12 08:16:30 2003")
00946         self.assertEqual(contig.reads[12].ds.chem, "term")
00947         self.assertEqual(contig.reads[12].ds.dye, "big")
00948         self.assertEqual(contig.reads[12].ds.template, "")
00949         self.assertEqual(contig.reads[12].ds.direction, "")
00950         self.assertEqual(contig.reads[12].rt, None)
00951         self.assertEqual(contig.reads[12].wr, None)
00952 
00953         # Read 13
00954         self.assertEqual(contig.reads[13].rd.name, "BL060c2-LR0R.b.ab1")
00955         self.assertEqual(contig.reads[13].rd.padded_bases, 852)
00956         self.assertEqual(contig.reads[13].rd.info_items, 0)
00957         self.assertEqual(contig.reads[13].rd.read_tags, 0)
00958         center = len(contig.reads[13].rd.sequence)//2
00959         self.assertEqual(contig.reads[13].rd.sequence[:10], "cgCGTa*tTG")
00960         self.assertEqual(contig.reads[13].rd.sequence[center-5:center+5], "GTAAAATATT")
00961         self.assertEqual(contig.reads[13].rd.sequence[-10:], "Atccttgtag")
00962         self.assertEqual(contig.reads[13].qa.qual_clipping_start, 33)
00963         self.assertEqual(contig.reads[13].qa.qual_clipping_end, 831)
00964         self.assertEqual(contig.reads[13].qa.align_clipping_start, 1)
00965         self.assertEqual(contig.reads[13].qa.align_clipping_end, 852)
00966         self.assertEqual(contig.reads[13].ds.chromat_file, "BL060c2-LR0R.b.ab1")
00967         self.assertEqual(contig.reads[13].ds.phd_file, "BL060c2-LR0R.b.ab1.phd.1")
00968         self.assertEqual(contig.reads[13].ds.time, "Wed Nov 12 08:16:29 2003")
00969         self.assertEqual(contig.reads[13].ds.chem, "term")
00970         self.assertEqual(contig.reads[13].ds.dye, "big")
00971         self.assertEqual(contig.reads[13].ds.template, "")
00972         self.assertEqual(contig.reads[13].ds.direction, "")
00973         self.assertEqual(len(contig.reads[13].rt), 1)
00974         self.assertEqual(contig.reads[13].rt[0].name, "BL060c5-LR0R.b.ab1")
00975         self.assertEqual(contig.reads[13].rt[0].tag_type, "matchElsewhereHighQual")
00976         self.assertEqual(contig.reads[13].rt[0].program, "phrap")
00977         self.assertEqual(contig.reads[13].rt[0].padded_start, 617)
00978         self.assertEqual(contig.reads[13].rt[0].padded_end, 631)
00979         self.assertEqual(contig.reads[13].rt[0].date, "040217:110357")
00980         self.assertEqual(len(contig.reads[13].wr), 1)
00981         self.assertEqual(contig.reads[13].wr[0].name, "BL060c2-LR0R.b.ab1")
00982         self.assertEqual(contig.reads[13].wr[0].aligned, "unaligned")
00983         self.assertEqual(contig.reads[13].wr[0].program, "phrap")
00984         self.assertEqual(contig.reads[13].wr[0].date, "040217:110357")
00985 
00986         # Make sure there are no more contigs
00987         self.assertRaises(StopIteration, contigs.next)
00988 
00989 
00990 class AceTestTwo(unittest.TestCase):
00991     """Test parsing example output from CAP3.
00992 
00993     The sample input file seq.cap.ace was downloaded from:
00994     http://genome.cs.mtu.edu/cap/data/seq.cap.ace
00995     """
00996     def setUp(self):
00997         self.handle = open("Ace/seq.cap.ace")
00998 
00999     def test_check_ACEParser(self):
01000         """Test to check that ACEParser can parse the whole file into one record."""
01001         record=Ace.read(self.handle)
01002         self.assertEqual(record.ncontigs, 1)
01003         self.assertEqual(record.nreads, 6)
01004         self.assertEqual(record.wa, None)
01005         self.assertEqual(len(record.contigs), 1)
01006 
01007         self.assertEqual(len(record.contigs[0].reads), 6)
01008         self.assertEqual(record.contigs[0].name, "Contig1")
01009         self.assertEqual(record.contigs[0].nbases, 1222)
01010         self.assertEqual(record.contigs[0].nreads, 6)
01011         self.assertEqual(record.contigs[0].nsegments, 0)
01012         self.assertEqual(record.contigs[0].uorc, "U")
01013         center = len(record.contigs[0].sequence)//2
01014         self.assertEqual(record.contigs[0].sequence[:10], "AGTTTTAGTT")
01015         self.assertEqual(record.contigs[0].sequence[center-5:center+5], "TGTGCGCGCA")
01016         self.assertEqual(record.contigs[0].sequence[-10:], "ATATCACATT")
01017         center = len(record.contigs[0].quality)//2
01018         self.assertEqual(record.contigs[0].quality[:10], [61, 66, 67, 70, 71, 73, 73, 77, 77, 87])
01019         self.assertEqual(record.contigs[0].quality[center-5:center+5], [97, 97, 97, 97, 97, 97, 97, 97, 97, 97])
01020         self.assertEqual(record.contigs[0].quality[-10:], [56, 51, 49, 41, 38, 39, 45, 44, 49, 46])
01021         self.assertEqual(len(record.contigs[0].af), 6)
01022         self.assertEqual(len(record.contigs[0].bs), 0)
01023         self.assertEqual(record.contigs[0].af[3].name, "R5")
01024         self.assertEqual(record.contigs[0].af[3].coru, "C")
01025         self.assertEqual(record.contigs[0].af[3].padded_start, 320)
01026         self.assertEqual(record.contigs[0].af[5].name, "R6")
01027         self.assertEqual(record.contigs[0].af[5].coru, "C")
01028         self.assertEqual(record.contigs[0].af[5].padded_start, 517)
01029         self.assertEqual(record.contigs[0].bs, [])
01030         self.assertEqual(record.contigs[0].ct, None)
01031         self.assertEqual(record.contigs[0].wa, None)
01032         self.assertEqual(len(record.contigs[0].reads), 6)
01033 
01034         self.assertEqual(record.contigs[0].reads[0].rd.name, "R3")
01035         self.assertEqual(record.contigs[0].reads[0].rd.padded_bases, 919)
01036         self.assertEqual(record.contigs[0].reads[0].rd.info_items, 0)
01037         self.assertEqual(record.contigs[0].reads[0].rd.read_tags, 0)
01038         center = len(record.contigs[0].reads[0].rd.sequence)//2
01039         self.assertEqual(record.contigs[0].reads[0].rd.sequence[:10], "NNNNNNNNNN")
01040         self.assertEqual(record.contigs[0].reads[0].rd.sequence[center-5:center+5], "ATGTGCGCTC")
01041         self.assertEqual(record.contigs[0].reads[0].rd.sequence[-10:], "CAGCTCACCA")
01042         self.assertEqual(record.contigs[0].reads[0].qa.qual_clipping_start, 55)
01043         self.assertEqual(record.contigs[0].reads[0].qa.qual_clipping_end, 916)
01044         self.assertEqual(record.contigs[0].reads[0].qa.align_clipping_start, 55)
01045         self.assertEqual(record.contigs[0].reads[0].qa.align_clipping_end, 916)
01046         self.assertEqual(record.contigs[0].reads[0].ds.chromat_file, "")
01047         self.assertEqual(record.contigs[0].reads[0].ds.phd_file, "")
01048         self.assertEqual(record.contigs[0].reads[0].ds.time, "")
01049         self.assertEqual(record.contigs[0].reads[0].ds.chem, "")
01050         self.assertEqual(record.contigs[0].reads[0].ds.dye, "")
01051         self.assertEqual(record.contigs[0].reads[0].ds.template, "")
01052         self.assertEqual(record.contigs[0].reads[0].ds.direction, "")
01053         self.assertEqual(record.contigs[0].reads[0].rt, None)
01054         self.assertEqual(record.contigs[0].reads[0].wr, None)
01055 
01056         self.assertEqual(record.contigs[0].reads[1].rd.name, "R1")
01057         self.assertEqual(record.contigs[0].reads[1].rd.padded_bases, 864)
01058         self.assertEqual(record.contigs[0].reads[1].rd.info_items, 0)
01059         self.assertEqual(record.contigs[0].reads[1].rd.read_tags, 0)
01060         center = len(record.contigs[0].reads[1].rd.sequence)//2
01061         self.assertEqual(record.contigs[0].reads[1].rd.sequence[:10], "AGCCGGTACC")
01062         self.assertEqual(record.contigs[0].reads[1].rd.sequence[center-5:center+5], "GGGATGGCAC")
01063         self.assertEqual(record.contigs[0].reads[1].rd.sequence[-10:], "GGGCTGGGAG")
01064         self.assertEqual(record.contigs[0].reads[1].qa.qual_clipping_start, 12)
01065         self.assertEqual(record.contigs[0].reads[1].qa.qual_clipping_end, 863)
01066         self.assertEqual(record.contigs[0].reads[1].qa.align_clipping_start, 12)
01067         self.assertEqual(record.contigs[0].reads[1].qa.align_clipping_end, 863)
01068         self.assertEqual(record.contigs[0].reads[1].ds.chromat_file, "")
01069         self.assertEqual(record.contigs[0].reads[1].ds.phd_file, "")
01070         self.assertEqual(record.contigs[0].reads[1].ds.time, "")
01071         self.assertEqual(record.contigs[0].reads[1].ds.chem, "")
01072         self.assertEqual(record.contigs[0].reads[1].ds.dye, "")
01073         self.assertEqual(record.contigs[0].reads[1].ds.template, "")
01074         self.assertEqual(record.contigs[0].reads[1].ds.direction, "")
01075         self.assertEqual(record.contigs[0].reads[1].rt, None)
01076         self.assertEqual(record.contigs[0].reads[1].wr, None)
01077 
01078         self.assertEqual(record.contigs[0].reads[2].rd.name, "R2")
01079         self.assertEqual(record.contigs[0].reads[2].rd.padded_bases, 1026)
01080         self.assertEqual(record.contigs[0].reads[2].rd.info_items, 0)
01081         self.assertEqual(record.contigs[0].reads[2].rd.read_tags, 0)
01082         center = len(record.contigs[0].reads[2].rd.sequence)//2
01083         self.assertEqual(record.contigs[0].reads[2].rd.sequence[:10], "NNNNNNNNNN")
01084         self.assertEqual(record.contigs[0].reads[2].rd.sequence[center-5:center+5], "GGATGCCTGG")
01085         self.assertEqual(record.contigs[0].reads[2].rd.sequence[-10:], "GGTTGAGGCC")
01086         self.assertEqual(record.contigs[0].reads[2].qa.qual_clipping_start, 55)
01087         self.assertEqual(record.contigs[0].reads[2].qa.qual_clipping_end, 1000)
01088         self.assertEqual(record.contigs[0].reads[2].qa.align_clipping_start, 55)
01089         self.assertEqual(record.contigs[0].reads[2].qa.align_clipping_end, 1000)
01090         self.assertEqual(record.contigs[0].reads[2].ds.chromat_file, "")
01091         self.assertEqual(record.contigs[0].reads[2].ds.phd_file, "")
01092         self.assertEqual(record.contigs[0].reads[2].ds.time, "")
01093         self.assertEqual(record.contigs[0].reads[2].ds.chem, "")
01094         self.assertEqual(record.contigs[0].reads[2].ds.dye, "")
01095         self.assertEqual(record.contigs[0].reads[2].ds.template, "")
01096         self.assertEqual(record.contigs[0].reads[2].ds.direction, "")
01097         self.assertEqual(record.contigs[0].reads[2].rt, None)
01098         self.assertEqual(record.contigs[0].reads[2].wr, None)
01099 
01100         self.assertEqual(record.contigs[0].reads[3].rd.name, "R5")
01101         self.assertEqual(record.contigs[0].reads[3].rd.padded_bases, 925)
01102         self.assertEqual(record.contigs[0].reads[3].rd.info_items, 0)
01103         self.assertEqual(record.contigs[0].reads[3].rd.read_tags, 0)
01104         center = len(record.contigs[0].reads[3].rd.sequence)//2
01105         self.assertEqual(record.contigs[0].reads[3].rd.sequence[:10], "NNNNNNNNNN")
01106         self.assertEqual(record.contigs[0].reads[3].rd.sequence[center-5:center+5], "CCTCCCTACA")
01107         self.assertEqual(record.contigs[0].reads[3].rd.sequence[-10:], "GCCCCCGGNN")
01108         self.assertEqual(record.contigs[0].reads[3].qa.qual_clipping_start, 293)
01109         self.assertEqual(record.contigs[0].reads[3].qa.qual_clipping_end, 874)
01110         self.assertEqual(record.contigs[0].reads[3].qa.align_clipping_start, 293)
01111         self.assertEqual(record.contigs[0].reads[3].qa.align_clipping_end, 874)
01112         self.assertEqual(record.contigs[0].reads[3].ds.chromat_file, "")
01113         self.assertEqual(record.contigs[0].reads[3].ds.phd_file, "")
01114         self.assertEqual(record.contigs[0].reads[3].ds.time, "")
01115         self.assertEqual(record.contigs[0].reads[3].ds.chem, "")
01116         self.assertEqual(record.contigs[0].reads[3].ds.dye, "")
01117         self.assertEqual(record.contigs[0].reads[3].ds.template, "")
01118         self.assertEqual(record.contigs[0].reads[3].ds.direction, "")
01119         self.assertEqual(record.contigs[0].reads[3].rt, None)
01120         self.assertEqual(record.contigs[0].reads[3].wr, None)
01121 
01122         self.assertEqual(record.contigs[0].reads[4].rd.name, "R4")
01123         self.assertEqual(record.contigs[0].reads[4].rd.padded_bases, 816)
01124         self.assertEqual(record.contigs[0].reads[4].rd.info_items, 0)
01125         self.assertEqual(record.contigs[0].reads[4].rd.read_tags, 0)
01126         center = len(record.contigs[0].reads[4].rd.sequence)//2
01127         self.assertEqual(record.contigs[0].reads[4].rd.sequence[:10], "CACTCAGCTC")
01128         self.assertEqual(record.contigs[0].reads[4].rd.sequence[center-5:center+5], "TCCAAAGGGT")
01129         self.assertEqual(record.contigs[0].reads[4].rd.sequence[-10:], "AGCTGAATCG")
01130         self.assertEqual(record.contigs[0].reads[4].qa.qual_clipping_start, 1)
01131         self.assertEqual(record.contigs[0].reads[4].qa.qual_clipping_end, 799)
01132         self.assertEqual(record.contigs[0].reads[4].qa.align_clipping_start, 1)
01133         self.assertEqual(record.contigs[0].reads[4].qa.align_clipping_end, 799)
01134         self.assertEqual(record.contigs[0].reads[4].ds.chromat_file, "")
01135         self.assertEqual(record.contigs[0].reads[4].ds.phd_file, "")
01136         self.assertEqual(record.contigs[0].reads[4].ds.time, "")
01137         self.assertEqual(record.contigs[0].reads[4].ds.chem, "")
01138         self.assertEqual(record.contigs[0].reads[4].ds.dye, "")
01139         self.assertEqual(record.contigs[0].reads[4].ds.template, "")
01140         self.assertEqual(record.contigs[0].reads[4].ds.direction, "")
01141         self.assertEqual(record.contigs[0].reads[4].rt, None)
01142         self.assertEqual(record.contigs[0].reads[4].wr, None)
01143 
01144         self.assertEqual(record.contigs[0].reads[5].rd.name, "R6")
01145         self.assertEqual(record.contigs[0].reads[5].rd.padded_bases, 857)
01146         self.assertEqual(record.contigs[0].reads[5].rd.info_items, 0)
01147         self.assertEqual(record.contigs[0].reads[5].rd.read_tags, 0)
01148         center = len(record.contigs[0].reads[5].rd.sequence)//2
01149         self.assertEqual(record.contigs[0].reads[5].rd.sequence[:10], "CCGGCAGTGA")
01150         self.assertEqual(record.contigs[0].reads[5].rd.sequence[center-5:center+5], "AAAAAAAACC")
01151         self.assertEqual(record.contigs[0].reads[5].rd.sequence[-10:], "NNNNNNNNNN")
01152         self.assertEqual(record.contigs[0].reads[5].qa.qual_clipping_start, 24)
01153         self.assertEqual(record.contigs[0].reads[5].qa.qual_clipping_end, 706)
01154         self.assertEqual(record.contigs[0].reads[5].qa.align_clipping_start, 24)
01155         self.assertEqual(record.contigs[0].reads[5].qa.align_clipping_end, 706)
01156         self.assertEqual(record.contigs[0].reads[5].ds.chromat_file, "")
01157         self.assertEqual(record.contigs[0].reads[5].ds.phd_file, "")
01158         self.assertEqual(record.contigs[0].reads[5].ds.time, "")
01159         self.assertEqual(record.contigs[0].reads[5].ds.chem, "")
01160         self.assertEqual(record.contigs[0].reads[5].ds.dye, "")
01161         self.assertEqual(record.contigs[0].reads[5].ds.template, "")
01162         self.assertEqual(record.contigs[0].reads[5].ds.direction, "")
01163         self.assertEqual(record.contigs[0].reads[5].rt, None)
01164         self.assertEqual(record.contigs[0].reads[5].wr, None)
01165     
01166     def test_check_record_parser(self):
01167         """Test to check that record parser parses each contig into a record."""
01168         contigs=Ace.parse(self.handle)
01169 
01170         # First (and only) contig
01171         contig = contigs.next()
01172 
01173         self.assertEqual(len(contig.reads), 6)
01174         self.assertEqual(contig.name, "Contig1")
01175         self.assertEqual(contig.nbases, 1222)
01176         self.assertEqual(contig.nreads, 6)
01177         self.assertEqual(contig.nsegments, 0)
01178         self.assertEqual(contig.uorc, "U")
01179         center = len(contig.sequence)//2
01180         self.assertEqual(contig.sequence[:10], "AGTTTTAGTT")
01181         self.assertEqual(contig.sequence[center-5:center+5], "TGTGCGCGCA")
01182         self.assertEqual(contig.sequence[-10:], "ATATCACATT")
01183         center = len(contig.quality)//2
01184         self.assertEqual(contig.quality[:10], [61, 66, 67, 70, 71, 73, 73, 77, 77, 87])
01185         self.assertEqual(contig.quality[center-5:center+5], [97, 97, 97, 97, 97, 97, 97, 97, 97, 97])
01186         self.assertEqual(contig.quality[-10:], [56, 51, 49, 41, 38, 39, 45, 44, 49, 46])
01187         self.assertEqual(len(contig.af), 6)
01188         self.assertEqual(len(contig.bs), 0)
01189         self.assertEqual(contig.af[3].name, "R5")
01190         self.assertEqual(contig.af[3].coru, "C")
01191         self.assertEqual(contig.af[3].padded_start, 320)
01192         self.assertEqual(contig.af[5].name, "R6")
01193         self.assertEqual(contig.af[5].coru, "C")
01194         self.assertEqual(contig.af[5].padded_start, 517)
01195         self.assertEqual(contig.bs, [])
01196         self.assertEqual(contig.ct, None)
01197         self.assertEqual(contig.wa, None)
01198         self.assertEqual(len(contig.reads), 6)
01199 
01200         self.assertEqual(contig.reads[0].rd.name, "R3")
01201         self.assertEqual(contig.reads[0].rd.padded_bases, 919)
01202         self.assertEqual(contig.reads[0].rd.info_items, 0)
01203         self.assertEqual(contig.reads[0].rd.read_tags, 0)
01204         center = len(contig.reads[0].rd.sequence)//2
01205         self.assertEqual(contig.reads[0].rd.sequence[:10], "NNNNNNNNNN")
01206         self.assertEqual(contig.reads[0].rd.sequence[center-5:center+5], "ATGTGCGCTC")
01207         self.assertEqual(contig.reads[0].rd.sequence[-10:], "CAGCTCACCA")
01208         self.assertEqual(contig.reads[0].qa.qual_clipping_start, 55)
01209         self.assertEqual(contig.reads[0].qa.qual_clipping_end, 916)
01210         self.assertEqual(contig.reads[0].qa.align_clipping_start, 55)
01211         self.assertEqual(contig.reads[0].qa.align_clipping_end, 916)
01212         self.assertEqual(contig.reads[0].ds.chromat_file, "")
01213         self.assertEqual(contig.reads[0].ds.phd_file, "")
01214         self.assertEqual(contig.reads[0].ds.time, "")
01215         self.assertEqual(contig.reads[0].ds.chem, "")
01216         self.assertEqual(contig.reads[0].ds.dye, "")
01217         self.assertEqual(contig.reads[0].ds.template, "")
01218         self.assertEqual(contig.reads[0].ds.direction, "")
01219         self.assertEqual(contig.reads[0].rt, None)
01220         self.assertEqual(contig.reads[0].wr, None)
01221 
01222         self.assertEqual(contig.reads[1].rd.name, "R1")
01223         self.assertEqual(contig.reads[1].rd.padded_bases, 864)
01224         self.assertEqual(contig.reads[1].rd.info_items, 0)
01225         self.assertEqual(contig.reads[1].rd.read_tags, 0)
01226         center = len(contig.reads[1].rd.sequence)//2
01227         self.assertEqual(contig.reads[1].rd.sequence[:10], "AGCCGGTACC")
01228         self.assertEqual(contig.reads[1].rd.sequence[center-5:center+5], "GGGATGGCAC")
01229         self.assertEqual(contig.reads[1].rd.sequence[-10:], "GGGCTGGGAG")
01230         self.assertEqual(contig.reads[1].qa.qual_clipping_start, 12)
01231         self.assertEqual(contig.reads[1].qa.qual_clipping_end, 863)
01232         self.assertEqual(contig.reads[1].qa.align_clipping_start, 12)
01233         self.assertEqual(contig.reads[1].qa.align_clipping_end, 863)
01234         self.assertEqual(contig.reads[1].ds.chromat_file, "")
01235         self.assertEqual(contig.reads[1].ds.phd_file, "")
01236         self.assertEqual(contig.reads[1].ds.time, "")
01237         self.assertEqual(contig.reads[1].ds.chem, "")
01238         self.assertEqual(contig.reads[1].ds.dye, "")
01239         self.assertEqual(contig.reads[1].ds.template, "")
01240         self.assertEqual(contig.reads[1].ds.direction, "")
01241         self.assertEqual(contig.reads[1].rt, None)
01242         self.assertEqual(contig.reads[1].wr, None)
01243 
01244         self.assertEqual(contig.reads[2].rd.name, "R2")
01245         self.assertEqual(contig.reads[2].rd.padded_bases, 1026)
01246         self.assertEqual(contig.reads[2].rd.info_items, 0)
01247         self.assertEqual(contig.reads[2].rd.read_tags, 0)
01248         center = len(contig.reads[2].rd.sequence)//2
01249         self.assertEqual(contig.reads[2].rd.sequence[:10], "NNNNNNNNNN")
01250         self.assertEqual(contig.reads[2].rd.sequence[center-5:center+5], "GGATGCCTGG")
01251         self.assertEqual(contig.reads[2].rd.sequence[-10:], "GGTTGAGGCC")
01252         self.assertEqual(contig.reads[2].qa.qual_clipping_start, 55)
01253         self.assertEqual(contig.reads[2].qa.qual_clipping_end, 1000)
01254         self.assertEqual(contig.reads[2].qa.align_clipping_start, 55)
01255         self.assertEqual(contig.reads[2].qa.align_clipping_end, 1000)
01256         self.assertEqual(contig.reads[2].ds.chromat_file, "")
01257         self.assertEqual(contig.reads[2].ds.phd_file, "")
01258         self.assertEqual(contig.reads[2].ds.time, "")
01259         self.assertEqual(contig.reads[2].ds.chem, "")
01260         self.assertEqual(contig.reads[2].ds.dye, "")
01261         self.assertEqual(contig.reads[2].ds.template, "")
01262         self.assertEqual(contig.reads[2].ds.direction, "")
01263         self.assertEqual(contig.reads[2].rt, None)
01264         self.assertEqual(contig.reads[2].wr, None)
01265 
01266         self.assertEqual(contig.reads[3].rd.name, "R5")
01267         self.assertEqual(contig.reads[3].rd.padded_bases, 925)
01268         self.assertEqual(contig.reads[3].rd.info_items, 0)
01269         self.assertEqual(contig.reads[3].rd.read_tags, 0)
01270         center = len(contig.reads[3].rd.sequence)//2
01271         self.assertEqual(contig.reads[3].rd.sequence[:10], "NNNNNNNNNN")
01272         self.assertEqual(contig.reads[3].rd.sequence[center-5:center+5], "CCTCCCTACA")
01273         self.assertEqual(contig.reads[3].rd.sequence[-10:], "GCCCCCGGNN")
01274         self.assertEqual(contig.reads[3].qa.qual_clipping_start, 293)
01275         self.assertEqual(contig.reads[3].qa.qual_clipping_end, 874)
01276         self.assertEqual(contig.reads[3].qa.align_clipping_start, 293)
01277         self.assertEqual(contig.reads[3].qa.align_clipping_end, 874)
01278         self.assertEqual(contig.reads[3].ds.chromat_file, "")
01279         self.assertEqual(contig.reads[3].ds.phd_file, "")
01280         self.assertEqual(contig.reads[3].ds.time, "")
01281         self.assertEqual(contig.reads[3].ds.chem, "")
01282         self.assertEqual(contig.reads[3].ds.dye, "")
01283         self.assertEqual(contig.reads[3].ds.template, "")
01284         self.assertEqual(contig.reads[3].ds.direction, "")
01285         self.assertEqual(contig.reads[3].rt, None)
01286         self.assertEqual(contig.reads[3].wr, None)
01287 
01288         self.assertEqual(contig.reads[4].rd.name, "R4")
01289         self.assertEqual(contig.reads[4].rd.padded_bases, 816)
01290         self.assertEqual(contig.reads[4].rd.info_items, 0)
01291         self.assertEqual(contig.reads[4].rd.read_tags, 0)
01292         center = len(contig.reads[4].rd.sequence)//2
01293         self.assertEqual(contig.reads[4].rd.sequence[:10], "CACTCAGCTC")
01294         self.assertEqual(contig.reads[4].rd.sequence[center-5:center+5], "TCCAAAGGGT")
01295         self.assertEqual(contig.reads[4].rd.sequence[-10:], "AGCTGAATCG")
01296         self.assertEqual(contig.reads[4].qa.qual_clipping_start, 1)
01297         self.assertEqual(contig.reads[4].qa.qual_clipping_end, 799)
01298         self.assertEqual(contig.reads[4].qa.align_clipping_start, 1)
01299         self.assertEqual(contig.reads[4].qa.align_clipping_end, 799)
01300         self.assertEqual(contig.reads[4].ds.chromat_file, "")
01301         self.assertEqual(contig.reads[4].ds.phd_file, "")
01302         self.assertEqual(contig.reads[4].ds.time, "")
01303         self.assertEqual(contig.reads[4].ds.chem, "")
01304         self.assertEqual(contig.reads[4].ds.dye, "")
01305         self.assertEqual(contig.reads[4].ds.template, "")
01306         self.assertEqual(contig.reads[4].ds.direction, "")
01307         self.assertEqual(contig.reads[4].rt, None)
01308         self.assertEqual(contig.reads[4].wr, None)
01309 
01310         self.assertEqual(contig.reads[5].rd.name, "R6")
01311         self.assertEqual(contig.reads[5].rd.padded_bases, 857)
01312         self.assertEqual(contig.reads[5].rd.info_items, 0)
01313         self.assertEqual(contig.reads[5].rd.read_tags, 0)
01314         center = len(contig.reads[5].rd.sequence)//2
01315         self.assertEqual(contig.reads[5].rd.sequence[:10], "CCGGCAGTGA")
01316         self.assertEqual(contig.reads[5].rd.sequence[center-5:center+5], "AAAAAAAACC")
01317         self.assertEqual(contig.reads[5].rd.sequence[-10:], "NNNNNNNNNN")
01318         self.assertEqual(contig.reads[5].qa.qual_clipping_start, 24)
01319         self.assertEqual(contig.reads[5].qa.qual_clipping_end, 706)
01320         self.assertEqual(contig.reads[5].qa.align_clipping_start, 24)
01321         self.assertEqual(contig.reads[5].qa.align_clipping_end, 706)
01322         self.assertEqual(contig.reads[5].ds.chromat_file, "")
01323         self.assertEqual(contig.reads[5].ds.phd_file, "")
01324         self.assertEqual(contig.reads[5].ds.time, "")
01325         self.assertEqual(contig.reads[5].ds.chem, "")
01326         self.assertEqual(contig.reads[5].ds.dye, "")
01327         self.assertEqual(contig.reads[5].ds.template, "")
01328         self.assertEqual(contig.reads[5].ds.direction, "")
01329         self.assertEqual(contig.reads[5].rt, None)
01330         self.assertEqual(contig.reads[5].wr, None)
01331     
01332         # Make sure there are no more contigs
01333         self.assertRaises(StopIteration, contigs.next)
01334 
01335 
01336 class AceTestThree(unittest.TestCase):
01337     """Test parsing example ACE input file for CONSED.
01338 
01339     The sample input file was downloaded from:
01340     http://bozeman.mbt.washington.edu/consed/distributions/README.16.0.txt
01341     """
01342     def setUp(self):
01343         self.handle = open("Ace/consed_sample.ace")
01344 
01345     def test_check_ACEParser(self):
01346         """Test to check that ACEParser can parse the whole file into one record."""
01347         record=Ace.read(self.handle)
01348         self.assertEqual(record.ncontigs, 1)
01349         self.assertEqual(record.nreads, 8)
01350         self.assertEqual(len(record.wa), 1)
01351         self.assertEqual(record.wa[0].tag_type, "phrap_params")
01352         self.assertEqual(record.wa[0].program, "phrap")
01353         self.assertEqual(record.wa[0].date, "990621:161947")
01354         self.assertEqual(record.wa[0].info, ['/usr/local/genome/bin/phrap standard.fasta.screen -new_ace -view', 'phrap version 0.990319'])
01355         self.assertEqual(len(record.contigs), 1)
01356 
01357         self.assertEqual(len(record.contigs[0].reads), 8)
01358         self.assertEqual(record.contigs[0].name, "Contig1")
01359         self.assertEqual(record.contigs[0].nbases, 1475)
01360         self.assertEqual(record.contigs[0].nreads, 8)
01361         self.assertEqual(record.contigs[0].nsegments, 156)
01362         self.assertEqual(record.contigs[0].uorc, "U")
01363         center = len(record.contigs[0].sequence)//2
01364         self.assertEqual(record.contigs[0].sequence[:10], "agccccgggc")
01365         self.assertEqual(record.contigs[0].sequence[center-5:center+5], "CTTCCCCAGG")
01366         self.assertEqual(record.contigs[0].sequence[-10:], "gttgggtttg")
01367         center = len(record.contigs[0].quality)//2
01368         self.assertEqual(record.contigs[0].quality[:10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
01369         self.assertEqual(record.contigs[0].quality[center-5:center+5], [90, 90, 90, 90, 90, 90, 90, 90, 89, 89])
01370         self.assertEqual(record.contigs[0].quality[-10:], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
01371         self.assertEqual(len(record.contigs[0].af), 8)
01372         self.assertEqual(len(record.contigs[0].bs), 156)
01373         self.assertEqual(record.contigs[0].af[4].name, "K26-291s")
01374         self.assertEqual(record.contigs[0].af[4].coru, "U")
01375         self.assertEqual(record.contigs[0].af[4].padded_start, 828)
01376         self.assertEqual(record.contigs[0].af[7].name, "K26-766c")
01377         self.assertEqual(record.contigs[0].af[7].coru, "C")
01378         self.assertEqual(record.contigs[0].af[7].padded_start, 408)
01379         self.assertEqual(record.contigs[0].bs[78].name, "K26-394c")
01380         self.assertEqual(record.contigs[0].bs[78].padded_start, 987)
01381         self.assertEqual(record.contigs[0].bs[78].padded_end, 987)
01382         self.assertEqual(record.contigs[0].bs[155].name, "K26-822c")
01383         self.assertEqual(record.contigs[0].bs[155].padded_start, 1303)
01384         self.assertEqual(record.contigs[0].bs[155].padded_end, 1475)
01385         self.assertEqual(len(record.contigs[0].ct), 3)
01386         self.assertEqual(record.contigs[0].ct[0].name, "Contig1")
01387         self.assertEqual(record.contigs[0].ct[0].tag_type, "repeat")
01388         self.assertEqual(record.contigs[0].ct[0].program, "consed")
01389         self.assertEqual(record.contigs[0].ct[0].padded_start, 976)
01390         self.assertEqual(record.contigs[0].ct[0].padded_end, 986)
01391         self.assertEqual(record.contigs[0].ct[0].date, "971218:180623")
01392         self.assertEqual(record.contigs[0].ct[0].info, [])
01393         self.assertEqual(record.contigs[0].ct[1].name, "Contig1")
01394         self.assertEqual(record.contigs[0].ct[1].tag_type, "comment")
01395         self.assertEqual(record.contigs[0].ct[1].program, "consed")
01396         self.assertEqual(record.contigs[0].ct[1].padded_start, 996)
01397         self.assertEqual(record.contigs[0].ct[1].padded_end, 1007)
01398         self.assertEqual(record.contigs[0].ct[1].date, "971218:180623")
01399         self.assertEqual(record.contigs[0].ct[1].info, ['This is line 1 of a comment', 'There may be any number of lines'])
01400         self.assertEqual(record.contigs[0].ct[2].name, "Contig1")
01401         self.assertEqual(record.contigs[0].ct[2].tag_type, "oligo")
01402         self.assertEqual(record.contigs[0].ct[2].program, "consed")
01403         self.assertEqual(record.contigs[0].ct[2].padded_start, 963)
01404         self.assertEqual(record.contigs[0].ct[2].padded_end, 987)
01405         self.assertEqual(record.contigs[0].ct[2].date, "971218:180623")
01406         self.assertEqual(record.contigs[0].ct[2].info, ['standard.1 acataagacattctaaatttttact 50 U', 'seq from clone'])
01407         self.assertEqual(len(record.contigs[0].wa), 1)
01408         self.assertEqual(record.contigs[0].wa[0].tag_type, "phrap_params")
01409         self.assertEqual(record.contigs[0].wa[0].program, "phrap")
01410         self.assertEqual(record.contigs[0].wa[0].date, "990621:161947")
01411         self.assertEqual(record.contigs[0].wa[0].info, ['/usr/local/genome/bin/phrap standard.fasta.screen -new_ace -view', 'phrap version 0.990319'])
01412 
01413         self.assertEqual(len(record.contigs[0].reads), 8)
01414 
01415         self.assertEqual(record.contigs[0].reads[0].rd.name, "K26-217c")
01416         self.assertEqual(record.contigs[0].reads[0].rd.padded_bases, 563)
01417         self.assertEqual(record.contigs[0].reads[0].rd.info_items, 0)
01418         self.assertEqual(record.contigs[0].reads[0].rd.read_tags, 0)
01419         center = len(record.contigs[0].reads[0].rd.sequence)//2
01420         self.assertEqual(record.contigs[0].reads[0].rd.sequence[:10], "tcccCgtgag")
01421         self.assertEqual(record.contigs[0].reads[0].rd.sequence[center-5:center+5], "CTCCTGcctg")
01422         self.assertEqual(record.contigs[0].reads[0].rd.sequence[-10:], "ggcccccctc")
01423         self.assertEqual(record.contigs[0].reads[0].qa.qual_clipping_start, 19)
01424         self.assertEqual(record.contigs[0].reads[0].qa.qual_clipping_end, 349)
01425         self.assertEqual(record.contigs[0].reads[0].qa.align_clipping_start, 19)
01426         self.assertEqual(record.contigs[0].reads[0].qa.align_clipping_end, 424)
01427         self.assertEqual(record.contigs[0].reads[0].ds.chromat_file, "K26-217c")
01428         self.assertEqual(record.contigs[0].reads[0].ds.phd_file, "K26-217c.phd.1")
01429         self.assertEqual(record.contigs[0].reads[0].ds.time, "Thu Sep 12 15:42:38 1996")
01430         self.assertEqual(record.contigs[0].reads[0].ds.chem, "")
01431         self.assertEqual(record.contigs[0].reads[0].ds.dye, "")
01432         self.assertEqual(record.contigs[0].reads[0].ds.template, "")
01433         self.assertEqual(record.contigs[0].reads[0].ds.direction, "")
01434         self.assertEqual(record.contigs[0].reads[0].rt, None)
01435         self.assertEqual(record.contigs[0].reads[0].wr, None)
01436 
01437         self.assertEqual(record.contigs[0].reads[1].rd.name, "K26-526t")
01438         self.assertEqual(record.contigs[0].reads[1].rd.padded_bases, 687)
01439         self.assertEqual(record.contigs[0].reads[1].rd.info_items, 0)
01440         self.assertEqual(record.contigs[0].reads[1].rd.read_tags, 0)
01441         center = len(record.contigs[0].reads[1].rd.sequence)//2
01442         self.assertEqual(record.contigs[0].reads[1].rd.sequence[:10], "ccgtcctgag")
01443         self.assertEqual(record.contigs[0].reads[1].rd.sequence[center-5:center+5], "cacagcccT*")
01444         self.assertEqual(record.contigs[0].reads[1].rd.sequence[-10:], "Ttttgtttta")
01445         self.assertEqual(record.contigs[0].reads[1].qa.qual_clipping_start, 12)
01446         self.assertEqual(record.contigs[0].reads[1].qa.qual_clipping_end, 353)
01447         self.assertEqual(record.contigs[0].reads[1].qa.align_clipping_start, 9)
01448         self.assertEqual(record.contigs[0].reads[1].qa.align_clipping_end, 572)
01449         self.assertEqual(record.contigs[0].reads[1].ds.chromat_file, "K26-526t")
01450         self.assertEqual(record.contigs[0].reads[1].ds.phd_file, "K26-526t.phd.1")
01451         self.assertEqual(record.contigs[0].reads[1].ds.time, "Thu Sep 12 15:42:33 1996")
01452         self.assertEqual(record.contigs[0].reads[1].ds.chem, "")
01453         self.assertEqual(record.contigs[0].reads[1].ds.dye, "")
01454         self.assertEqual(record.contigs[0].reads[1].ds.template, "")
01455         self.assertEqual(record.contigs[0].reads[1].ds.direction, "")
01456         self.assertEqual(record.contigs[0].reads[1].rt, None)
01457         self.assertEqual(record.contigs[0].reads[1].wr, None)
01458 
01459         self.assertEqual(record.contigs[0].reads[2].rd.name, "K26-961c")
01460         self.assertEqual(record.contigs[0].reads[2].rd.padded_bases, 517)
01461         self.assertEqual(record.contigs[0].reads[2].rd.info_items, 0)
01462         self.assertEqual(record.contigs[0].reads[2].rd.read_tags, 0)
01463         center = len(record.contigs[0].reads[2].rd.sequence)//2
01464         self.assertEqual(record.contigs[0].reads[2].rd.sequence[:10], "aatattaccg")
01465         self.assertEqual(record.contigs[0].reads[2].rd.sequence[center-5:center+5], "CAGATGGGTT")
01466         self.assertEqual(record.contigs[0].reads[2].rd.sequence[-10:], "ctattcaggg")
01467         self.assertEqual(record.contigs[0].reads[2].qa.qual_clipping_start, 20)
01468         self.assertEqual(record.contigs[0].reads[2].qa.qual_clipping_end, 415)
01469         self.assertEqual(record.contigs[0].reads[2].qa.align_clipping_start, 26)
01470         self.assertEqual(record.contigs[0].reads[2].qa.align_clipping_end, 514)
01471         self.assertEqual(record.contigs[0].reads[2].ds.chromat_file, "K26-961c")
01472         self.assertEqual(record.contigs[0].reads[2].ds.phd_file, "K26-961c.phd.1")
01473         self.assertEqual(record.contigs[0].reads[2].ds.time, "Thu Sep 12 15:42:37 1996")
01474         self.assertEqual(record.contigs[0].reads[2].ds.chem, "")
01475         self.assertEqual(record.contigs[0].reads[2].ds.dye, "")
01476         self.assertEqual(record.contigs[0].reads[2].ds.template, "")
01477         self.assertEqual(record.contigs[0].reads[2].ds.direction, "")
01478         self.assertEqual(record.contigs[0].reads[2].rt, None)
01479         self.assertEqual(record.contigs[0].reads[2].wr, None)
01480 
01481         self.assertEqual(record.contigs[0].reads[3].rd.name, "K26-394c")
01482         self.assertEqual(record.contigs[0].reads[3].rd.padded_bases, 628)
01483         self.assertEqual(record.contigs[0].reads[3].rd.info_items, 0)
01484         self.assertEqual(record.contigs[0].reads[3].rd.read_tags, 0)
01485         center = len(record.contigs[0].reads[3].rd.sequence)//2
01486         self.assertEqual(record.contigs[0].reads[3].rd.sequence[:10], "ctgcgtatcg")
01487         self.assertEqual(record.contigs[0].reads[3].rd.sequence[center-5:center+5], "AGGATTGCTT")
01488         self.assertEqual(record.contigs[0].reads[3].rd.sequence[-10:], "aaccctgggt")
01489         self.assertEqual(record.contigs[0].reads[3].qa.qual_clipping_start, 18)
01490         self.assertEqual(record.contigs[0].reads[3].qa.qual_clipping_end, 368)
01491         self.assertEqual(record.contigs[0].reads[3].qa.align_clipping_start, 11)
01492         self.assertEqual(record.contigs[0].reads[3].qa.align_clipping_end, 502)
01493         self.assertEqual(record.contigs[0].reads[3].ds.chromat_file, "K26-394c")
01494         self.assertEqual(record.contigs[0].reads[3].ds.phd_file, "K26-394c.phd.1")
01495         self.assertEqual(record.contigs[0].reads[3].ds.time, "Thu Sep 12 15:42:32 1996")
01496         self.assertEqual(record.contigs[0].reads[3].ds.chem, "")
01497         self.assertEqual(record.contigs[0].reads[3].ds.dye, "")
01498         self.assertEqual(record.contigs[0].reads[3].ds.template, "")
01499         self.assertEqual(record.contigs[0].reads[3].ds.direction, "")
01500         self.assertEqual(record.contigs[0].reads[3].rt, None)
01501         self.assertEqual(record.contigs[0].reads[3].wr, None)
01502 
01503         self.assertEqual(record.contigs[0].reads[4].rd.name, "K26-291s")
01504         self.assertEqual(record.contigs[0].reads[4].rd.padded_bases, 556)
01505         self.assertEqual(record.contigs[0].reads[4].rd.info_items, 0)
01506         self.assertEqual(record.contigs[0].reads[4].rd.read_tags, 0)
01507         center = len(record.contigs[0].reads[4].rd.sequence)//2
01508         self.assertEqual(record.contigs[0].reads[4].rd.sequence[:10], "gaggatcgct")
01509         self.assertEqual(record.contigs[0].reads[4].rd.sequence[center-5:center+5], "GTgcgaggat")
01510         self.assertEqual(record.contigs[0].reads[4].rd.sequence[-10:], "caggcagatg")
01511         self.assertEqual(record.contigs[0].reads[4].qa.qual_clipping_start, 11)
01512         self.assertEqual(record.contigs[0].reads[4].qa.qual_clipping_end, 373)
01513         self.assertEqual(record.contigs[0].reads[4].qa.align_clipping_start, 11)
01514         self.assertEqual(record.contigs[0].reads[4].qa.align_clipping_end, 476)
01515         self.assertEqual(record.contigs[0].reads[4].ds.chromat_file, "K26-291s")
01516         self.assertEqual(record.contigs[0].reads[4].ds.phd_file, "K26-291s.phd.1")
01517         self.assertEqual(record.contigs[0].reads[4].ds.time, "Thu Sep 12 15:42:31 1996")
01518         self.assertEqual(record.contigs[0].reads[4].ds.chem, "")
01519         self.assertEqual(record.contigs[0].reads[4].ds.dye, "")
01520         self.assertEqual(record.contigs[0].reads[4].ds.template, "")
01521         self.assertEqual(record.contigs[0].reads[4].ds.direction, "")
01522         self.assertEqual(record.contigs[0].reads[4].rt, None)
01523         self.assertEqual(record.contigs[0].reads[4].wr, None)
01524 
01525         self.assertEqual(record.contigs[0].reads[5].rd.name, "K26-822c")
01526         self.assertEqual(record.contigs[0].reads[5].rd.padded_bases, 593)
01527         self.assertEqual(record.contigs[0].reads[5].rd.info_items, 0)
01528         self.assertEqual(record.contigs[0].reads[5].rd.read_tags, 0)
01529         center = len(record.contigs[0].reads[5].rd.sequence)//2
01530         self.assertEqual(record.contigs[0].reads[5].rd.sequence[:10], "ggggatccg*")
01531         self.assertEqual(record.contigs[0].reads[5].rd.sequence[center-5:center+5], "GCaAgacCCt")
01532         self.assertEqual(record.contigs[0].reads[5].rd.sequence[-10:], "gttgggtttg")
01533 
01534         self.assertEqual(record.contigs[0].reads[5].qa.qual_clipping_start, 25)
01535         self.assertEqual(record.contigs[0].reads[5].qa.qual_clipping_end, 333)
01536         self.assertEqual(record.contigs[0].reads[5].qa.align_clipping_start, 16)
01537         self.assertEqual(record.contigs[0].reads[5].qa.align_clipping_end, 593)
01538         self.assertEqual(record.contigs[0].reads[5].ds.chromat_file, "K26-822c")
01539         self.assertEqual(record.contigs[0].reads[5].ds.phd_file, "K26-822c.phd.1")
01540         self.assertEqual(record.contigs[0].reads[5].ds.time, "Thu Sep 12 15:42:36 1996")
01541         self.assertEqual(record.contigs[0].reads[5].ds.chem, "")
01542         self.assertEqual(record.contigs[0].reads[5].ds.dye, "")
01543         self.assertEqual(record.contigs[0].reads[5].ds.template, "")
01544         self.assertEqual(record.contigs[0].reads[5].ds.direction, "")
01545         self.assertEqual(record.contigs[0].reads[5].rt, None)
01546         self.assertEqual(record.contigs[0].reads[5].wr, None)
01547 
01548         self.assertEqual(record.contigs[0].reads[6].rd.name, "K26-572c")
01549         self.assertEqual(record.contigs[0].reads[6].rd.padded_bases, 594)
01550         self.assertEqual(record.contigs[0].reads[6].rd.info_items, 0)
01551         self.assertEqual(record.contigs[0].reads[6].rd.read_tags, 0)
01552         center = len(record.contigs[0].reads[6].rd.sequence)//2
01553         self.assertEqual(record.contigs[0].reads[6].rd.sequence[:10], "agccccgggc")
01554         self.assertEqual(record.contigs[0].reads[6].rd.sequence[center-5:center+5], "ggatcACATA")
01555         self.assertEqual(record.contigs[0].reads[6].rd.sequence[-10:], "aatagtaaca")
01556         self.assertEqual(record.contigs[0].reads[6].qa.qual_clipping_start, 249)
01557         self.assertEqual(record.contigs[0].reads[6].qa.qual_clipping_end, 584)
01558         self.assertEqual(record.contigs[0].reads[6].qa.align_clipping_start, 1)
01559         self.assertEqual(record.contigs[0].reads[6].qa.align_clipping_end, 586)
01560         self.assertEqual(record.contigs[0].reads[6].ds.chromat_file, "K26-572c")
01561         self.assertEqual(record.contigs[0].reads[6].ds.phd_file, "K26-572c.phd.1")
01562         self.assertEqual(record.contigs[0].reads[6].ds.time, "Thu Sep 12 15:42:34 1996")
01563         self.assertEqual(record.contigs[0].reads[6].ds.chem, "")
01564         self.assertEqual(record.contigs[0].reads[6].ds.dye, "")
01565         self.assertEqual(record.contigs[0].reads[6].ds.template, "")
01566         self.assertEqual(record.contigs[0].reads[6].ds.direction, "")
01567         self.assertEqual(record.contigs[0].reads[6].rt, None)
01568         self.assertEqual(record.contigs[0].reads[6].wr, None)
01569 
01570         self.assertEqual(record.contigs[0].reads[7].rd.name, "K26-766c")
01571         self.assertEqual(record.contigs[0].reads[7].rd.padded_bases, 603)
01572         self.assertEqual(record.contigs[0].reads[7].rd.info_items, 0)
01573         self.assertEqual(record.contigs[0].reads[7].rd.read_tags, 0)
01574         center = len(record.contigs[0].reads[7].rd.sequence)//2
01575         self.assertEqual(record.contigs[0].reads[7].rd.sequence[:10], "gaataattgg")
01576         self.assertEqual(record.contigs[0].reads[7].rd.sequence[center-5:center+5], "TggCCCATCT")
01577         self.assertEqual(record.contigs[0].reads[7].rd.sequence[-10:], "gaaccacacg")
01578         self.assertEqual(record.contigs[0].reads[7].qa.qual_clipping_start, 240)
01579         self.assertEqual(record.contigs[0].reads[7].qa.qual_clipping_end, 584)
01580         self.assertEqual(record.contigs[0].reads[7].qa.align_clipping_start, 126)
01581         self.assertEqual(record.contigs[0].reads[7].qa.align_clipping_end, 583)
01582         self.assertEqual(record.contigs[0].reads[7].ds.chromat_file, "K26-766c")
01583         self.assertEqual(record.contigs[0].reads[7].ds.phd_file, "K26-766c.phd.1")
01584         self.assertEqual(record.contigs[0].reads[7].ds.time, "Thu Sep 12 15:42:35 1996")
01585         self.assertEqual(record.contigs[0].reads[7].ds.chem, "")
01586         self.assertEqual(record.contigs[0].reads[7].ds.dye, "")
01587         self.assertEqual(record.contigs[0].reads[7].ds.template, "")
01588         self.assertEqual(record.contigs[0].reads[7].ds.direction, "")
01589         self.assertEqual(record.contigs[0].reads[7].rt, None)
01590         self.assertEqual(record.contigs[0].reads[7].wr, None)
01591  
01592     def test_check_record_parser(self):
01593         """Test to check that record parser parses each contig into a record."""
01594         contigs=Ace.parse(self.handle)
01595 
01596         # First (and only) contig
01597         contig = contigs.next()
01598 
01599         self.assertEqual(len(contig.reads), 8)
01600         self.assertEqual(contig.name, "Contig1")
01601         self.assertEqual(contig.nbases, 1475)
01602         self.assertEqual(contig.nreads, 8)
01603         self.assertEqual(contig.nsegments, 156)
01604         self.assertEqual(contig.uorc, "U")
01605         center = len(contig.sequence)//2
01606         self.assertEqual(contig.sequence[:10], "agccccgggc")
01607         self.assertEqual(contig.sequence[center-5:center+5], "CTTCCCCAGG")
01608         self.assertEqual(contig.sequence[-10:], "gttgggtttg")
01609         center = len(contig.quality)//2
01610         self.assertEqual(contig.quality[:10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
01611         self.assertEqual(contig.quality[center-5:center+5], [90, 90, 90, 90, 90, 90, 90, 90, 89, 89])
01612         self.assertEqual(contig.quality[-10:], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
01613         self.assertEqual(len(contig.af), 8)
01614         self.assertEqual(len(contig.bs), 156)
01615         self.assertEqual(contig.af[4].name, "K26-291s")
01616         self.assertEqual(contig.af[4].coru, "U")
01617         self.assertEqual(contig.af[4].padded_start, 828)
01618         self.assertEqual(contig.af[7].name, "K26-766c")
01619         self.assertEqual(contig.af[7].coru, "C")
01620         self.assertEqual(contig.af[7].padded_start, 408)
01621         self.assertEqual(contig.bs[78].name, "K26-394c")
01622         self.assertEqual(contig.bs[78].padded_start, 987)
01623         self.assertEqual(contig.bs[78].padded_end, 987)
01624         self.assertEqual(contig.bs[155].name, "K26-822c")
01625         self.assertEqual(contig.bs[155].padded_start, 1303)
01626         self.assertEqual(contig.bs[155].padded_end, 1475)
01627         self.assertEqual(len(contig.ct), 3)
01628         self.assertEqual(contig.ct[0].name, "Contig1")
01629         self.assertEqual(contig.ct[0].tag_type, "repeat")
01630         self.assertEqual(contig.ct[0].program, "consed")
01631         self.assertEqual(contig.ct[0].padded_start, 976)
01632         self.assertEqual(contig.ct[0].padded_end, 986)
01633         self.assertEqual(contig.ct[0].date, "971218:180623")
01634         self.assertEqual(contig.ct[0].info, [])
01635         self.assertEqual(contig.ct[1].name, "Contig1")
01636         self.assertEqual(contig.ct[1].tag_type, "comment")
01637         self.assertEqual(contig.ct[1].program, "consed")
01638         self.assertEqual(contig.ct[1].padded_start, 996)
01639         self.assertEqual(contig.ct[1].padded_end, 1007)
01640         self.assertEqual(contig.ct[1].date, "971218:180623")
01641         self.assertEqual(contig.ct[1].info, ['This is line 1 of a comment', 'There may be any number of lines'])
01642         self.assertEqual(contig.ct[2].name, "Contig1")
01643         self.assertEqual(contig.ct[2].tag_type, "oligo")
01644         self.assertEqual(contig.ct[2].program, "consed")
01645         self.assertEqual(contig.ct[2].padded_start, 963)
01646         self.assertEqual(contig.ct[2].padded_end, 987)
01647         self.assertEqual(contig.ct[2].date, "971218:180623")
01648         self.assertEqual(contig.ct[2].info, ['standard.1 acataagacattctaaatttttact 50 U', 'seq from clone'])
01649         self.assertEqual(len(contig.wa), 1)
01650         self.assertEqual(contig.wa[0].tag_type, "phrap_params")
01651         self.assertEqual(contig.wa[0].program, "phrap")
01652         self.assertEqual(contig.wa[0].date, "990621:161947")
01653         self.assertEqual(contig.wa[0].info, ['/usr/local/genome/bin/phrap standard.fasta.screen -new_ace -view', 'phrap version 0.990319'])
01654 
01655         self.assertEqual(len(contig.reads), 8)
01656 
01657         self.assertEqual(contig.reads[0].rd.name, "K26-217c")
01658         self.assertEqual(contig.reads[0].rd.padded_bases, 563)
01659         self.assertEqual(contig.reads[0].rd.info_items, 0)
01660         self.assertEqual(contig.reads[0].rd.read_tags, 0)
01661         center = len(contig.reads[0].rd.sequence)//2
01662         self.assertEqual(contig.reads[0].rd.sequence[:10], "tcccCgtgag")
01663         self.assertEqual(contig.reads[0].rd.sequence[center-5:center+5], "CTCCTGcctg")
01664         self.assertEqual(contig.reads[0].rd.sequence[-10:], "ggcccccctc")
01665         self.assertEqual(contig.reads[0].qa.qual_clipping_start, 19)
01666         self.assertEqual(contig.reads[0].qa.qual_clipping_end, 349)
01667         self.assertEqual(contig.reads[0].qa.align_clipping_start, 19)
01668         self.assertEqual(contig.reads[0].qa.align_clipping_end, 424)
01669         self.assertEqual(contig.reads[0].ds.chromat_file, "K26-217c")
01670         self.assertEqual(contig.reads[0].ds.phd_file, "K26-217c.phd.1")
01671         self.assertEqual(contig.reads[0].ds.time, "Thu Sep 12 15:42:38 1996")
01672         self.assertEqual(contig.reads[0].ds.chem, "")
01673         self.assertEqual(contig.reads[0].ds.dye, "")
01674         self.assertEqual(contig.reads[0].ds.template, "")
01675         self.assertEqual(contig.reads[0].ds.direction, "")
01676         self.assertEqual(contig.reads[0].rt, None)
01677         self.assertEqual(contig.reads[0].wr, None)
01678 
01679         self.assertEqual(contig.reads[1].rd.name, "K26-526t")
01680         self.assertEqual(contig.reads[1].rd.padded_bases, 687)
01681         self.assertEqual(contig.reads[1].rd.info_items, 0)
01682         self.assertEqual(contig.reads[1].rd.read_tags, 0)
01683         center = len(contig.reads[1].rd.sequence)//2
01684         self.assertEqual(contig.reads[1].rd.sequence[:10], "ccgtcctgag")
01685         self.assertEqual(contig.reads[1].rd.sequence[center-5:center+5], "cacagcccT*")
01686         self.assertEqual(contig.reads[1].rd.sequence[-10:], "Ttttgtttta")
01687         self.assertEqual(contig.reads[1].qa.qual_clipping_start, 12)
01688         self.assertEqual(contig.reads[1].qa.qual_clipping_end, 353)
01689         self.assertEqual(contig.reads[1].qa.align_clipping_start, 9)
01690         self.assertEqual(contig.reads[1].qa.align_clipping_end, 572)
01691         self.assertEqual(contig.reads[1].ds.chromat_file, "K26-526t")
01692         self.assertEqual(contig.reads[1].ds.phd_file, "K26-526t.phd.1")
01693         self.assertEqual(contig.reads[1].ds.time, "Thu Sep 12 15:42:33 1996")
01694         self.assertEqual(contig.reads[1].ds.chem, "")
01695         self.assertEqual(contig.reads[1].ds.dye, "")
01696         self.assertEqual(contig.reads[1].ds.template, "")
01697         self.assertEqual(contig.reads[1].ds.direction, "")
01698         self.assertEqual(contig.reads[1].rt, None)
01699         self.assertEqual(contig.reads[1].wr, None)
01700 
01701         self.assertEqual(contig.reads[2].rd.name, "K26-961c")
01702         self.assertEqual(contig.reads[2].rd.padded_bases, 517)
01703         self.assertEqual(contig.reads[2].rd.info_items, 0)
01704         self.assertEqual(contig.reads[2].rd.read_tags, 0)
01705         center = len(contig.reads[2].rd.sequence)//2
01706         self.assertEqual(contig.reads[2].rd.sequence[:10], "aatattaccg")
01707         self.assertEqual(contig.reads[2].rd.sequence[center-5:center+5], "CAGATGGGTT")
01708         self.assertEqual(contig.reads[2].rd.sequence[-10:], "ctattcaggg")
01709         self.assertEqual(contig.reads[2].qa.qual_clipping_start, 20)
01710         self.assertEqual(contig.reads[2].qa.qual_clipping_end, 415)
01711         self.assertEqual(contig.reads[2].qa.align_clipping_start, 26)
01712         self.assertEqual(contig.reads[2].qa.align_clipping_end, 514)
01713         self.assertEqual(contig.reads[2].ds.chromat_file, "K26-961c")
01714         self.assertEqual(contig.reads[2].ds.phd_file, "K26-961c.phd.1")
01715         self.assertEqual(contig.reads[2].ds.time, "Thu Sep 12 15:42:37 1996")
01716         self.assertEqual(contig.reads[2].ds.chem, "")
01717         self.assertEqual(contig.reads[2].ds.dye, "")
01718         self.assertEqual(contig.reads[2].ds.template, "")
01719         self.assertEqual(contig.reads[2].ds.direction, "")
01720         self.assertEqual(contig.reads[2].rt, None)
01721         self.assertEqual(contig.reads[2].wr, None)
01722 
01723         self.assertEqual(contig.reads[3].rd.name, "K26-394c")
01724         self.assertEqual(contig.reads[3].rd.padded_bases, 628)
01725         self.assertEqual(contig.reads[3].rd.info_items, 0)
01726         self.assertEqual(contig.reads[3].rd.read_tags, 0)
01727         center = len(contig.reads[3].rd.sequence)//2
01728         self.assertEqual(contig.reads[3].rd.sequence[:10], "ctgcgtatcg")
01729         self.assertEqual(contig.reads[3].rd.sequence[center-5:center+5], "AGGATTGCTT")
01730         self.assertEqual(contig.reads[3].rd.sequence[-10:], "aaccctgggt")
01731         self.assertEqual(contig.reads[3].qa.qual_clipping_start, 18)
01732         self.assertEqual(contig.reads[3].qa.qual_clipping_end, 368)
01733         self.assertEqual(contig.reads[3].qa.align_clipping_start, 11)
01734         self.assertEqual(contig.reads[3].qa.align_clipping_end, 502)
01735         self.assertEqual(contig.reads[3].ds.chromat_file, "K26-394c")
01736         self.assertEqual(contig.reads[3].ds.phd_file, "K26-394c.phd.1")
01737         self.assertEqual(contig.reads[3].ds.time, "Thu Sep 12 15:42:32 1996")
01738         self.assertEqual(contig.reads[3].ds.chem, "")
01739         self.assertEqual(contig.reads[3].ds.dye, "")
01740         self.assertEqual(contig.reads[3].ds.template, "")
01741         self.assertEqual(contig.reads[3].ds.direction, "")
01742         self.assertEqual(contig.reads[3].rt, None)
01743         self.assertEqual(contig.reads[3].wr, None)
01744 
01745         self.assertEqual(contig.reads[4].rd.name, "K26-291s")
01746         self.assertEqual(contig.reads[4].rd.padded_bases, 556)
01747         self.assertEqual(contig.reads[4].rd.info_items, 0)
01748         self.assertEqual(contig.reads[4].rd.read_tags, 0)
01749         center = len(contig.reads[4].rd.sequence)//2
01750         self.assertEqual(contig.reads[4].rd.sequence[:10], "gaggatcgct")
01751         self.assertEqual(contig.reads[4].rd.sequence[center-5:center+5], "GTgcgaggat")
01752         self.assertEqual(contig.reads[4].rd.sequence[-10:], "caggcagatg")
01753         self.assertEqual(contig.reads[4].qa.qual_clipping_start, 11)
01754         self.assertEqual(contig.reads[4].qa.qual_clipping_end, 373)
01755         self.assertEqual(contig.reads[4].qa.align_clipping_start, 11)
01756         self.assertEqual(contig.reads[4].qa.align_clipping_end, 476)
01757         self.assertEqual(contig.reads[4].ds.chromat_file, "K26-291s")
01758         self.assertEqual(contig.reads[4].ds.phd_file, "K26-291s.phd.1")
01759         self.assertEqual(contig.reads[4].ds.time, "Thu Sep 12 15:42:31 1996")
01760         self.assertEqual(contig.reads[4].ds.chem, "")
01761         self.assertEqual(contig.reads[4].ds.dye, "")
01762         self.assertEqual(contig.reads[4].ds.template, "")
01763         self.assertEqual(contig.reads[4].ds.direction, "")
01764         self.assertEqual(contig.reads[4].rt, None)
01765         self.assertEqual(contig.reads[4].wr, None)
01766 
01767         self.assertEqual(contig.reads[5].rd.name, "K26-822c")
01768         self.assertEqual(contig.reads[5].rd.padded_bases, 593)
01769         self.assertEqual(contig.reads[5].rd.info_items, 0)
01770         self.assertEqual(contig.reads[5].rd.read_tags, 0)
01771         center = len(contig.reads[5].rd.sequence)//2
01772         self.assertEqual(contig.reads[5].rd.sequence[:10], "ggggatccg*")
01773         self.assertEqual(contig.reads[5].rd.sequence[center-5:center+5], "GCaAgacCCt")
01774         self.assertEqual(contig.reads[5].rd.sequence[-10:], "gttgggtttg")
01775 
01776         self.assertEqual(contig.reads[5].qa.qual_clipping_start, 25)
01777         self.assertEqual(contig.reads[5].qa.qual_clipping_end, 333)
01778         self.assertEqual(contig.reads[5].qa.align_clipping_start, 16)
01779         self.assertEqual(contig.reads[5].qa.align_clipping_end, 593)
01780         self.assertEqual(contig.reads[5].ds.chromat_file, "K26-822c")
01781         self.assertEqual(contig.reads[5].ds.phd_file, "K26-822c.phd.1")
01782         self.assertEqual(contig.reads[5].ds.time, "Thu Sep 12 15:42:36 1996")
01783         self.assertEqual(contig.reads[5].ds.chem, "")
01784         self.assertEqual(contig.reads[5].ds.dye, "")
01785         self.assertEqual(contig.reads[5].ds.template, "")
01786         self.assertEqual(contig.reads[5].ds.direction, "")
01787         self.assertEqual(contig.reads[5].rt, None)
01788         self.assertEqual(contig.reads[5].wr, None)
01789 
01790         self.assertEqual(contig.reads[6].rd.name, "K26-572c")
01791         self.assertEqual(contig.reads[6].rd.padded_bases, 594)
01792         self.assertEqual(contig.reads[6].rd.info_items, 0)
01793         self.assertEqual(contig.reads[6].rd.read_tags, 0)
01794         center = len(contig.reads[6].rd.sequence)//2
01795         self.assertEqual(contig.reads[6].rd.sequence[:10], "agccccgggc")
01796         self.assertEqual(contig.reads[6].rd.sequence[center-5:center+5], "ggatcACATA")
01797         self.assertEqual(contig.reads[6].rd.sequence[-10:], "aatagtaaca")
01798         self.assertEqual(contig.reads[6].qa.qual_clipping_start, 249)
01799         self.assertEqual(contig.reads[6].qa.qual_clipping_end, 584)
01800         self.assertEqual(contig.reads[6].qa.align_clipping_start, 1)
01801         self.assertEqual(contig.reads[6].qa.align_clipping_end, 586)
01802         self.assertEqual(contig.reads[6].ds.chromat_file, "K26-572c")
01803         self.assertEqual(contig.reads[6].ds.phd_file, "K26-572c.phd.1")
01804         self.assertEqual(contig.reads[6].ds.time, "Thu Sep 12 15:42:34 1996")
01805         self.assertEqual(contig.reads[6].ds.chem, "")
01806         self.assertEqual(contig.reads[6].ds.dye, "")
01807         self.assertEqual(contig.reads[6].ds.template, "")
01808         self.assertEqual(contig.reads[6].ds.direction, "")
01809         self.assertEqual(contig.reads[6].rt, None)
01810         self.assertEqual(contig.reads[6].wr, None)
01811 
01812         self.assertEqual(contig.reads[7].rd.name, "K26-766c")
01813         self.assertEqual(contig.reads[7].rd.padded_bases, 603)
01814         self.assertEqual(contig.reads[7].rd.info_items, 0)
01815         self.assertEqual(contig.reads[7].rd.read_tags, 0)
01816         center = len(contig.reads[7].rd.sequence)//2
01817         self.assertEqual(contig.reads[7].rd.sequence[:10], "gaataattgg")
01818         self.assertEqual(contig.reads[7].rd.sequence[center-5:center+5], "TggCCCATCT")
01819         self.assertEqual(contig.reads[7].rd.sequence[-10:], "gaaccacacg")
01820         self.assertEqual(contig.reads[7].qa.qual_clipping_start, 240)
01821         self.assertEqual(contig.reads[7].qa.qual_clipping_end, 584)
01822         self.assertEqual(contig.reads[7].qa.align_clipping_start, 126)
01823         self.assertEqual(contig.reads[7].qa.align_clipping_end, 583)
01824         self.assertEqual(contig.reads[7].ds.chromat_file, "K26-766c")
01825         self.assertEqual(contig.reads[7].ds.phd_file, "K26-766c.phd.1")
01826         self.assertEqual(contig.reads[7].ds.time, "Thu Sep 12 15:42:35 1996")
01827         self.assertEqual(contig.reads[7].ds.chem, "")
01828         self.assertEqual(contig.reads[7].ds.dye, "")
01829         self.assertEqual(contig.reads[7].ds.template, "")
01830         self.assertEqual(contig.reads[7].ds.direction, "")
01831         self.assertEqual(contig.reads[7].rt, None)
01832         self.assertEqual(contig.reads[7].wr, None)
01833 
01834         # Make sure there are no more contigs
01835         self.assertRaises(StopIteration, contigs.next)
01836 
01837 
01838 if __name__ == "__main__":
01839     runner = unittest.TextTestRunner(verbosity = 2)
01840     unittest.main(testRunner=runner)