Did I find the right examples for you? yes no

All Samples(32)  |  Call(28)  |  Derive(0)  |  Import(4)

src/c/o/cogent-1.5.3/cogent/core/sequence.py   cogent(Download)
from __future__ import division
from annotation import Map, Feature, _Annotatable
from cogent.util.transform import keep_chars, for_seq, per_shortest, \
    per_longest
from cogent.util.misc import DistanceFromMatrix
 
#standard distance functions: left  because generally useful
frac_same = for_seq(f=eq, aggregator=sum, normalizer=per_shortest)
frac_diff = for_seq(f=ne, aggregator=sum, normalizer=per_shortest)
 

src/p/y/pycogent-HEAD/cogent/core/sequence.py   pycogent(Download)
from __future__ import division
from annotation import Map, Feature, _Annotatable
from cogent.util.transform import keep_chars, for_seq, per_shortest, \
    per_longest
from cogent.util.misc import DistanceFromMatrix
 
#standard distance functions: left  because generally useful
frac_same = for_seq(f=eq, aggregator=sum, normalizer=per_shortest)
frac_diff = for_seq(f=ne, aggregator=sum, normalizer=per_shortest)
 

src/c/o/cogent-1.5.3/tests/test_util/test_transform.py   cogent(Download)
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import identity
from cogent.util.transform import apply_each, bools, bool_each, \
    conjoin, all, both,\
    disjoin, any, either, negate, none, neither, compose, compose_many, \
 
        #test behavior with default aggregator and normalizer
        f = for_seq(is_eq)
        self.assertFloatEqual(f(s1, s1), 1.0)
        self.assertFloatEqual(f(s1, short), 1.0)
        self.assertFloatEqual(f(s1,s2), 0.6)
 
        f = for_seq(is_ne)
        self.assertFloatEqual(f(s1, s1), 0.0)
        self.assertFloatEqual(f(s1, short), 0.0)
        self.assertFloatEqual(f(s1, s2), 0.4)
 
        f = for_seq(lt_5)
        self.assertFloatEqual(f(s3,s3), 1.0)
        self.assertFloatEqual(f(s3,s4), 0.0)
        self.assertFloatEqual(f(s2,s3), 0.6)
 
        f = for_seq(diff)

src/p/y/pycogent-HEAD/tests/test_util/test_transform.py   pycogent(Download)
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import identity
from cogent.util.transform import apply_each, bools, bool_each, \
    conjoin, all, both,\
    disjoin, any, either, negate, none, neither, compose, compose_many, \
 
        #test behavior with default aggregator and normalizer
        f = for_seq(is_eq)
        self.assertFloatEqual(f(s1, s1), 1.0)
        self.assertFloatEqual(f(s1, short), 1.0)
        self.assertFloatEqual(f(s1,s2), 0.6)
 
        f = for_seq(is_ne)
        self.assertFloatEqual(f(s1, s1), 0.0)
        self.assertFloatEqual(f(s1, short), 0.0)
        self.assertFloatEqual(f(s1, s2), 0.4)
 
        f = for_seq(lt_5)
        self.assertFloatEqual(f(s3,s3), 1.0)
        self.assertFloatEqual(f(s3,s4), 0.0)
        self.assertFloatEqual(f(s2,s3), 0.6)
 
        f = for_seq(diff)