Commit 5b43ad84 by Huang Di

fix start_nodes and eq_scc bug

parent aa3cfc42
...@@ -18,25 +18,41 @@ args = { ...@@ -18,25 +18,41 @@ args = {
'threshold3': 3, # gene flow merge threshold 'threshold3': 3, # gene flow merge threshold
'bidirectional': True, # calculate the reversed gene flow 'bidirectional': True, # calculate the reversed gene flow
'calculate_pd': True, # calculate the gene flow confidence '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', 'save_path': 'pictures/tree.png',
'draw_gene_flow': True, 'draw_gene_flow': True,
'gene_flow_display_confidence': 0.7, 'gene_flow_display_confidence': 0.7,
'target_block_list': ['Tianyuan'], 'target_block_list': ['AR14K'],
's1_block_list': ['Boshan'], 's1_block_list': ['AR14K'],
# 'target_block_list': [], # 'target_block_list': [],
# 's1_block_list': [], # 's1_block_list': [],
} }
populations = ['Tianyuan',
'Boshan',
'Qihe',
'Longlin',
'Dushan',
'Baojianshan',
'La368',
'Bianbian',
'Xiaojingshan',
'BQGroup',
'YJCGroup',
'LJZGroup',
'YR_MN_WGM',
'WLR_MN',
'DevilsCave_N',
'AR14K']
populations = ['Kostenki14', # populations = ['Kostenki14',
'Tianyuan', # 'Tianyuan',
'AR19K', # 'AR19K',
'AR14K', # 'AR14K',
'Zongri5_1k', # 'Zongri5_1k',
'Boshan', # 'Boshan',
'Qihe3', # 'Qihe3',
'Donghulin', # 'Donghulin',
] # ]
#args = { #args = {
# 'change_greenstar': True, # 'change_greenstar': True,
...@@ -114,6 +130,7 @@ print('Analyzing the minimum Z...') ...@@ -114,6 +130,7 @@ print('Analyzing the minimum Z...')
bottom_threshold = 0 bottom_threshold = 0
D_statistics, adjusted_D_values, triangles, redstar_indices, min_redstar, s2_record \ D_statistics, adjusted_D_values, triangles, redstar_indices, min_redstar, s2_record \
= read_data(data_path, bottom_threshold, populations) = read_data(data_path, bottom_threshold, populations)
print(s2_record)
builder = TreeBuilder(populations, triangles, s2_record) builder = TreeBuilder(populations, triangles, s2_record)
builder.D2graph(D_statistics) builder.D2graph(D_statistics)
g = builder.g g = builder.g
...@@ -203,7 +220,10 @@ for scc_idx, s in enumerate(scc0): ...@@ -203,7 +220,10 @@ for scc_idx, s in enumerate(scc0):
del g.graph[idx] del g.graph[idx]
g.graph[represent]['in'].discard(idx) g.graph[represent]['in'].discard(idx)
g.graph[represent]['out'].discard(idx) g.graph[represent]['out'].discard(idx)
g.start_nodes.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!!!!!!! # 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 is used to duplicate them.
# tmp_node_record = [] # tmp_node_record = []
...@@ -420,7 +440,10 @@ for scc_idx, s in enumerate(scc): ...@@ -420,7 +440,10 @@ for scc_idx, s in enumerate(scc):
g.graph[node]['in'].add(represent) g.graph[node]['in'].add(represent)
g.graph[node]['in'].remove(idx) g.graph[node]['in'].remove(idx)
del g.graph[idx] del g.graph[idx]
g.start_nodes.discard(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]['in'].remove(represent)
g.graph[represent]['out'].remove(represent) g.graph[represent]['out'].remove(represent)
if represent in eq_scc: 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