Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Truncate test sequences to avoid partial codon translation warning

  • Loading branch information...
commit d204c47f03522dabe93c9293c89719ef7c4be620 1 parent 58c2d3b
@peterjc peterjc authored
Showing with 11 additions and 11 deletions.
  1. +7 −7 Tests/output/test_seq
  2. +4 −4 Tests/test_seq.py
View
14 Tests/output/test_seq
@@ -253,9 +253,9 @@ Translating
===========
Seq('TCAAAAGGATGCATCATG', IUPACUnambiguousDNA())
-> Seq('SKGCIM', IUPACProtein())
-Seq('T', IUPACAmbiguousDNA())
+Seq('', IUPACAmbiguousDNA())
-> Seq('', ExtendedIUPACProtein())
-Seq('TCAAAAGGATGCATCATGT', IUPACAmbiguousDNA())
+Seq('TCAAAAGGATGCATCATG', IUPACAmbiguousDNA())
-> Seq('SKGCIM', ExtendedIUPACProtein())
Seq('ATGAAACTG', Alphabet())
-> Seq('MKL', ExtendedIUPACProtein())
@@ -265,17 +265,17 @@ Seq('AUGAAACUG', RNAAlphabet())
-> Seq('MKL', ExtendedIUPACProtein())
Seq('ATGAAACTG', IUPACUnambiguousDNA())
-> Seq('MKL', IUPACProtein())
-Seq('ATGAAA-CTG', Gapped(IUPACUnambiguousDNA(), '-'))
+Seq('ATGAAA-CT', Gapped(IUPACUnambiguousDNA(), '-'))
-> Codon '-CT' is invalid
-Seq('ATGAAACTGWN', IUPACAmbiguousDNA())
+Seq('ATGAAACTG', IUPACAmbiguousDNA())
-> Seq('MKL', ExtendedIUPACProtein())
Seq('AUGAAACUG', RNAAlphabet())
-> Seq('MKL', ExtendedIUPACProtein())
-Seq('AUGAAA==CUG', Gapped(RNAAlphabet(), '='))
+Seq('AUGAAA==C', Gapped(RNAAlphabet(), '='))
-> Codon '==C' is invalid
Seq('AUGAAACUG', IUPACUnambiguousRNA())
-> Seq('MKL', IUPACProtein())
-Seq('AUGAAACUGWN', IUPACAmbiguousRNA())
+Seq('AUGAAACUG', IUPACAmbiguousRNA())
-> Seq('MKL', ExtendedIUPACProtein())
Seq('ATGAAACTG', NucleotideAlphabet())
-> Seq('MKL', ExtendedIUPACProtein())
@@ -285,7 +285,7 @@ MutableSeq('ATGAAACTG', DNAAlphabet())
-> Seq('MKL', ExtendedIUPACProtein())
MutableSeq('AUGaaaCUG', IUPACUnambiguousRNA())
-> Seq('MKL', IUPACProtein())
-Seq('ACTGTCGTCT', ProteinAlphabet())
+Seq('ACTGTCGTC', ProteinAlphabet())
-> Proteins cannot be translated!
Seq's .complement() method
View
8 Tests/test_seq.py
@@ -484,14 +484,14 @@ def sorted_dict(d):
print "Translating"
print "==========="
for nucleotide_seq in test_seqs:
+ #Truncate to a whole number of codons to avoid translation warning
+ nucleotide_seq = nucleotide_seq[:3 * (len(nucleotide_seq) // 3)]
try:
expected = Seq.translate(nucleotide_seq)
- print "%s\n-> %s" \
- % (repr(nucleotide_seq) , repr(expected))
+ print "%s\n-> %s" % (repr(nucleotide_seq), repr(expected))
except (ValueError, TranslationError), e:
expected = None
- print "%s\n-> %s" \
- % (repr(nucleotide_seq) , str(e))
+ print "%s\n-> %s" % (repr(nucleotide_seq), str(e))
#Now test the Seq object's method
if isinstance(nucleotide_seq, Seq.Seq):
try:
Please sign in to comment.
Something went wrong with that request. Please try again.