Пример #1
0
    def test_merge(self):
        counts_left = utils.counts(utils.SEQUENCES_LEFT, 8)
        counts_right = utils.counts(utils.SEQUENCES_RIGHT, 8)
        filename = self.empty()

        with utils.open_profile(self.profile(counts_left, 8)) as handle_left:
            with utils.open_profile(self.profile(counts_right, 8)) as handle_right:
                with utils.open_profile(filename, 'w') as profile_handle:
                    kmer.merge(handle_left, handle_right, profile_handle)
        utils.test_profile_file(filename, counts_left + counts_right, 8)
Пример #2
0
    def test_merge(self):
        counts_left = utils.counts(utils.SEQUENCES_LEFT, 8)
        counts_right = utils.counts(utils.SEQUENCES_RIGHT, 8)
        filename = self.empty()

        with utils.open_profile(self.profile(counts_left, 8)) as handle_left:
            with utils.open_profile(self.profile(counts_right, 8)) as handle_right:
                with utils.open_profile(filename, 'w') as profile_handle:
                    kmer.merge(handle_left, handle_right, profile_handle)
        utils.test_profile_file(filename, counts_left + counts_right, 8)
Пример #3
0
    def test_merge_custom_name(self):
        counts_left = utils.counts(utils.SEQUENCES_LEFT, 8)
        counts_right = utils.counts(utils.SEQUENCES_RIGHT, 8)
        filename = self.empty()

        with utils.open_profile(self.profile(counts_left, 8)) as handle_left:
            with utils.open_profile(self.profile(counts_right, 8)) as handle_right:
                with utils.open_profile(filename, 'w') as profile_handle:
                    kmer.merge(handle_left, handle_right, profile_handle, custom_merger='numpy.multiply')

        counts_mult = Counter(dict((s, counts_left[s] * counts_right[s])
                                   for s in set(counts_left) & set(counts_right)))

        utils.test_profile_file(filename, counts_mult, 8)
Пример #4
0
    def test_merge_custom_name(self):
        counts_left = utils.counts(utils.SEQUENCES_LEFT, 8)
        counts_right = utils.counts(utils.SEQUENCES_RIGHT, 8)
        filename = self.empty()

        with utils.open_profile(self.profile(counts_left, 8)) as handle_left:
            with utils.open_profile(self.profile(counts_right, 8)) as handle_right:
                with utils.open_profile(filename, 'w') as profile_handle:
                    kmer.merge(handle_left, handle_right, profile_handle, custom_merger='numpy.multiply')

        counts_mult = Counter(dict((s, counts_left[s] * counts_right[s])
                                   for s in set(counts_left) & set(counts_right)))

        utils.test_profile_file(filename, counts_mult, 8)
Пример #5
0
    def test_merge_custom_expr(self):
        counts_left = utils.counts(utils.SEQUENCES_LEFT, 8)
        counts_right = utils.counts(utils.SEQUENCES_RIGHT, 8)
        filename = self.empty()

        with utils.open_profile(self.profile(counts_left, 8)) as handle_left:
            with utils.open_profile(self.profile(counts_right, 8)) as handle_right:
                with utils.open_profile(filename, 'w') as profile_handle:
                    kmer.merge(handle_left, handle_right, profile_handle, custom_merger='(left + right) * np.logical_xor(left, right)')

        counts_xor = counts_left + counts_right
        for s in set(counts_left) & set(counts_right):
            del counts_xor[s]

        utils.test_profile_file(filename, counts_xor, 8)
Пример #6
0
    def test_merge_custom_expr(self):
        counts_left = utils.counts(utils.SEQUENCES_LEFT, 8)
        counts_right = utils.counts(utils.SEQUENCES_RIGHT, 8)
        filename = self.empty()

        with utils.open_profile(self.profile(counts_left, 8)) as handle_left:
            with utils.open_profile(self.profile(counts_right, 8)) as handle_right:
                with utils.open_profile(filename, 'w') as profile_handle:
                    kmer.merge(handle_left, handle_right, profile_handle, custom_merger='(left + right) * np.logical_xor(left, right)')

        counts_xor = counts_left + counts_right
        for s in set(counts_left) & set(counts_right):
            del counts_xor[s]

        utils.test_profile_file(filename, counts_xor, 8)