Skip to content

Commit

Permalink
Fixed atom economy for bio pathways
Browse files Browse the repository at this point in the history
  • Loading branch information
dmdqy committed Sep 17, 2024
1 parent 3f32f75 commit e994f2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 5 additions & 4 deletions doranet/modules/post_processing/post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ def path_eco(
for (
i
) in left_dict: # find idx for a intermediate molecule to produce
if i not in starters:
if i not in starters | set(has_bio):
popkey = i
break
# num_mol = left_dict.pop(popkey)
Expand Down Expand Up @@ -1700,7 +1700,7 @@ def path_eco(

key_list = list()
for key in left_dict: # balance left and right dict
if key not in starters and key in right_dict:
if key not in starters | set(has_bio) and key in right_dict:
key_list.append(key)
for key in key_list:
if left_dict[key] == right_dict[key]:
Expand All @@ -1717,7 +1717,8 @@ def path_eco(

done_flag = True
for key in left_dict:
if key not in starters: # check if left only contain starters
if key not in starters | set(has_bio):
# check if left only contain starters
done_flag = False
if done_flag is True or timecount == timeout:
repeat_flag = False
Expand Down Expand Up @@ -1772,7 +1773,7 @@ def path_eco(

print("Min_eco", min_eco)
print("Max_eco", max_eco)
# print("none_eco", none_eco)
print("None_eco", none_eco)
diff_eco = max_eco - min_eco
for i in eco_list:
if diff_eco != 0:
Expand Down
6 changes: 5 additions & 1 deletion doranet/modules/synthetic/generate_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,10 @@ def generate_network(
for smarts in smarts_list:
if smarts.kekulize_flag is False:
network.add_op(
engine.op.rdkit(smarts.smarts),
engine.op.rdkit(
smarts.smarts,
drop_errors=True,
),
meta={
"name": smarts.name,
"reactants_stoi": smarts.reactants_stoi,
Expand All @@ -508,6 +511,7 @@ def generate_network(
engine.op.rdkit(
smarts.smarts,
kekulize=True,
drop_errors=True,
),
meta={
"name": smarts.name,
Expand Down

0 comments on commit e994f2d

Please sign in to comment.