示例#1
0
    def test_clipping_always_greater_or_equal_than_0(self):
        regions = Regions(pd.DataFrame({'chromosome' : ['chr1'], 'start': [5], 'end': [7]}))

        clipped_df = regions.clip_to_resolution(20)

        self.assertEquals('chr1', clipped_df.ix[0]['chromosome'])
        self.assertEquals(0, clipped_df.ix[0]['start'])
        self.assertEquals(20, clipped_df.ix[0]['end'])
示例#2
0
    def test_clipping_keeps_the_same_class(self):

        regions = Regions(
            pd.DataFrame({
                'chromosome': ['chr1', 'chr10'],
                'start': [100, 200],
                'end': [117, 220]
            }))
        clipped_regions = regions.clip_to_resolution(5)
        self.assertTrue(isinstance(clipped_regions, Regions))
示例#3
0
    def test_clipping_when_only_one_bin_present(self):
        regions = Regions(pd.DataFrame( {'chromosome' : ['chr1', 'chr10'], 'start' : [100, 200], 'end' : [117, 220]} ))

        clipped_df = regions.clip_to_resolution(20)

        self.assertEquals('chr1', clipped_df.ix[0]['chromosome'])
        self.assertEquals(99, clipped_df.ix[0]['start'])
        self.assertEquals(119, clipped_df.ix[0]['end'])

        self.assertEquals('chr10', clipped_df.ix[1]['chromosome'])
        self.assertEquals(200, clipped_df.ix[1]['start'])
        self.assertEquals(220, clipped_df.ix[1]['end'])
示例#4
0
    def test_clipping_always_greater_or_equal_than_0(self):
        regions = Regions(
            pd.DataFrame({
                'chromosome': ['chr1'],
                'start': [5],
                'end': [7]
            }))

        clipped_df = regions.clip_to_resolution(20)

        self.assertEquals('chr1', clipped_df.ix[0]['chromosome'])
        self.assertEquals(0, clipped_df.ix[0]['start'])
        self.assertEquals(20, clipped_df.ix[0]['end'])
示例#5
0
    def test_clipping_res_1(self):

        regions = Regions(pd.DataFrame( {'chromosome' : ['chr1', 'chr10'], 'start' : [100, 200], 'end' : [117, 220]} ))

        clipped_df = regions.clip_to_resolution(1)

        self.assertEquals('chr1', clipped_df.ix[0]['chromosome'])
        self.assertEquals(100, clipped_df.ix[0]['start'])
        self.assertEquals(117, clipped_df.ix[0]['end'])

        self.assertEquals('chr10', clipped_df.ix[1]['chromosome'])
        self.assertEquals(200, clipped_df.ix[1]['start'])
        self.assertEquals(220, clipped_df.ix[1]['end'])
示例#6
0
    def test_clipping_when_only_one_bin_present(self):
        regions = Regions(
            pd.DataFrame({
                'chromosome': ['chr1', 'chr10'],
                'start': [100, 200],
                'end': [117, 220]
            }))

        clipped_df = regions.clip_to_resolution(20)

        self.assertEquals('chr1', clipped_df.ix[0]['chromosome'])
        self.assertEquals(99, clipped_df.ix[0]['start'])
        self.assertEquals(119, clipped_df.ix[0]['end'])

        self.assertEquals('chr10', clipped_df.ix[1]['chromosome'])
        self.assertEquals(200, clipped_df.ix[1]['start'])
        self.assertEquals(220, clipped_df.ix[1]['end'])
示例#7
0
    def test_clipping_res_1(self):

        regions = Regions(
            pd.DataFrame({
                'chromosome': ['chr1', 'chr10'],
                'start': [100, 200],
                'end': [117, 220]
            }))

        clipped_df = regions.clip_to_resolution(1)

        self.assertEquals('chr1', clipped_df.ix[0]['chromosome'])
        self.assertEquals(100, clipped_df.ix[0]['start'])
        self.assertEquals(117, clipped_df.ix[0]['end'])

        self.assertEquals('chr10', clipped_df.ix[1]['chromosome'])
        self.assertEquals(200, clipped_df.ix[1]['start'])
        self.assertEquals(220, clipped_df.ix[1]['end'])
示例#8
0
    def test_clipping_keeps_the_same_class(self):

        regions = Regions(pd.DataFrame({'chromosome': ['chr1', 'chr10'], 'start': [100, 200], 'end': [117, 220]}))
        clipped_regions = regions.clip_to_resolution(5)
        self.assertTrue(isinstance(clipped_regions, Regions))