예제 #1
0
 def test_init(self):
     """PC: init functions as expected """
     # instantiate the class
     pc = PerformanceCalculator(self._gold_standard_data)
     # Check one of the values
     self.assertEqual(\
         pc._gold_standard['12206666'][PointMutation(95,'D','N')],2)
예제 #2
0
 def test_normalized_mutations_blank_gs(self):
     """PC: Normalized Mutations functions with no gold standard mutations
     """
     # Functions with an empty gold standard dict
     pc = PerformanceCalculator(self._blank_mutation_data)
     perf = pc.calculate_normalized_mutations(\
         self._gold_standard_data)
     self.assertEqual(perf.TruePositive,0)
     self.assertEqual(perf.FalsePositive,6)
     self.assertEqual(perf.FalseNegative,0)
     self.assertEqual(perf.TrueNegative,None)
예제 #3
0
 def test_document_retrieval_blank_gs(self):
     """PC: Document Retrieval functions with no gold standard mutations
     """
     # Functions with an empty gold standard dict
     pc = PerformanceCalculator(self._blank_mutation_data)
     perf = pc.calculate_document_retrieval(\
         self._gold_standard_data)
     self.assertEqual(perf.TruePositive,0)
     self.assertEqual(perf.FalsePositive,3)
     self.assertEqual(perf.FalseNegative,0)
     self.assertEqual(perf.TrueNegative,1)
예제 #4
0
 def test_normalized_mutations_invalid_input(self):
     """PC: Normalized Mutations handles invalid input correctly
     """
     # Handles gold-standard and extractor output which does
     # not completely overlap correctly -- this is explictly 
     # not allowed because it is not clear how it should be
     # handled
     pc = PerformanceCalculator({'1':{},'2':{}})
     self.assertRaises(PerformanceCalculatorError,\
         pc.calculate_normalized_mutations,{'1':{},'3':{}})
     self.assertRaises(PerformanceCalculatorError,\
         pc.calculate_normalized_mutations,{'1':{}})
     self.assertRaises(PerformanceCalculatorError,\
         pc.calculate_normalized_mutations,{'1':{},'2':{},'3':{}})
예제 #5
0
 def setUp(self):
     """ Set up variables for the tests""" 
     self._gold_standard_data = gold_standard_data
     self._blank_mutation_data =\
         {'3476160':{},'14500716':{},'12206666':{},'11327835':{}} 
     self._pc = PerformanceCalculator(self._gold_standard_data)