-
Notifications
You must be signed in to change notification settings - Fork 2
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
346 duckdb for benchmarking #348
Conversation
… genes/diseases/variants in tables
…ng TSV with using the db to calculate stats & add stats to table
…o create comparison tables with duckdb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. It's a bit tricky to properly digest all these changes but I think it looks like a generally clearer to comprehend codebase. There are still a lot of essentially duplicated code in the variant/gene/disease_prioritisation_analysis and having the LLM generated docs being larger than the two line function it documents isn't actually all that helpful as it add a lot of noise. e.g.
def _assess_disease_with_threshold_ascending_order(
self,
result_entry: RankedPhEvalDiseaseResult,
) -> int:
"""
Record the disease prioritisation rank if it meets the ascending order threshold.
This method checks if the disease prioritisation rank meets the ascending order threshold.
If the score of the result entry is less than the threshold, it records the disease rank.
Args:
result_entry (RankedPhEvalDiseaseResult): Ranked PhEval disease result entry
Returns:
int: Recorded disease prioritisation rank
"""
if float(self.threshold) > float(result_entry.score):
return result_entry.rank
else:
return 0
def _assess_disease_with_threshold(
self,
result_entry: RankedPhEvalDiseaseResult,
) -> int:
"""
Record the disease prioritisation rank if it meets the score threshold.
This method checks if the disease prioritisation rank meets the score threshold.
If the score of the result entry is greater than the threshold, it records the disease rank.
Args:
result_entry (RankedPhEvalDiseaseResult): Ranked PhEval disease result entry
Returns:
int: Recorded disease prioritisation rank
"""
if float(self.threshold) < float(result_entry.score):
return result_entry.rank
else:
return 0
def _record_matched_disease(
self,
standardised_disease_result: RankedPhEvalDiseaseResult,
) -> int:
"""
Return the disease rank result - handling the specification of a threshold.
This method determines and returns the disease rank result based on the specified threshold
and score order. If the threshold is 0.0, it records the disease rank directly.
Otherwise, it assesses the disease with the threshold based on the score order.
Args:
standardised_disease_result (RankedPhEvalDiseaseResult): Ranked PhEval disease result entry
Returns:
int: Recorded disease prioritisation rank
"""
if float(self.threshold) == 0.0:
return standardised_disease_result.rank
else:
return (
self._assess_disease_with_threshold(standardised_disease_result)
if self.score_order != "ascending"
else self._assess_disease_with_threshold_ascending_order(
standardised_disease_result,
)
)
is essentially repeated in three files.
This PR fails due to the MakeFile pipeline test that executes the template runner and the benchmark command. The MakeFile could be separated out of the main PhEval repo and moved into monarch-pheval - @souzadevinicius agreed on this statement in another PR. Ultimately this PR is blocked until the test is refactored in the MakeFile pipeline OR this is moved to another repo to test the pipeline. |
The pipeline test needed to be modified due to the pheval-utils methods refactor. Sorry for this PR blocking. @yaseminbridges, @julesjacobsen and @matentzn, wherever you decide to put the Makefile code, I agree 😅. |
Unfortunately a very large PR, however, it is for a much-needed and positive upgrade to the benchmarking code.
Before:
Now:
This change was necessary, the overall benchmarking process is now more efficient in terms of speed, storing of data & code readability (also managed to cut down the codebase).
Finally, I have added some much-needed documentation for running a benchmark.
A general idea of how things work now: