Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix no score ratio when only one scheme #112

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions viridian/one_sample_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,16 @@ def detect_amplicon_scheme(self):
return False
best_scheme = id_results["scheme_choice"]["best_scheme"]
best_score = id_results["scheme_choice"]["best_score"]
number_of_schemes = len(id_results["scheme_choice"]["scores"])
score_ratio = id_results["scheme_choice"]["score_ratio"]
logging.info(
f"Amplicon scheme that reads best match to: {best_scheme}, with score {best_score}, and (second best)/best = {score_ratio}"
)
if number_of_schemes > 1:
logging.info(
f"Amplicon scheme that reads best match to: {best_scheme}, with score {best_score}, and (second best)/best = {score_ratio}"
)
else:
logging.info(
f"Amplicon scheme that reads best match to: {best_scheme}, with score {best_score}, not using (second best)/best because only one scheme"
)

if self.force_amp_scheme is None:
score_ok = True
Expand All @@ -376,7 +382,9 @@ def detect_amplicon_scheme(self):
f"Best scheme score is {best_score}, which is less than required minimum score {self.min_scheme_score}"
)
score_ok = False
if score_ratio is None or score_ratio > self.max_scheme_ratio:
if number_of_schemes > 1 and (
score_ratio is None or score_ratio > self.max_scheme_ratio
):
self.log_dict["amplicon_scheme_name"] = None
self.add_errors_to_log(
f"(second best scheme score) / (best score) is {score_ratio}, which is more than the required maximum {self.max_scheme_ratio}"
Expand Down
Loading