Пример #1
0
 def test_which(self):
     tests = ( 
         (seq_io.read(testdata_stream('cap.fa')), unambiguous_dna_alphabet),
         (seq_io.read(testdata_stream('cox2.msf')), unambiguous_protein_alphabet),
         (seq_io.read(testdata_stream('Rv3829c.fasta')), unambiguous_protein_alphabet),
     )
     for t in tests :
         self.failUnlessEqual(which_alphabet(t[0]), t[1])
Пример #2
0
 def test_which_alphabet(self):
     a = Alphabet.which(Seq("ARNDCQEGHILKMFPSTWYVX"))
     assert  a == unambiguous_protein_alphabet
     
     tests = ( 
          (seq_io.read(testdata_stream('cap.fa')), unambiguous_dna_alphabet),
          (seq_io.read(testdata_stream('cox2.msf')), unambiguous_protein_alphabet),
          (seq_io.read(testdata_stream('Rv3829c.fasta')), unambiguous_protein_alphabet),
          (seq_io.read(testdata_stream('chain_B.fasta')), unambiguous_protein_alphabet),
          )
     for t in tests :
         self.failUnlessEqual(Alphabet.which(t[0]), t[1])
Пример #3
0
    def test_which_alphabet(self):
        a = Alphabet.which(Seq("ARNDCQEGHILKMFPSTWYVX"))
        assert a == unambiguous_protein_alphabet

        tests = (
            (seq_io.read(testdata_stream('cap.fa')), unambiguous_dna_alphabet),
            (seq_io.read(testdata_stream('cox2.msf')),
             unambiguous_protein_alphabet),
            (seq_io.read(testdata_stream('Rv3829c.fasta')),
             unambiguous_protein_alphabet),
        )
        for t in tests:
            self.failUnlessEqual(Alphabet.which(t[0]), t[1])
Пример #4
0
    def test_which_alphabet(self):
        a = Alphabet.which(Seq("ARNDCQEGHILKMFPSTWYVX"))
        assert  a == unambiguous_protein_alphabet
        
        f1=testdata_stream('cap.fa')
        f2=testdata_stream('cox2.msf')
        f3=testdata_stream('Rv3829c.fasta')
        f4=testdata_stream('chain_B.fasta')
        
        tests = ( 
             (seq_io.read(f1), unambiguous_dna_alphabet),
             (seq_io.read(f2), unambiguous_protein_alphabet),
             (seq_io.read(f3), unambiguous_protein_alphabet),
             (seq_io.read(f4), unambiguous_protein_alphabet),
             )
        for t in tests :
            self.assertEqual(Alphabet.which(t[0]), t[1])

        f1.close()
        f2.close()
        f3.close()
        f4.close()
Пример #5
0
    def test_which_alphabet(self):
        a = Alphabet.which(Seq("ARNDCQEGHILKMFPSTWYVX"))
        assert a == unambiguous_protein_alphabet

        f1 = testdata_stream('cap.fa')
        f2 = testdata_stream('cox2.msf')
        f3 = testdata_stream('Rv3829c.fasta')
        f4 = testdata_stream('chain_B.fasta')

        tests = (
            (seq_io.read(f1), unambiguous_dna_alphabet),
            (seq_io.read(f2), unambiguous_protein_alphabet),
            (seq_io.read(f3), unambiguous_protein_alphabet),
            (seq_io.read(f4), unambiguous_protein_alphabet),
        )
        for t in tests:
            self.assertEqual(Alphabet.which(t[0]), t[1])

        f1.close()
        f2.close()
        f3.close()
        f4.close()
Пример #6
0
    def test_read(self):
        f = testdata_stream("genbank/cox2.gb")
        seqs = genbank_io.read(f)

        self.assertEqual(len(seqs), 5)
        self.assertEqual(len(seqs[1]), 210)

        f.seek(0)
        seqs = seq_io.read(f)
        self.assertEqual(len(seqs), 5)
        self.assertEqual(len(seqs[1]), 210)
        f.close()

        f = testdata_stream('genbank/NT_019265.gb')
        seqs = genbank_io.read(f)
        self.assertEqual(len(seqs), 0)
        f.close()