Example #1
0
    def test_symmetric(self):
        # query[i] always matches target[i] so x[i] will be at least one
        x = search.count_tanimoto_hits_arena(fps, fps, 0.6)

        # This only processes the upper-triangle, and not the diagonal
        y = search.count_tanimoto_hits_symmetric(fps, 0.6)

        self.assertEquals(len(x), len(y))
        for i in range(len(x)):
            self.assertEquals(x[i] - 1, y[i])
    def test_symmetric(self):
        # query[i] always matches target[i] so x[i] will be at least one
        x = search.count_tanimoto_hits_arena(fps, fps, 0.6)

        # This only processes the upper-triangle, and not the diagonal
        y = search.count_tanimoto_hits_symmetric(fps, 0.6)

        self.assertEquals(len(x), len(y))
        for i in range(len(x)):
            self.assertEquals(x[i]-1, y[i])
Example #3
0
    def count_tanimoto_hits_arena(self, queries, threshold=0.7):
        """Count the fingerprints which are similar enough to each query fingerprint

        DEPRECATED: Use `chemfp.search.count_tanimoto_hits_arena`_ or
        `chemfp.search.count_tanimoto_hits_symmetric`_ instead.
        
        Returns an iterator containing the (query_id, count) for each
        fingerprint in `queries`, where `query_id` is the query
        fingerprint id and `count` is the number of fingerprints found
        which are at least `threshold` similar to the query.

        The order of results is the same as the order of the
        queries. For efficiency reasons, `arena_size` queries are
        processed at a time.
        
        :param queries: query fingerprints
        :type query_fp: FingerprintArena or FPSReader (must implement iter_arenas())
        :param threshold: minimum similarity threshold (default: 0.7)
        :type threshold: float between 0.0 and 1.0, inclusive
        :param arena_size: number of queries to process at a time (default: 100)
        :type arena_size: positive integer
        :returns: list of (query_id, integer count) pairs, one for each query
        """
        return search.count_tanimoto_hits_arena(queries, self, threshold)