Skip to content

Commit

Permalink
keep input_reaction for unsolvable cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Weinbauer committed Apr 15, 2024
1 parent e11610c commit fc198de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions synrbl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __run_pipeline(self, reactions, stats=None):

logger.info("Run rule-based method.")
self.rb_method.run(reactions, stats=stats)
self.rb_validator.check(reactions)
self.rb_validator.check(reactions, override_unsolved=True)

self.mcs.find(reactions)

Expand All @@ -70,7 +70,7 @@ def __run_pipeline(self, reactions, stats=None):
"Run rule-based method again to fix remaining non-carbon imbalance."
)
self.rb_method.run(reactions)
self.mcs_validator.check(reactions)
self.mcs_validator.check(reactions, override_unsolved=True)

self.conf_predictor.predict(
reactions, stats=stats, threshold=self.confidence_threshold
Expand Down
5 changes: 3 additions & 2 deletions synrbl/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
self.carbon_balance_col = carbon_balance_col
self.n_jobs = n_jobs

def check(self, reactions):
def check(self, reactions, override_unsolved=False):
update_reactants_and_products(reactions, self.reaction_col)
decompose = RSMIDecomposer(
smiles=None, # type: ignore
Expand Down Expand Up @@ -61,5 +61,6 @@ def check(self, reactions):
):
reaction[self.solved_col] = True
reaction[self.solved_method_col] = self.method

if override_unsolved and not reaction[self.solved_col]:
reaction[self.reaction_col] = reaction["input_reaction"]
return reactions

0 comments on commit fc198de

Please sign in to comment.