Commit 5b43ad84 by Huang Di

fix start_nodes and eq_scc bug

parent aa3cfc42
......@@ -18,25 +18,41 @@ args = {
'threshold3': 3, # gene flow merge threshold
'bidirectional': True, # calculate the reversed gene flow
'calculate_pd': True, # calculate the gene flow confidence
'data_path': 'data/test.log',
'data_path': 'data/D_AI_230710.log',
'save_path': 'pictures/tree.png',
'draw_gene_flow': True,
'gene_flow_display_confidence': 0.7,
'target_block_list': ['Tianyuan'],
's1_block_list': ['Boshan'],
'target_block_list': ['AR14K'],
's1_block_list': ['AR14K'],
# 'target_block_list': [],
# 's1_block_list': [],
}
populations = ['Kostenki14',
'Tianyuan',
'AR19K',
'AR14K',
'Zongri5_1k',
populations = ['Tianyuan',
'Boshan',
'Qihe3',
'Donghulin',
]
'Qihe',
'Longlin',
'Dushan',
'Baojianshan',
'La368',
'Bianbian',
'Xiaojingshan',
'BQGroup',
'YJCGroup',
'LJZGroup',
'YR_MN_WGM',
'WLR_MN',
'DevilsCave_N',
'AR14K']
# populations = ['Kostenki14',
# 'Tianyuan',
# 'AR19K',
# 'AR14K',
# 'Zongri5_1k',
# 'Boshan',
# 'Qihe3',
# 'Donghulin',
# ]
#args = {
# 'change_greenstar': True,
......@@ -114,6 +130,7 @@ print('Analyzing the minimum Z...')
bottom_threshold = 0
D_statistics, adjusted_D_values, triangles, redstar_indices, min_redstar, s2_record \
= read_data(data_path, bottom_threshold, populations)
print(s2_record)
builder = TreeBuilder(populations, triangles, s2_record)
builder.D2graph(D_statistics)
g = builder.g
......@@ -203,7 +220,10 @@ for scc_idx, s in enumerate(scc0):
del g.graph[idx]
g.graph[represent]['in'].discard(idx)
g.graph[represent]['out'].discard(idx)
if idx in g.start_nodes:
g.start_nodes.discard(idx)
else:
g.start_nodes.discard(represent)
# note that, the eq set of the node may contain duplicated nodes with different values!!!!!!!
# tmp_node_record is used to duplicate them.
# tmp_node_record = []
......@@ -420,7 +440,10 @@ for scc_idx, s in enumerate(scc):
g.graph[node]['in'].add(represent)
g.graph[node]['in'].remove(idx)
del g.graph[idx]
if idx in g.start_nodes:
g.start_nodes.discard(idx)
else:
g.start_nodes.discard(represent)
g.graph[represent]['in'].remove(represent)
g.graph[represent]['out'].remove(represent)
if represent in eq_scc:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment