Back to index

python-biopython  1.60
test_Seq_objs.py
Go to the documentation of this file.
00001 # Copyright 2009 by Peter Cock.  All rights reserved.
00002 # This code is part of the Biopython distribution and governed by its
00003 # license.  Please see the LICENSE file that should have been included
00004 # as part of this package.
00005 
00006 """Unittests for the Seq objects."""
00007 import unittest
00008 import sys
00009 if sys.version_info[0] == 3:
00010    maketrans = str.maketrans
00011 else:
00012    from string import maketrans
00013 
00014 from Bio.Alphabet import generic_protein, generic_nucleotide, \
00015                          generic_dna, generic_rna
00016 from Bio.Alphabet.IUPAC import protein, extended_protein
00017 from Bio.Alphabet.IUPAC import unambiguous_dna, ambiguous_dna, ambiguous_rna
00018 from Bio.Data.IUPACData import ambiguous_dna_values, ambiguous_rna_values
00019 from Bio.Seq import Seq, UnknownSeq, MutableSeq, translate
00020 from Bio.Data.CodonTable import TranslationError, CodonTable
00021 
00022 #This is just the standard table with less stop codons
00023 #(replaced with coding for O as an artifical example)
00024 special_table = CodonTable(forward_table={
00025     'TTT': 'F', 'TTC': 'F', 'TTA': 'L', 'TTG': 'L',
00026     'TCT': 'S', 'TCC': 'S', 'TCA': 'S', 'TCG': 'S',
00027     'TAT': 'Y', 'TAC': 'Y', 'TAA': 'O',
00028     'TGT': 'C', 'TGC': 'C', 'TGA': 'O', 'TGG': 'W',
00029     'CTT': 'L', 'CTC': 'L', 'CTA': 'L', 'CTG': 'L',
00030     'CCT': 'P', 'CCC': 'P', 'CCA': 'P', 'CCG': 'P',
00031     'CAT': 'H', 'CAC': 'H', 'CAA': 'Q', 'CAG': 'Q',
00032     'CGT': 'R', 'CGC': 'R', 'CGA': 'R', 'CGG': 'R',
00033     'ATT': 'I', 'ATC': 'I', 'ATA': 'I', 'ATG': 'M',
00034     'ACT': 'T', 'ACC': 'T', 'ACA': 'T', 'ACG': 'T',
00035     'AAT': 'N', 'AAC': 'N', 'AAA': 'K', 'AAG': 'K',
00036     'AGT': 'S', 'AGC': 'S', 'AGA': 'R', 'AGG': 'R',
00037     'GTT': 'V', 'GTC': 'V', 'GTA': 'V', 'GTG': 'V',
00038     'GCT': 'A', 'GCC': 'A', 'GCA': 'A', 'GCG': 'A',
00039     'GAT': 'D', 'GAC': 'D', 'GAA': 'E', 'GAG': 'E',
00040     'GGT': 'G', 'GGC': 'G', 'GGA': 'G', 'GGG': 'G'},
00041     start_codons=['TAA', 'TAG', 'TGA'],
00042     stop_codons=['TAG'])
00043 
00044 Chilodonella_uncinata_table = CodonTable(forward_table={
00045     'TTT': 'F', 'TTC': 'F', 'TTA': 'L', 'TTG': 'L',
00046     'TCT': 'S', 'TCC': 'S', 'TCA': 'S', 'TCG': 'S',
00047     'TAT': 'Y', 'TAC': 'Y',             'TAG': 'Q', 
00048     'TGT': 'C', 'TGC': 'C', 'TGA': 'W', 'TGG': 'W',
00049     'CTT': 'L', 'CTC': 'L', 'CTA': 'L', 'CTG': 'L',
00050     'CCT': 'P', 'CCC': 'P', 'CCA': 'P', 'CCG': 'P',
00051     'CAT': 'H', 'CAC': 'H', 'CAA': 'Q', 'CAG': 'Q',
00052     'CGT': 'R', 'CGC': 'R', 'CGA': 'R', 'CGG': 'R',
00053     'ATT': 'I', 'ATC': 'I', 'ATA': 'I', 'ATG': 'M',
00054     'ACT': 'T', 'ACC': 'T', 'ACA': 'T', 'ACG': 'T',
00055     'AAT': 'N', 'AAC': 'N', 'AAA': 'K', 'AAG': 'K',
00056     'AGT': 'S', 'AGC': 'S', 'AGA': 'R', 'AGG': 'R',
00057     'GTT': 'V', 'GTC': 'V', 'GTA': 'V', 'GTG': 'V',
00058     'GCT': 'A', 'GCC': 'A', 'GCA': 'A', 'GCG': 'A',
00059     'GAT': 'D', 'GAC': 'D', 'GAA': 'E', 'GAG': 'E',
00060     'GGT': 'G', 'GGC': 'G', 'GGA': 'G', 'GGG': 'G'},
00061     start_codons = [ 'ATG'],
00062     stop_codons = ['TAA' ])
00063 
00064 class StringMethodTests(unittest.TestCase):
00065     _examples = [ \
00066         Seq("ACGTGGGGT", generic_protein),
00067         Seq("ACGTGGGGT", generic_nucleotide),
00068         Seq("ACGTGGGGT", generic_dna),
00069         Seq("ACGUGGGGU", generic_rna),
00070         Seq("GG", generic_protein),
00071         Seq("GG", generic_nucleotide),
00072         Seq("GG", generic_dna),
00073         Seq("GG", generic_rna),
00074         Seq("A", generic_protein),
00075         Seq("A", generic_nucleotide),
00076         Seq("A", generic_dna),
00077         Seq("A", generic_rna),
00078         UnknownSeq(1),
00079         UnknownSeq(1, character="n"),
00080         UnknownSeq(1, generic_rna),
00081         UnknownSeq(1, generic_rna, "n"),
00082         UnknownSeq(1, generic_rna, "N"),
00083         UnknownSeq(10, generic_rna, "N"),
00084         UnknownSeq(10, generic_dna, "N"),
00085         UnknownSeq(10, generic_nucleotide, "N"),
00086         UnknownSeq(10, generic_protein, "X"),
00087         UnknownSeq(10, character="X"),
00088         UnknownSeq(10),
00089         ]
00090     for seq in _examples[:]:
00091         if isinstance(seq, Seq):
00092             _examples.append(seq.tomutable())
00093     _start_end_values = [0, 1, 2, 1000, -1, -2, -999]
00094 
00095 
00096     def _test_method(self, method_name, pre_comp_function=None, start_end=False):
00097         """Check this method matches the plain string's method."""
00098         self.assertTrue(isinstance(method_name, str))
00099         for example1 in self._examples:
00100             if not hasattr(example1, method_name):
00101                 #e.g. MutableSeq does not support find
00102                 continue
00103             str1 = str(example1)
00104 
00105             for example2 in self._examples:
00106                 if not hasattr(example2, method_name):
00107                     #e.g. MutableSeq does not support find
00108                     continue
00109                 str2 = str(example2)
00110 
00111                 i = getattr(example1,method_name)(str2)
00112                 j = getattr(str1,method_name)(str2)
00113                 if pre_comp_function:
00114                     i = pre_comp_function(i)
00115                     j = pre_comp_function(j)
00116                 if i != j:
00117                     raise ValueError("%s.%s(%s) = %i, not %i" \
00118                                      % (repr(example1),
00119                                         method_name,
00120                                         repr(str2),
00121                                         i,
00122                                         j))
00123 
00124                 try:
00125                     i = getattr(example1,method_name)(example2)
00126                     j = getattr(str1,method_name)(str2)
00127                     if pre_comp_function:
00128                         i = pre_comp_function(i)
00129                         j = pre_comp_function(j)
00130                     if i != j:
00131                         raise ValueError("%s.%s(%s) = %i, not %i" \
00132                                          % (repr(example1),
00133                                             method_name,
00134                                             repr(example2),
00135                                             i,
00136                                             j))
00137                 except TypeError:
00138                     #TODO - Check the alphabets do clash!
00139                     pass
00140 
00141                 if start_end:
00142                     for start in self._start_end_values:
00143                         i = getattr(example1,method_name)(str2, start)
00144                         j = getattr(str1,method_name)(str2, start)
00145                         if pre_comp_function:
00146                             i = pre_comp_function(i)
00147                             j = pre_comp_function(j)
00148                         if i != j:
00149                             raise ValueError("%s.%s(%s, %i) = %i, not %i" \
00150                                              % (repr(example1),
00151                                                 method_name,
00152                                                 repr(str2),
00153                                                 start,
00154                                                 i,
00155                                                 j))
00156                         
00157                         for end in self._start_end_values:
00158                             i = getattr(example1,method_name)(str2, start, end)
00159                             j = getattr(str1,method_name)(str2, start, end)
00160                             if pre_comp_function:
00161                                 i = pre_comp_function(i)
00162                                 j = pre_comp_function(j)
00163                             if i != j:
00164                                 raise ValueError("%s.%s(%s, %i, %i) = %i, not %i" \
00165                                                  % (repr(example1),
00166                                                     method_name,
00167                                                     repr(str2),
00168                                                     start,
00169                                                     end,
00170                                                     i,
00171                                                     j))
00172 
00173     def test_str_count(self):
00174         """Check matches the python string count method."""
00175         self._test_method("count", start_end=True)
00176 
00177     def test_str_find(self):
00178         """Check matches the python string find method."""
00179         self._test_method("find", start_end=True)
00180 
00181     def test_str_rfind(self):
00182         """Check matches the python string rfind method."""
00183         self._test_method("rfind", start_end=True)
00184 
00185     def test_str_startswith(self):
00186         """Check matches the python string startswith method."""
00187         self._test_method("startswith", start_end=True)
00188 
00189         try:
00190             self.assertTrue("ABCDE".startswith(("ABE","OBE","ABC")))
00191         except TypeError:
00192             #Base string only supports this on Python 2.5+, skip this
00193             return
00194         
00195         #Now check with a tuple of sub sequences
00196         for example1 in self._examples:
00197             if not hasattr(example1, "startswith"):
00198                 #e.g. MutableSeq does not support this
00199                 continue
00200             subs = tuple([example1[start:start+2] for start \
00201                           in range(0, len(example1)-2,3)])
00202             subs_str = tuple([str(s) for s in subs])
00203 
00204             self.assertEqual(str(example1).startswith(subs_str),
00205                              example1.startswith(subs))
00206             self.assertEqual(str(example1).startswith(subs_str),
00207                              example1.startswith(subs_str)) #strings!
00208             self.assertEqual(str(example1).startswith(subs_str,3),
00209                              example1.startswith(subs,3))
00210             self.assertEqual(str(example1).startswith(subs_str,2,6),
00211                              example1.startswith(subs,2,6))        
00212 
00213     def test_str_endswith(self):
00214         """Check matches the python string endswith method."""
00215         self._test_method("endswith", start_end=True)
00216 
00217         try:
00218             self.assertTrue("ABCDE".endswith(("ABE","OBE","CDE")))
00219         except TypeError:
00220             #Base string only supports this on Python 2.5+, skip this
00221             return
00222 
00223         #Now check with a tuple of sub sequences
00224         for example1 in self._examples:
00225             if not hasattr(example1, "endswith"):
00226                 #e.g. MutableSeq does not support this
00227                 continue
00228             subs = tuple([example1[start:start+2] for start \
00229                           in range(0, len(example1)-2,3)])
00230             subs_str = tuple([str(s) for s in subs])
00231 
00232             self.assertEqual(str(example1).endswith(subs_str),
00233                              example1.endswith(subs))
00234             self.assertEqual(str(example1).startswith(subs_str),
00235                              example1.startswith(subs_str)) #strings!
00236             self.assertEqual(str(example1).endswith(subs_str,3),
00237                              example1.endswith(subs,3))
00238             self.assertEqual(str(example1).endswith(subs_str,2,6),
00239                              example1.endswith(subs,2,6))
00240 
00241     def test_str_strip(self):
00242         """Check matches the python string strip method."""
00243         self._test_method("strip", pre_comp_function=str)
00244 
00245     def test_str_rstrip(self):
00246         """Check matches the python string rstrip method."""
00247         self._test_method("rstrip", pre_comp_function=str)
00248 
00249     def test_str_split(self):
00250         """Check matches the python string rstrip method."""
00251         #Calling (r)split should return a list of Seq-like objects, we'll
00252         #just apply str() to each of them so it matches the string method
00253         self._test_method("rstrip", pre_comp_function=lambda x : map(str,x))
00254 
00255     def test_str_rsplit(self):
00256         """Check matches the python string rstrip method."""
00257         #Calling (r)split should return a list of Seq-like objects, we'll
00258         #just apply str() to each of them so it matches the string method
00259         self._test_method("rstrip", pre_comp_function=lambda x : map(str,x))
00260 
00261     def test_str_lsplit(self):
00262         """Check matches the python string rstrip method."""
00263         #Calling (r)split should return a list of Seq-like objects, we'll
00264         #just apply str() to each of them so it matches the string method
00265         self._test_method("rstrip", pre_comp_function=lambda x : map(str,x))
00266 
00267     def test_str_length(self):
00268         """Check matches the python string __len__ method."""
00269         for example1 in self._examples:
00270             str1 = str(example1)
00271             self.assertEqual(len(example1), len(str1))
00272 
00273     def test_str_upper(self):
00274         """Check matches the python string upper method."""
00275         for example1 in self._examples:
00276             if isinstance(example1, MutableSeq) : continue
00277             str1 = str(example1)
00278             self.assertEqual(str(example1.upper()), str1.upper())
00279 
00280     def test_str_upper(self):
00281         """Check matches the python string lower method."""
00282         for example1 in self._examples:
00283             if isinstance(example1, MutableSeq) : continue
00284             str1 = str(example1)
00285             self.assertEqual(str(example1.lower()), str1.lower())
00286 
00287     def test_str_getitem(self):
00288         """Check slicing and indexing works like a string."""
00289         for example1 in self._examples:
00290             str1 = str(example1)
00291             for i in self._start_end_values:
00292                 if abs(i) < len(example1):
00293                     self.assertEqual(str(example1[i]), str1[i])
00294                 self.assertEqual(str(example1[:i]), str1[:i])
00295                 self.assertEqual(str(example1[i:]), str1[i:])
00296                 for j in self._start_end_values:
00297                     self.assertEqual(str(example1[i:j]), str1[i:j])
00298                     for step in range(-3,4):
00299                         if step == 0:
00300                             try:
00301                                 print example1[i:j:step]
00302                                 self._assert(False) #Should fail!
00303                             except ValueError:
00304                                 pass
00305                         else:
00306                             self.assertEqual(str(example1[i:j:step]), \
00307                                              str1[i:j:step])
00308 
00309     def test_tostring(self):
00310         """Check str(obj) and obj.tostring() match."""
00311         for example1 in self._examples:
00312             str1 = str(example1)
00313             self.assertEqual(example1.tostring(), str1)
00314 
00315     def test_tomutable(self):
00316         """Check obj.tomutable() method."""
00317         for example1 in self._examples:
00318             if isinstance(example1, MutableSeq) : continue
00319             mut = example1.tomutable()
00320             self.assertTrue(isinstance(mut, MutableSeq))
00321             self.assertEqual(str(mut), str(example1))
00322             self.assertEqual(mut.alphabet, example1.alphabet)
00323 
00324     def test_toseq(self):
00325         """Check obj.toseq() method."""
00326         for example1 in self._examples:
00327             try :
00328                 seq = example1.toseq()
00329             except AttributeError :
00330                 self.assertTrue(isinstance(example1, Seq))
00331                 continue
00332             self.assertTrue(isinstance(seq, Seq))
00333             self.assertEqual(str(seq), str(example1))
00334             self.assertEqual(seq.alphabet, example1.alphabet)
00335 
00336     def test_the_complement(self):
00337         """Check obj.complement() method."""
00338         mapping = ""
00339         for example1 in self._examples:
00340             if isinstance(example1, MutableSeq) : continue
00341             try :
00342                 comp = example1.complement()
00343             except ValueError, e:
00344                 self.assertEqual(str(e), "Proteins do not have complements!")
00345                 continue
00346             str1 = str(example1)
00347             #This only does the unambiguous cases
00348             if "U" in str1 or "u" in str1 \
00349             or example1.alphabet==generic_rna:
00350                 mapping = maketrans("ACGUacgu","UGCAugca")
00351             elif "T" in str1 or "t" in str1 \
00352             or example1.alphabet==generic_dna \
00353             or example1.alphabet==generic_nucleotide:
00354                 mapping = maketrans("ACGTacgt","TGCAtgca")
00355             elif "A" not in str1 and "a" not in str1:
00356                 mapping = maketrans("CGcg","GCgc")
00357             else :
00358                 #TODO - look at alphabet?
00359                 raise ValueError(example1)
00360             self.assertEqual(str1.translate(mapping), str(comp))
00361             self.assertEqual(comp.alphabet, example1.alphabet)
00362                 
00363     def test_the_reverse_complement(self):
00364         """Check obj.reverse_complement() method."""
00365         mapping = ""
00366         for example1 in self._examples:
00367             if isinstance(example1, MutableSeq) : continue
00368             try :
00369                 comp = example1.reverse_complement()
00370             except ValueError, e:
00371                 self.assertEqual(str(e), "Proteins do not have complements!")
00372                 continue
00373             str1 = str(example1)
00374             #This only does the unambiguous cases
00375             if "U" in str1 or "u" in str1 \
00376             or example1.alphabet==generic_rna:
00377                 mapping = maketrans("ACGUacgu","UGCAugca")
00378             elif "T" in str1 or "t" in str1 \
00379             or example1.alphabet==generic_dna \
00380             or example1.alphabet==generic_nucleotide:
00381                 mapping = maketrans("ACGTacgt","TGCAtgca")
00382             elif "A" not in str1 and "a" not in str1:
00383                 mapping = maketrans("CGcg","GCgc")
00384             else :
00385                 #TODO - look at alphabet?
00386                 continue
00387             self.assertEqual(str1.translate(mapping)[::-1], str(comp))
00388             self.assertEqual(comp.alphabet, example1.alphabet)
00389 
00390     def test_the_transcription(self):
00391             """Check obj.transcribe() method."""
00392             mapping = ""
00393             for example1 in self._examples:
00394                 if isinstance(example1, MutableSeq) : continue
00395                 try :
00396                     tran = example1.transcribe()
00397                 except ValueError, e:
00398                     if str(e) == "Proteins cannot be transcribed!" : continue
00399                     if str(e) == "RNA cannot be transcribed!" : continue
00400                     raise e
00401                 str1 = str(example1)
00402                 self.assertEqual(str1.replace("T","U").replace("t","u"), str(tran))
00403                 self.assertEqual(tran.alphabet, generic_rna) #based on limited examples             
00404 
00405     def test_the_back_transcription(self):
00406             """Check obj.back_transcribe() method."""
00407             mapping = ""
00408             for example1 in self._examples:
00409                 if isinstance(example1, MutableSeq) : continue
00410                 try :
00411                     tran = example1.back_transcribe()
00412                 except ValueError, e:
00413                     if str(e) == "Proteins cannot be back transcribed!" : continue
00414                     if str(e) == "DNA cannot be back transcribed!" : continue
00415                     raise e
00416                 str1 = str(example1)
00417                 self.assertEqual(str1.replace("U","T").replace("u","t"), str(tran))
00418                 self.assertEqual(tran.alphabet, generic_dna) #based on limited examples             
00419 
00420     def test_the_translate(self):
00421             """Check obj.translate() method."""
00422             mapping = ""
00423             for example1 in self._examples:
00424                 if isinstance(example1, MutableSeq) : continue
00425                 try :
00426                     tran = example1.translate()
00427                 except ValueError, e:
00428                     if str(e) == "Proteins cannot be translated!" : continue
00429                     raise e
00430                 #This is based on the limited example not having stop codons:
00431                 if tran.alphabet not in [extended_protein, protein, generic_protein]:
00432                     print tran.alphabet
00433                     self.assertTrue(False)
00434                 #TODO - check the actual translation, and all the optional args
00435 
00436     def test_the_translation_of_stops(self):
00437         """Check obj.translate() method with stop codons."""
00438         misc_stops = "TAATAGTGAAGAAGG"
00439         for nuc in [Seq(misc_stops),
00440                     Seq(misc_stops, generic_nucleotide),
00441                     Seq(misc_stops, generic_dna),
00442                     Seq(misc_stops, unambiguous_dna)]:
00443             self.assertEqual("***RR", str(nuc.translate()))
00444             self.assertEqual("***RR", str(nuc.translate(1)))
00445             self.assertEqual("***RR", str(nuc.translate("SGC0")))
00446             self.assertEqual("**W**", str(nuc.translate(table=2)))
00447             self.assertEqual("**WRR", str(nuc.translate(table='Yeast Mitochondrial')))
00448             self.assertEqual("**WSS", str(nuc.translate(table=5)))
00449             self.assertEqual("**WSS", str(nuc.translate(table=9)))
00450             self.assertEqual("**CRR", str(nuc.translate(table='Euplotid Nuclear')))
00451             self.assertEqual("***RR", str(nuc.translate(table=11)))
00452             self.assertEqual("***RR", str(nuc.translate(table='11')))
00453             self.assertEqual("***RR", str(nuc.translate(table='Bacterial')))
00454             self.assertEqual("", str(nuc.translate(to_stop=True)))
00455             self.assertEqual("O*ORR", str(nuc.translate(table=special_table)))
00456             self.assertEqual("*QWRR", str(nuc.translate(table=Chilodonella_uncinata_table)))
00457             #These test the Bio.Seq.translate() function - move these?:
00458             self.assertEqual("*QWRR", translate(str(nuc), table=Chilodonella_uncinata_table))
00459             self.assertEqual("O*ORR", translate(str(nuc), table=special_table))
00460             self.assertEqual("", translate(str(nuc), to_stop=True))
00461             self.assertEqual("***RR", translate(str(nuc), table='Bacterial'))
00462             self.assertEqual("***RR", translate(str(nuc), table='11'))
00463             self.assertEqual("***RR", translate(str(nuc), table=11))
00464             self.assertEqual("**W**", translate(str(nuc), table=2))
00465         self.assertEqual(str(Seq("TAT").translate()), "Y")
00466         self.assertEqual(str(Seq("TAR").translate()), "*")
00467         self.assertEqual(str(Seq("TAN").translate()), "X")
00468         self.assertEqual(str(Seq("NNN").translate()), "X")
00469         self.assertEqual(str(Seq("TAt").translate()), "Y")
00470         self.assertEqual(str(Seq("TaR").translate()), "*")
00471         self.assertEqual(str(Seq("TaN").translate()), "X")
00472         self.assertEqual(str(Seq("nnN").translate()), "X")
00473         self.assertEqual(str(Seq("tat").translate()), "Y")
00474         self.assertEqual(str(Seq("tar").translate()), "*")
00475         self.assertEqual(str(Seq("tan").translate()), "X")
00476         self.assertEqual(str(Seq("nnn").translate()), "X")
00477 
00478 
00479     def test_the_translation_of_invalid_codons(self):
00480         """Check obj.translate() method with invalid codons."""
00481         for codon in ["TA?", "N-N", "AC_", "Ac_"]:
00482             for nuc in [Seq(codon),
00483                         Seq(codon, generic_nucleotide),
00484                         Seq(codon, generic_dna),
00485                         Seq(codon, unambiguous_dna)]:
00486                 try :
00487                     print nuc.translate()
00488                     self.assertTrue(False, "Transating %s should fail" % codon)
00489                 except TranslationError :
00490                     pass
00491 
00492     def test_the_translation_of_ambig_codons(self):
00493         """Check obj.translate() method with ambiguous codons."""
00494         for letters, ambig_values in [(ambiguous_dna.letters, ambiguous_dna_values),
00495                                       (ambiguous_rna.letters, ambiguous_rna_values)] :
00496             ambig = set(letters)
00497             for c1 in ambig:
00498                 for c2 in ambig:
00499                     for c3 in ambig:
00500                         values = set([str(Seq(a+b+c).translate()) \
00501                                       for a in ambig_values[c1] \
00502                                       for b in ambig_values[c2] \
00503                                       for c in ambig_values[c3]])
00504                         t = str(Seq(c1+c2+c3).translate())
00505                         if t=="*":
00506                             self.assertEqual(values, set("*"))
00507                         elif t=="X":
00508                             self.assertTrue(len(values) > 1, \
00509                                 "translate('%s') = '%s' not '%s'" \
00510                                 % (c1+c2+c3, t, ",".join(values)))
00511                         elif t=="Z":
00512                             self.assertEqual(values, set("EQ"))
00513                         elif t=="B":
00514                             self.assertEqual(values, set("DN"))
00515                         elif t=="J":
00516                             self.assertEqual(values, set("LI"))
00517                         else:
00518                             self.assertEqual(values, set(t))
00519                         #TODO - Use the Bio.Data.IUPACData module for the
00520                         #ambiguous protein mappings?
00521 
00522     def test_init_typeerror(self):
00523         """Check Seq __init__ gives TypeError exceptions."""
00524         #Only expect it to take strings and unicode - not Seq objects!
00525         self.assertRaises(TypeError, Seq, (1066))
00526         self.assertRaises(TypeError, Seq, (Seq("ACGT", generic_dna)))
00527 
00528     #TODO - Addition...
00529 
00530 if __name__ == "__main__":
00531     runner = unittest.TextTestRunner(verbosity = 2)
00532     unittest.main(testRunner=runner)