Did I find the right examples for you? yes no

# cogent.util.transform.for_seq

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

```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)

```

```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)

```

```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)
```

```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)
```