Did I find the right examples for you? yes no

All Samples(14)  |  Call(12)  |  Derive(0)  |  Import(2)

src/c/o/cogent-1.5.3/tests/test_core/test_alphabet.py   cogent(Download)
Note: individual Alphabets are typically in MolType and are tested there.
"""
from cogent.core.alphabet import Enumeration, get_array_type, \
    uint8, uint16, uint32, array, JointEnumeration, CharAlphabet, \
    _make_translation_tables, _make_complement_array
    def test_counts(self):
        """Enumeration counts should count freqs in array"""
        a = DnaBases
        f = array([[0,0,1,0,0,3]])
        self.assertEqual(a.counts(f), array([4,1,0,1]))
        #check that it works with byte array
        f = array([[0,0,1,0,0,3]], 'B')
        h2 = array(h).astype('B')
        self.assertEqual(a.counts(h2), array([70000,0,0,70000]))
        i = array([0,3] * 75000)
        self.assertEqual(a.counts(i), array([75000,0,0,75000]))
        #make sure it works for long _binary_ sequences, e.g. the results
        #of array comparisons.
        a = array([0,1,2,3]*10000)

src/p/y/pycogent-HEAD/tests/test_core/test_alphabet.py   pycogent(Download)
Note: individual Alphabets are typically in MolType and are tested there.
"""
from cogent.core.alphabet import Enumeration, get_array_type, \
    uint8, uint16, uint32, array, JointEnumeration, CharAlphabet, \
    _make_translation_tables, _make_complement_array
    def test_counts(self):
        """Enumeration counts should count freqs in array"""
        a = DnaBases
        f = array([[0,0,1,0,0,3]])
        self.assertEqual(a.counts(f), array([4,1,0,1]))
        #check that it works with byte array
        f = array([[0,0,1,0,0,3]], 'B')
        h2 = array(h).astype('B')
        self.assertEqual(a.counts(h2), array([70000,0,0,70000]))
        i = array([0,3] * 75000)
        self.assertEqual(a.counts(i), array([75000,0,0,75000]))
        #make sure it works for long _binary_ sequences, e.g. the results
        #of array comparisons.
        a = array([0,1,2,3]*10000)