示例#1
0
    def test_raise_on_empty_seq(self):
        from multicov.alignment import Alignment
        from multicov.alphabet import protein_alphabet
        from multicov.filtering import search
        align = Alignment(['IVGGYTCQ', '-VGGTEAQ', 'IGG-KDT-'],
                          alphabet=protein_alphabet)

        with self.assertRaises(ValueError):
            search(align, '')
示例#2
0
    def test_move_to_top(self):
        from multicov.alignment import Alignment
        from multicov.alphabet import protein_alphabet
        from multicov.filtering import search
        align = Alignment(['IVGGYTCQ', '-VGGTEAQ', 'IGG-KDT-'],
                          alphabet=protein_alphabet)

        search(align, ['I', 'G', 'G', 'K', 'D', 'T'], move_to_top=True)
        self.assertTrue(
            np.array_equal(
                align.data,
                np.asmatrix([['I', 'G', 'G', '-', 'K', 'D', 'T', '-'],
                             ['-', 'V', 'G', 'G', 'T', 'E', 'A', 'Q'],
                             ['I', 'V', 'G', 'G', 'Y', 'T', 'C', 'Q']])))
示例#3
0
    def test_search_dna(self):
        from multicov.alignment import Alignment
        from multicov.alphabet import dna_alphabet
        from multicov.filtering import search
        align = Alignment(['ATACAT', 'GATACA', 'AA--GG'], dna_alphabet)

        self.assertEqual(search(align, 'AAGG'), 2)
示例#4
0
    def test_search_approx(self):
        from multicov.alignment import Alignment
        from multicov.alphabet import protein_alphabet
        from multicov.filtering import search
        align = Alignment(['IVGGYTCQ', '-VGGTEAQ', 'IGG-KDT-'],
                          alphabet=protein_alphabet)

        self.assertEqual(search(align, 'IGGYTCQ'), 0)
示例#5
0
    def test_search_list(self):
        from multicov.alignment import Alignment
        from multicov.alphabet import protein_alphabet
        from multicov.filtering import search
        align = Alignment(['IVGGYTCQ', '-VGGTEAQ', 'IGG-KDT-'],
                          alphabet=protein_alphabet)

        self.assertEqual(search(align, ['I', 'G', 'G', 'K', 'D', 'T']), 2)
示例#6
0
    def test_move_to_top_but_return_old_idx(self):
        from multicov.alignment import Alignment
        from multicov.alphabet import protein_alphabet
        from multicov.filtering import search
        align = Alignment(['IVGGYTCQ', '-VGGTEAQ', 'IGG-KDT-'],
                          alphabet=protein_alphabet)

        self.assertEqual(
            search(align, ['I', 'G', 'G', 'K', 'D', 'T'], move_to_top=True), 2)
示例#7
0
    def test_raise_on_empty_align(self):
        from multicov.alignment import Alignment
        from multicov.filtering import search

        with self.assertRaises(ValueError):
            search(Alignment(), 'ABC')