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

Investigate weird pgscatalog.core.lib.pgsexceptions.MatchRateError #21

Closed
nebfield opened this issue May 29, 2024 · 1 comment · Fixed by #19
Closed

Investigate weird pgscatalog.core.lib.pgsexceptions.MatchRateError #21

nebfield opened this issue May 29, 2024 · 1 comment · Fixed by #19
Labels
bug Something isn't working

Comments

@nebfield
Copy link
Member

Getting these on UK Biobank when split per chromosome and I don't know why 🤔

@nebfield nebfield added the bug Something isn't working label May 29, 2024
@nebfield
Copy link
Member Author

nebfield commented Jun 7, 2024

This didn't do what I thought it did:

if not all(x[1] for x in self.filter_summary.iter_rows()):
logger.warning(f"{self.filter_summary}")
[
x.unlink() for xs in outfs for x in xs
] # don't provide dodgy scoring files
raise MatchRateError(
f"All scores fail to meet match threshold {min_overlap}"
)

A single failed match (false value) would trigger a MatchRateError.

I wanted to trigger a ZeroMatchesError if all matches failed.

The new approach is a bit more verbose:

for x in self.filter_summary.iter_rows():
try:
if not x[1]:
raise MatchRateError("Fails matching")
except MatchRateError:
# we reported the exception, but it's fine
logger.warning(f"Score {x[0]} matching failed with match rate {x[2]}")
continue
else:
logger.info(f"Score {x[0]} matching passed with match rate {x[2]}")
# unless everything is bad!
if not any(x[1] for x in self.filter_summary.iter_rows()):
raise ZeroMatchesError(
f"All scores fail to meet match threshold {min_overlap}"
)

But I'm trying to be a bit clearer about the expected behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant