Example #1
0
    def test_index_opens(self):
        ''' loads index when available
        '''
        bfile = BgenFile(self.folder / 'example.15bits.bgen')
        self.assertFalse(
            bfile._check_for_index(str(self.folder / 'example.15bits.bgen')))

        bfile = BgenFile(self.folder / 'example.16bits.bgen')
        self.assertTrue(
            bfile._check_for_index(str(self.folder / 'example.16bits.bgen')))
Example #2
0
    def test_fetch(self):
        ''' can fetch variants within a genomic region
        '''
        chrom, start, stop = '01', 5000, 50000
        bfile = BgenFile(self.folder / 'example.16bits.bgen')
        self.assertTrue(
            bfile._check_for_index(str(self.folder / 'example.16bits.bgen')))

        self.assertTrue(list(bfile.fetch('02')) == [])