def test_feature_downstream_from_peak_neg_strand(self): peak = Peak('chr1', '450', '550') feature = Feature('NM1', 'chr1', '250', '400', '-') self.assertEqual(direction(peak, feature), DOWNSTREAM)
def test_feature_upstream_from_peak_neg_strand_partial_overlap(self): peak = Peak('chr1', '100', '300') feature = Feature('NM1', 'chr1', '250', '400', '-') self.assertEqual(direction(peak, feature), UPSTREAM)
def test_feature_downstream_from_peak_partial_overlap(self): peak = Peak('chr1', '100', '300') feature = Feature('NM1', 'chr1', '250', '400', '+') self.assertEqual(direction(peak, feature), DOWNSTREAM)
def test_feature_full_overlap_peak(self): peak = Peak('chr1', '200', '450') feature = Feature('NM1', 'chr1', '250', '400', '+') self.assertEqual(direction(peak, feature), OVERLAP)
def test_peak_full_overlap_feature_neg_strand(self): peak = Peak('chr1', '200', '450') feature = Feature('NM1', 'chr1', '250', '400', '-') self.assertEqual(direction(feature, peak), OVERLAP)
def test_feature_upstream_from_peak(self): peak = Peak('chr1', '450', '550') feature = Feature('NM1', 'chr1', '250', '400', '+') self.assertEqual(direction(peak, feature), UPSTREAM)
def test_peak_upstream_from_feature_neg_strand(self): peak = Peak('chr1', '100', '200') feature = Feature('NM1', 'chr1', '250', '400', '-') self.assertEqual(direction(feature, peak), DOWNSTREAM)
def test_peak_downstream_from_feature_neg_strand_partial_overlap(self): peak = Peak('chr1', '350', '550') feature = Feature('NM1', 'chr1', '250', '400', '-') self.assertEqual(direction(feature, peak), UPSTREAM)
def test_peak_downstream_from_feature(self): peak = Peak('chr1', '450', '550') feature = Feature('NM1', 'chr1', '250', '400', '+') self.assertEqual(direction(feature, peak), DOWNSTREAM)
def test_peak_upstream_from_feature_partial_overlap(self): peak = Peak('chr1', '100', '300') feature = Feature('NM1', 'chr1', '250', '400', '+') self.assertEqual(direction(feature, peak), UPSTREAM)
def test_distances_feature_contains_peak(self): self.assertEqual( edge_distances(Peak('chr1', '250', '350'), Feature('NM6', 'chr1', '100', '400', '+')), (0, 0))
def test_distances_feature_overlaps_peak_start(self): self.assertEqual( edge_distances(Peak('chr1', '250', '350'), Feature('NM4', 'chr1', '300', '400', '+')), (0, 50))
def test_distances_feature_before_peak(self): self.assertEqual( edge_distances(Peak('chr1', '250', '400'), Feature('NM2', 'chr1', '100', '200', '+')), (50, 150))
def test__eq__(self): self.assertEqual(Peak('chr2L', '66811', '66812'), Peak('chr2L', '66811', '66812')) self.assertNotEqual(Peak('chr2L', '66811', '66812'), Peak('chr2L', '249177', '605951'))
def test_get_item(self): peaks = PeakSet('ChIP_peaks-ex1.txt') peak = peaks[2] self.assertEqual(peak, Peak('chr3L', '12139192', '12139193'))