def test_compute_prf_default(self): """ p, r and f are computed correctly when defaulting to first sample ids""" # default of comparing first sample in each table actual = compute_prf(self.table1,self.table2) expected = (2./3., 1.0, 0.8) self.assertEqual(actual,expected) # default of comparing first sample in each table actual = compute_prf(self.table2,self.table1) expected = (1.0, 2./3., 0.8) self.assertEqual(actual,expected)
def test_compute_prf_alt_sample_ids(self): """ p, r and f are computed correctly when using alternative sample ids""" # alt sample in table 1 actual = compute_prf(self.table1,self.table2,actual_sample_id='s2') expected = (1.0, 1.0, 1.0) self.assertEqual(actual,expected) # alt sample in table 2 actual = compute_prf(self.table1,self.table2,expected_sample_id='s4') expected = (1./3., 1.0, 0.5) self.assertEqual(actual,expected) # alt sample in tables 1 & 2 actual = compute_prf(self.table1,self.table2, actual_sample_id='s2',expected_sample_id='s4') expected = (0.5, 1.0, 2./3.) self.assertEqual(actual,expected)