Skip to content

Comments

fix(data/mmcif/smiles): don't select bond partner as StereoAtom#14

Merged
jnooree merged 2 commits intomainfrom
fix/data/chemcomp-to-mol
Feb 18, 2026
Merged

fix(data/mmcif/smiles): don't select bond partner as StereoAtom#14
jnooree merged 2 commits intomainfrom
fix/data/chemcomp-to-mol

Conversation

@bbh-pharm
Copy link
Contributor

@bbh-pharm bbh-pharm commented Feb 18, 2026

…nt neighbors

Checklist

If the change is related to the source code, tests, or build environments, please also check the following:

  • Does pytest -vs pass without any errors and warnings (at the project root)?
  • Does mypy --pretty pass without any errors and warnings (at the project root)?

If you added new feature(s), then also check the following:

  • Did you also add corresponding tests?

Linked Issues

Link the tracking issue(s) of this PR, with the auto-close keywords here:

  • Resolves seoklab/casp-pipe#7.

Covalent 리간드이면서 공유결합 부분 때문에 말단 이중결합이 생기면, 여기서 (Chem.AssignStereochemistry(mol, force=True)) 그냥 넘어가고, Chem.AssignCIPLabels(mol, chiral_atoms, configured_bonds) 에서 segfault 되는 것 같습니다.

# This must be done here because hydrogens could be removed
bond: Chem.Bond
for bond in mol.GetBonds():
if not bond.HasProp("absolute_config"):
continue
if bond.GetBondType() != Chem.BondType.DOUBLE:
continue
# Select any configuration and neighbors, will be corrected below
bond.SetStereo(Chem.BondStereo.STEREOE)
ni = bond.GetBeginAtom().GetNeighbors()[0].GetIdx()
nj = bond.GetEndAtom().GetNeighbors()[0].GetIdx()
# Required, set which neighbor is the "stereo atom".
bond.SetStereoAtoms(ni, nj)
# Required, if not specified, resulting smiles omits E/Z stereochemistry
Chem.AssignStereochemistry(mol, force=True)
chiral_atoms: list[int] = [
atom.GetIdx()
for atom in mol.GetAtoms()
if atom.HasProp("absolute_config")
]
configured_bonds: list[int] = [
bond.GetIdx()
for bond in mol.GetBonds()
if bond.HasProp("absolute_config")
]
Chem.AssignCIPLabels(mol, chiral_atoms, configured_bonds)

@bbh-pharm bbh-pharm requested a review from jnooree February 18, 2026 08:11
@bbh-pharm bbh-pharm self-assigned this Feb 18, 2026
@bbh-pharm bbh-pharm requested review from a team as code owners February 18, 2026 08:11
@bbh-pharm bbh-pharm added the bug Something isn't working label Feb 18, 2026
@cursor
Copy link

cursor bot commented Feb 18, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 13.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.79%. Comparing base (31dd926) to head (46ad130).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/gmol/base/data/mmcif/smiles.py 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
- Coverage   82.91%   82.79%   -0.12%     
==========================================
  Files          14       14              
  Lines        1580     1587       +7     
  Branches      206      207       +1     
==========================================
+ Hits         1310     1314       +4     
- Misses        217      219       +2     
- Partials       53       54       +1     
Files with missing lines Coverage Δ
src/gmol/base/data/mmcif/smiles.py 86.15% <70.00%> (-1.66%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jnooree jnooree changed the title fix(data/mmcif/smiles): skip stereo bonds with insufficient substituent neighbors fix(data/mmcif/smiles): don't select bond partner as StereoAtom Feb 18, 2026
@jnooree jnooree merged commit ff2b89d into main Feb 18, 2026
7 of 9 checks passed
@jnooree jnooree deleted the fix/data/chemcomp-to-mol branch February 18, 2026 08:55
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 this pull request may close these issues.

2 participants