Skip to content

Commit

Permalink
fix(pgio): report an error if structures are missing the |n suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLostLambda committed Oct 15, 2023
1 parent f39f895 commit aa05a25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/pgfinder/pgio.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ def theo_masses_reader(file: Union[str, Path]) -> pd.DataFrame:
"columns. Have you checked the format of your database against one of the built-in databases?"
)
) from e
# Check that all structures are followed by "|n" where n is one or more digits
if not theo_masses_df["Inferred structure"].str.contains(r"\|\d+$").all():
raise UserError(

Check warning on line 176 in lib/pgfinder/pgio.py

View check run for this annotation

Codecov / codecov/patch

lib/pgfinder/pgio.py#L176

Added line #L176 was not covered by tests
(
"The supplied mass database contains structures missing the '|n' suffix encoding oligomerisation "
"state. This should be '|1' for monomers, '|2' for dimers, '|3' for trimers, and so on."
)
)
theo_masses_df.attrs["file"] = PurePath(file).name
LOGGER.info(f"Theoretical masses loaded from : {file}")
return theo_masses_df
Expand Down

0 comments on commit aa05a25

Please sign in to comment.