Пример #1
0
 def testHighestFrequencyUnambiguous(self):
     """
     If one unambiguous code passed to FloatBaseCounts is most frequent, the
     highestFrequency method must give the expected result.
     """
     counts = FloatBaseCounts('AAACCTGG')
     self.assertEqual(0.375, counts.highestFrequency())
Пример #2
0
 def testOneUnambiguousOneAmbiguousVariable(self):
     """
     If one unambiguous code and one incompatible ambiguous code are passed
     to FloatBaseCounts, they must be considered confirm variable.
     """
     counts = FloatBaseCounts('AS')
     self.assertTrue(counts.variable(confirm=True))
Пример #3
0
 def testMostFrequentWithTwoAmbiguousStr(self):
     """
     If two overlapping ambiguous codes are passed to FloatBaseCounts, the
     mostFrequent method must give the expected result.
     """
     counts = FloatBaseCounts('MR')
     self.assertEqual({'A'}, counts.mostFrequent())
Пример #4
0
 def testMostFrequentUnambiguous(self):
     """
     If one unambiguous code passed to FloatBaseCounts is most frequent, the
     mostFrequent method must give the expected result.
     """
     counts = FloatBaseCounts('AAACCTGG')
     self.assertEqual({'A'}, counts.mostFrequent())
Пример #5
0
 def testEquallyFrequent(self):
     """
     If two codes are passed to FloatBaseCounts in equal numbers, the
     mostFrequent method must give the expected result.
     """
     counts = FloatBaseCounts('AAACCCTGG')
     self.assertEqual(set('AC'), counts.mostFrequent())
Пример #6
0
 def testHighestFrequencyWithTwoAmbiguousStr(self):
     """
     If two overlapping ambiguous codes are passed to FloatBaseCounts, the
     highestFrequency method must give the expected result.
     """
     counts = FloatBaseCounts('MR')
     self.assertEqual(0.5, counts.highestFrequency())
Пример #7
0
 def testTwoIdenticalUnambiguoussVariable(self):
     """
     If an unambiguous code is passed to FloatBaseCounts twice, they must be
     considered non-variable.
     """
     counts = FloatBaseCounts('AA')
     self.assertFalse(counts.variable())
Пример #8
0
 def testTwoDifferentUnambiguoussVariable(self):
     """
     If two different unambiguous codes are passed to FloatBaseCounts,
     they must be considered variable.
     """
     counts = FloatBaseCounts('AT')
     self.assertTrue(counts.variable())
Пример #9
0
 def testOneGapVariableConfirm(self):
     """
     If one gap and one unambiguous code are passed to FloatBaseCounts,
     they must be considered variable if confirm is True.
     """
     counts = FloatBaseCounts('A-')
     self.assertTrue(counts.variable(confirm=True))
Пример #10
0
 def testEqualFrequency(self):
     """
     If two codes are passed to FloatBaseCounts in equal numbers, the
     highestFrequency method must give the expected result.
     """
     counts = FloatBaseCounts('AAAACCCTGG')
     self.assertEqual(0.4, counts.highestFrequency())
Пример #11
0
 def testOneUnambiguousOneAmbiguousVariableUnconfirm(self):
     """
     If one unambiguous code and one compatible ambiguous code are passed
     to FloatBaseCounts, they must be considered variable if confirm
     is False.
     """
     counts = FloatBaseCounts('AM')
     self.assertTrue(counts.variable(confirm=False))
Пример #12
0
 def testOneUnambiguousOneAmbiguousNonVariable(self):
     """
     If one unambiguous code and one compatible ambiguous code are passed
     to FloatBaseCounts, they must not be considered confirm variable
     if confirm is True.
     """
     counts = FloatBaseCounts('AM')
     self.assertFalse(counts.variable(confirm=True))
Пример #13
0
 def testTwoAmbiguousVariableConfirmTrue(self):
     """
     If two compatible but different ambiguous codes are passed to
     FloatBaseCounts, they must not be considered variable if
     confirm is True.
     """
     counts = FloatBaseCounts('MR')
     self.assertFalse(counts.variable(confirm=True))
Пример #14
0
 def testOneAmbiguousHomogeneousM(self):
     """
     If one ambiguous code (M = A, C) is passed to FloatBaseCounts, it must
     be considered homogeneous correctly, depending on the passed level.
     """
     counts = FloatBaseCounts('M')
     self.assertFalse(counts.homogeneous(1.0))
     self.assertFalse(counts.homogeneous(0.75))
     self.assertTrue(counts.homogeneous(0.0))
Пример #15
0
 def testTwoIdenticalUnambiguoussHomogeneous(self):
     """
     If an unambiguous code is passed to FloatBaseCounts twice, they must be
     considered homogeneous correctly, depending on the passed level.
     """
     counts = FloatBaseCounts('AA')
     self.assertTrue(counts.homogeneous(1.0))
     self.assertTrue(counts.homogeneous(0.75))
     self.assertTrue(counts.homogeneous(0.0))
Пример #16
0
 def testTwoDifferentUnambiguoussHomogeneous(self):
     """
     If two different unambiguous codes are passed to FloatBaseCounts,
     they must be considered homogeneous correctly, depending on the passed
     level.
     """
     counts = FloatBaseCounts('AG')
     self.assertFalse(counts.homogeneous(1.0))
     self.assertTrue(counts.homogeneous(0.5))
     self.assertTrue(counts.homogeneous(0.2))
Пример #17
0
 def testTwoAmbiguousStr(self):
     """
     If two compatible but different ambiguous codes are passed to
     FloatBaseCounts, they must be converted into a string correctly.
     """
     counts = FloatBaseCounts('MR')
     self.assertEqual('A:1.00 C:0.50 G:0.50 (0.500)', str(counts))
Пример #18
0
 def testLength3Ambiguous(self):
     """
     If overlapping ambiguous codes are passed to FloatBaseCounts, the
     length must give the expected result.
     """
     counts = FloatBaseCounts('MRC')
     self.assertEqual(3, len(counts))
Пример #19
0
 def testLength4Unambiguous(self):
     """
     If all unambiguous bases are given to FloatBaseCounts, its length
     must be 4.
     """
     counts = FloatBaseCounts('AAAACCCTGG')
     self.assertEqual(4, len(counts))
Пример #20
0
 def testMixedCase(self):
     """
     If two 2-way ambiguous codes are passed to FloatBaseCounts in mixed
     case, they must be converted into a string correctly.
     """
     counts = FloatBaseCounts('mM')
     self.assertEqual('A:1 C:1 (0.500)', str(counts))
Пример #21
0
 def testTwoAmbiguousStrWithIntegerTotals(self):
     """
     If two 2-way ambiguous codes are passed to
     FloatBaseCounts, they must be converted into a string correctly
     (i.e., with integer counts).
     """
     counts = FloatBaseCounts('MMA')
     self.assertEqual('A:2 C:1 (0.667)', str(counts))