예제 #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')