Exemplo n.º 1
0
 def test_load_hut_and_recode(self):
     """Load hutterites pedigree from file; recode to consecutive IDs based on a genotyped
     ID list."""
     p = itu.read_pedigree_from_test_file(itu.HUTT_PED, genotyped_id_file=itu.GENOTYPE_SAMPLE + ".tfam")
     assert_equal(p.graph.number_of_edges(), 7200, "Incorrect number of edges")
     assert_equal(p.n, 3671, "Incorrect number of nodes")
     assert_equal(p.graph.nodes(), range(0, p.n), "Incorrect node IDs")
Exemplo n.º 2
0
 def test_load_hut(self):
     '''Load hutterites pedigree from file.'''
     # Load data from text file to compare with the load result
     p = itu.read_pedigree_from_test_file(itu.HUTT_PED)
     assert_equal(p.graph.number_of_edges(), 7200,
                  'Incorrect number of edges')
     assert_equal(p.n, 3671, 'Incorrect number of nodes')
Exemplo n.º 3
0
 def test_matrices(self):
     '''Test adjacency and Laplacian matrix computation.'''
     # Load data from text file to compare with the load result
     p = itu.read_pedigree_from_test_file(itu.HUTT_PED)
     A = sym_adjacency(p.graph)
     L = laplacian(p.graph)
     assert not np.nonzero(A-A.T)[0], 'Adjacency matrix returned from sym_adjacency() should be symmetric'
     assert not np.nonzero(L-L.T)[0], 'Laplacian matrix should be symmetric'
     assert (abs(L.sum(axis=1)) < 1e-8).all(), 'Laplacian matrix should be zero-row-sum'
Exemplo n.º 4
0
 def test_load_hut_and_recode(self):
     '''Load hutterites pedigree from file; recode to consecutive IDs based on a genotyped
     ID list.'''
     p = itu.read_pedigree_from_test_file(
         itu.HUTT_PED, genotyped_id_file=itu.GENOTYPE_SAMPLE + '.tfam')
     assert_equal(p.graph.number_of_edges(), 7200,
                  'Incorrect number of edges')
     assert_equal(p.n, 3671, 'Incorrect number of nodes')
     assert_equal(p.graph.nodes(), range(0, p.n), 'Incorrect node IDs')
Exemplo n.º 5
0
 def test_matrices(self):
     '''Test adjacency and Laplacian matrix computation.'''
     # Load data from text file to compare with the load result
     p = itu.read_pedigree_from_test_file(itu.HUTT_PED)
     A = sym_adjacency(p.graph)
     L = laplacian(p.graph)
     assert not np.nonzero(
         A - A.T
     )[0], 'Adjacency matrix returned from sym_adjacency() should be symmetric'
     assert not np.nonzero(L -
                           L.T)[0], 'Laplacian matrix should be symmetric'
     assert (abs(L.sum(axis=1)) <
             1e-8).all(), 'Laplacian matrix should be zero-row-sum'
Exemplo n.º 6
0
 def test_load_hut(self):
     """Load hutterites pedigree from file."""
     # Load data from text file to compare with the load result
     p = itu.read_pedigree_from_test_file(itu.HUTT_PED)
     assert_equal(p.graph.number_of_edges(), 7200, "Incorrect number of edges")
     assert_equal(p.n, 3671, "Incorrect number of nodes")