Skip to content

Commit

Permalink
Merge pull request #28 from TieuLongPhan/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
klausweinbauer authored May 15, 2024
2 parents cc29083 + 5ebd86d commit d6ae8a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "synrbl"
version = "0.0.15"
version = "0.0.16"
authors = [
{name="Tieu Long Phan", email="long.tieu_phan@uni-leipzig.de"},
{name="Klaus Weinbauer", email="klaus@bioinf.uni-leipzig.de"}
Expand Down
4 changes: 4 additions & 0 deletions synrbl/SynCmd/cmd_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def run(args):

rb_correct = 0
mcs_correct = 0
mcs_cth = 0
for i, entry in enumerate(dataset):
if not entry["solved"]:
continue
Expand All @@ -134,6 +135,8 @@ def run(args):
continue
exp_reaction = normalize_smiles(exp)
act_reaction = normalize_smiles(entry[args.col])
if entry["confidence"] >= args.min_confidence:
mcs_cth += 1
if (
wc_similarity(exp_reaction, act_reaction, args.similarity_method)
>= args.similarity_threshold
Expand All @@ -143,6 +146,7 @@ def run(args):
elif entry["solved_by"] == "mcs-based":
mcs_correct += 1

stats["confident_cnt"] = mcs_cth
output_result(stats, rb_correct, mcs_correct, file=args.o)


Expand Down
7 changes: 5 additions & 2 deletions synrbl/balancing.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
mcs_data_col=self.__mcs_data_col,
issue_col=self.__issue_col,
rules_col=self.__rules_col,
smiles_standardizer=[MoleculeStandardizer()]
smiles_standardizer=[MoleculeStandardizer()],
)
self.post_processor = PostProcess(
id_col=id_col, reaction_col=reaction_col, n_jobs=n_jobs, verbose=0
Expand All @@ -114,7 +114,10 @@ def __post_process(self, reactions):
]
pp_results = self.post_processor.fit(pp_data)
for pp_result in pp_results:
if pp_result["label"] != "unspecified":
if (
pp_result["label"] != "unspecified"
and "curated_reaction" in pp_result.keys()
):
idx = key_index_map[pp_result[self.__id_col]]
reactions[idx][self.__reaction_col] = pp_result["curated_reaction"]

Expand Down

0 comments on commit d6ae8a2

Please sign in to comment.