Exemple #1
0
 def test_fix_edge(self):
     """Test the 'edge' bias correction calculations."""
     # With no gap, gain and loss should balance out
     # 1. Wide target, no secondary corrections triggered
     insert_size = 250
     gap_size = np.zeros(1)  # Adjacent
     target_size = np.asarray([600])
     loss = fix.edge_losses(target_size, insert_size)
     gain = fix.edge_gains(target_size, gap_size, insert_size)
     gain *= 2  # Same on the other side
     self.assertAlmostEqual(loss, gain)
     # 2. Trigger 'loss' correction (target_size < 2 * insert_size)
     target_size = np.asarray([450])
     self.assertAlmostEqual(fix.edge_losses(target_size, insert_size),
                     2 * fix.edge_gains(target_size, gap_size, insert_size))
     # 3. Trigger 'gain' correction (target_size + gap_size < insert_size)
     target_size = np.asarray([300])
     self.assertAlmostEqual(fix.edge_losses(target_size, insert_size),
                     2 * fix.edge_gains(target_size, gap_size, insert_size))
Exemple #2
0
 def test_fix_edge(self):
     """Test the 'edge' bias correction calculations."""
     # With no gap, gain and loss should balance out
     # 1. Wide target, no secondary corrections triggered
     insert_size = 250
     gap_size = np.zeros(1)  # Adjacent
     target_size = np.asarray([600])
     loss = fix.edge_losses(target_size, insert_size)
     gain = fix.edge_gains(target_size, gap_size, insert_size)
     gain *= 2  # Same on the other side
     self.assertAlmostEqual(loss, gain)
     # 2. Trigger 'loss' correction (target_size < 2 * insert_size)
     target_size = np.asarray([450])
     self.assertAlmostEqual(fix.edge_losses(target_size, insert_size),
                     2 * fix.edge_gains(target_size, gap_size, insert_size))
     # 3. Trigger 'gain' correction (target_size + gap_size < insert_size)
     target_size = np.asarray([300])
     self.assertAlmostEqual(fix.edge_losses(target_size, insert_size),
                     2 * fix.edge_gains(target_size, gap_size, insert_size))