Ejemplo n.º 1
0
 def test_zstd_compressed(self):
     ''' check we can parse genotypes from zstd compressed geno probabilities
     '''
     path = self.folder / 'example.16bits.zstd.bgen'
     bfile = BgenFile(str(path))
     for var, g in zip(bfile, self.gen_data):
         self.assertEqual(g, var)
         self.assertTrue(
             arrays_equal(g.probabilities, var.probabilities, 16))
Ejemplo n.º 2
0
 def test_load_haplotypes_bgen(self):
     ''' check we can open a bgen with haplotypes, and parse genotypes correctly
     '''
     path = self.folder / 'haplotypes.bgen'
     bfile = BgenFile(str(path))
     bit_depth = 16
     for var, g in zip(bfile, self.haps_data):
         self.assertEqual(g, var)
         self.assertTrue(
             arrays_equal(g.probabilities, var.probabilities, bit_depth))
Ejemplo n.º 3
0
 def test_v11(self):
     ''' check we can open a bgen in v1.1 format, and parse genotypes correctly
     '''
     path = self.folder / 'example.v11.bgen'
     bfile = BgenFile(str(path))
     bit_depth = 16
     for var, g in zip(bfile, self.gen_data):
         self.assertEqual(g, var)
         self.assertTrue(
             arrays_equal(g.probabilities, var.probabilities, bit_depth))
Ejemplo n.º 4
0
 def test_load_complex_file(self):
     ''' make sure we can open a complex bgen file
     '''
     path = self.folder / 'complex.bgen'
     bfile = BgenFile(path)
     bit_depth = 16
     for var, g in zip(bfile, self.vcf_data):
         self.assertEqual(g, var)
         self.assertTrue(
             arrays_equal(g.probabilities, var.probabilities, bit_depth))
         self.assertTrue(all(x == y for x, y in zip(g.ploidy, var.ploidy)))
Ejemplo n.º 5
0
 def test_load_example_genotypes_bit_depths(self):
     ''' check parsing genotypes from the example files with different bit depths
     '''
     for path in self.folder.glob('example.*bits.bgen'):
         bit_depth = int(path.stem.split('.')[1].strip('bits'))
         bfile = BgenFile(str(path))
         for var, g in zip(bfile, self.gen_data):
             self.assertEqual(g, var)
             self.assertTrue(
                 arrays_equal(g.probabilities, var.probabilities,
                              bit_depth))
Ejemplo n.º 6
0
    def test_load_complex_files(self):
        ''' make sure we can open the complex bgen files
        '''

        for path in self.folder.glob('complex.*.bgen'):
            bit_depth = int(path.stem.split('.')[1].strip('bits'))
            bfile = BgenFile(path)
            for var, g in zip(bfile, self.vcf_data):
                self.assertEqual(g, var)
                self.assertTrue(
                    arrays_equal(g.probabilities, var.probabilities,
                                 bit_depth))