def test_split_family(self): family, genotyped = read_ped_file(os.path.join(DATA_DIR, 'ped_soup.ped')) self.assertEqual(len(family), 7711) founders, non_founders, dangling, couples, children = ped.analyze(family) splits = ped.split_disjoint(family, children) fams = [] max_complexity = ped.MAX_COMPLEXITY for f in splits: cbn = ped.compute_bit_complexity(f, genotyped) if cbn > max_complexity: subfs = ped.split_family(f, genotyped, max_complexity) subfs_i = set().union(*map(set, subfs)) self.assertTrue(len(f) >= len(subfs_i)) self.assertTrue(len(set(f) - subfs_i) >= 0) for s in subfs: self.assertTrue( ped.compute_bit_complexity(s, genotyped) <= max_complexity )
def test_split_family(self): family, genotyped = read_ped_file( os.path.join(DATA_DIR, 'ped_soup.ped')) self.assertEqual(len(family), 7711) founders, non_founders, dangling, couples, children = ped.analyze( family) splits = ped.split_disjoint(family, children) fams = [] max_complexity = ped.MAX_COMPLEXITY for f in splits: cbn = ped.compute_bit_complexity(f, genotyped) if cbn > max_complexity: subfs = ped.split_family(f, genotyped, max_complexity) subfs_i = set().union(*map(set, subfs)) self.assertTrue(len(f) >= len(subfs_i)) self.assertTrue(len(set(f) - subfs_i) >= 0) for s in subfs: self.assertTrue( ped.compute_bit_complexity(s, genotyped) <= max_complexity)
def test_compute_bit_complexity(self): for cb, fname in manifest_reader(): family, genotyped = read_ped_file(os.path.join(DATA_DIR, fname)) cbn = ped.compute_bit_complexity(family, genotyped) self.assertEqual(cb, cbn)