diff --git a/docs/releasehistory.md b/docs/releasehistory.md index ea73a75d6..544dd6073 100644 --- a/docs/releasehistory.md +++ b/docs/releasehistory.md @@ -28,6 +28,7 @@ Releases follow the `major.minor.micro` scheme recommended by [PEP440](https://w ### Bugfixes - [PR #1923](https://github.com/openforcefield/openff-toolkit/pull/1923): `Topology.add_molecule` and `Topology.add_molecules` now return indices starting at 0. Previously, these indices started at 1, which does not match other indexing in the toolkit. +- [PR #1926](https://github.com/openforcefield/openff-toolkit/pull/1926): Less noisy hints when the chemistry of a PDB file cannot be identified. ## 0.16.2 diff --git a/docs/users/pdb_cookbook/index.ipynb b/docs/users/pdb_cookbook/index.ipynb index f1c6e019c..549b55976 100644 --- a/docs/users/pdb_cookbook/index.ipynb +++ b/docs/users/pdb_cookbook/index.ipynb @@ -240,10 +240,10 @@ "outputs": [ { "ename": "UnassignedChemistryInPDBError", - "evalue": "Some bonds or atoms in the input could not be identified.\n\nHint: The following residue names with unassigned atoms were not found in the substructure library. While the OpenFF Toolkit identifies residues by matching chemical substructures rather than by residue name, it currently only supports the 20 'canonical' amino acids.\n JZ4\n\n\nHint: The following residues were assigned names that do not match the residue name in the input, or could not be assigned residue names at all. This may indicate that atoms are missing from the input or some other error. The OpenFF Toolkit requires all atoms, including hydrogens, to be explicit in the input to avoid ambiguities in protonation state or bond order:\n Input residue X:JZ4#0001 contains atoms matching substructures {'No match'}\n\nError: The following 22 atoms exist in the input but could not be assigned chemical information from the substructure library:\n Atom 2614 (C4) in residue X:JZ4#0001\n Atom 2615 (C7) in residue X:JZ4#0001\n Atom 2616 (C8) in residue X:JZ4#0001\n Atom 2617 (C9) in residue X:JZ4#0001\n Atom 2618 (C10) in residue X:JZ4#0001\n Atom 2619 (C11) in residue X:JZ4#0001\n Atom 2620 (C12) in residue X:JZ4#0001\n Atom 2621 (C13) in residue X:JZ4#0001\n Atom 2622 (C14) in residue X:JZ4#0001\n Atom 2623 (OAB) in residue X:JZ4#0001\n Atom 2624 (H1) in residue X:JZ4#0001\n Atom 2625 (H2) in residue X:JZ4#0001\n Atom 2626 (H3) in residue X:JZ4#0001\n Atom 2627 (H4) in residue X:JZ4#0001\n Atom 2628 (H5) in residue X:JZ4#0001\n Atom 2629 (H6) in residue X:JZ4#0001\n Atom 2630 (H7) in residue X:JZ4#0001\n Atom 2631 (H8) in residue X:JZ4#0001\n Atom 2632 (H9) in residue X:JZ4#0001\n Atom 2633 (H10) in residue X:JZ4#0001\n Atom 2634 (H11) in residue X:JZ4#0001\n Atom 2635 (H12) in residue X:JZ4#0001\n", + "evalue": "Some bonds or atoms in the input could not be identified.\n\nHint: The following residue names with unassigned atoms were not found in the substructure library. While the OpenFF Toolkit identifies residues by matching chemical substructures rather than by residue name, it currently only supports the 20 'canonical' amino acids.\n JZ4\n\n\nHint: The following residues were assigned names that do not match the residue name in the input, or could not be assigned residue names at all. This may indicate that atoms are missing from the input or some other error. The OpenFF Toolkit requires all atoms, including hydrogens, to be explicit in the input to avoid ambiguities in protonation state or bond order:\n Input residue X:JZ4#0001 contains atoms matching substructures {'NO MATCH'}\n\nError: The following 22 atoms exist in the input but could not be assigned chemical information from the substructure library:\n Atom 2614 (C4) in residue X:JZ4#0001\n Atom 2615 (C7) in residue X:JZ4#0001\n Atom 2616 (C8) in residue X:JZ4#0001\n Atom 2617 (C9) in residue X:JZ4#0001\n Atom 2618 (C10) in residue X:JZ4#0001\n Atom 2619 (C11) in residue X:JZ4#0001\n Atom 2620 (C12) in residue X:JZ4#0001\n Atom 2621 (C13) in residue X:JZ4#0001\n Atom 2622 (C14) in residue X:JZ4#0001\n Atom 2623 (OAB) in residue X:JZ4#0001\n Atom 2624 (H1) in residue X:JZ4#0001\n Atom 2625 (H2) in residue X:JZ4#0001\n Atom 2626 (H3) in residue X:JZ4#0001\n Atom 2627 (H4) in residue X:JZ4#0001\n Atom 2628 (H5) in residue X:JZ4#0001\n Atom 2629 (H6) in residue X:JZ4#0001\n Atom 2630 (H7) in residue X:JZ4#0001\n Atom 2631 (H8) in residue X:JZ4#0001\n Atom 2632 (H9) in residue X:JZ4#0001\n Atom 2633 (H10) in residue X:JZ4#0001\n Atom 2634 (H11) in residue X:JZ4#0001\n Atom 2635 (H12) in residue X:JZ4#0001\n", "output_type": "error", "traceback": [ - "\u001b[0;31mUnassignedChemistryInPDBError\u001b[0m\u001b[0;31m:\u001b[0m Some bonds or atoms in the input could not be identified.\n\nHint: The following residue names with unassigned atoms were not found in the substructure library. While the OpenFF Toolkit identifies residues by matching chemical substructures rather than by residue name, it currently only supports the 20 'canonical' amino acids.\n JZ4\n\n\nHint: The following residues were assigned names that do not match the residue name in the input, or could not be assigned residue names at all. This may indicate that atoms are missing from the input or some other error. The OpenFF Toolkit requires all atoms, including hydrogens, to be explicit in the input to avoid ambiguities in protonation state or bond order:\n Input residue X:JZ4#0001 contains atoms matching substructures {'No match'}\n\nError: The following 22 atoms exist in the input but could not be assigned chemical information from the substructure library:\n Atom 2614 (C4) in residue X:JZ4#0001\n Atom 2615 (C7) in residue X:JZ4#0001\n Atom 2616 (C8) in residue X:JZ4#0001\n Atom 2617 (C9) in residue X:JZ4#0001\n Atom 2618 (C10) in residue X:JZ4#0001\n Atom 2619 (C11) in residue X:JZ4#0001\n Atom 2620 (C12) in residue X:JZ4#0001\n Atom 2621 (C13) in residue X:JZ4#0001\n Atom 2622 (C14) in residue X:JZ4#0001\n Atom 2623 (OAB) in residue X:JZ4#0001\n Atom 2624 (H1) in residue X:JZ4#0001\n Atom 2625 (H2) in residue X:JZ4#0001\n Atom 2626 (H3) in residue X:JZ4#0001\n Atom 2627 (H4) in residue X:JZ4#0001\n Atom 2628 (H5) in residue X:JZ4#0001\n Atom 2629 (H6) in residue X:JZ4#0001\n Atom 2630 (H7) in residue X:JZ4#0001\n Atom 2631 (H8) in residue X:JZ4#0001\n Atom 2632 (H9) in residue X:JZ4#0001\n Atom 2633 (H10) in residue X:JZ4#0001\n Atom 2634 (H11) in residue X:JZ4#0001\n Atom 2635 (H12) in residue X:JZ4#0001\n\n" + "\u001b[0;31mUnassignedChemistryInPDBError\u001b[0m\u001b[0;31m:\u001b[0m Some bonds or atoms in the input could not be identified.\n\nHint: The following residue names with unassigned atoms were not found in the substructure library. While the OpenFF Toolkit identifies residues by matching chemical substructures rather than by residue name, it currently only supports the 20 'canonical' amino acids.\n JZ4\n\n\nHint: The following residues were assigned names that do not match the residue name in the input, or could not be assigned residue names at all. This may indicate that atoms are missing from the input or some other error. The OpenFF Toolkit requires all atoms, including hydrogens, to be explicit in the input to avoid ambiguities in protonation state or bond order:\n Input residue X:JZ4#0001 contains atoms matching substructures {'NO MATCH'}\n\nError: The following 22 atoms exist in the input but could not be assigned chemical information from the substructure library:\n Atom 2614 (C4) in residue X:JZ4#0001\n Atom 2615 (C7) in residue X:JZ4#0001\n Atom 2616 (C8) in residue X:JZ4#0001\n Atom 2617 (C9) in residue X:JZ4#0001\n Atom 2618 (C10) in residue X:JZ4#0001\n Atom 2619 (C11) in residue X:JZ4#0001\n Atom 2620 (C12) in residue X:JZ4#0001\n Atom 2621 (C13) in residue X:JZ4#0001\n Atom 2622 (C14) in residue X:JZ4#0001\n Atom 2623 (OAB) in residue X:JZ4#0001\n Atom 2624 (H1) in residue X:JZ4#0001\n Atom 2625 (H2) in residue X:JZ4#0001\n Atom 2626 (H3) in residue X:JZ4#0001\n Atom 2627 (H4) in residue X:JZ4#0001\n Atom 2628 (H5) in residue X:JZ4#0001\n Atom 2629 (H6) in residue X:JZ4#0001\n Atom 2630 (H7) in residue X:JZ4#0001\n Atom 2631 (H8) in residue X:JZ4#0001\n Atom 2632 (H9) in residue X:JZ4#0001\n Atom 2633 (H10) in residue X:JZ4#0001\n Atom 2634 (H11) in residue X:JZ4#0001\n Atom 2635 (H12) in residue X:JZ4#0001\n\n" ] } ], diff --git a/openff/toolkit/utils/exceptions.py b/openff/toolkit/utils/exceptions.py index 1dd628741..73a968699 100644 --- a/openff/toolkit/utils/exceptions.py +++ b/openff/toolkit/utils/exceptions.py @@ -604,7 +604,7 @@ def assigned_residue_name_mismatch_hint(self) -> list[str]: input_chain: str = atom.residue.chain.id matched_resnames = self.matches[atom.index] # Only the first match is assigned, so throw out the others - assigned_resname = next(iter(matched_resnames), "No match") + assigned_resname = next(iter(matched_resnames), "No match").upper() residues[(input_resname, input_resnum, input_chain)].add(assigned_resname)