diff --git a/src/alphafold3/model/atom_layout/atom_layout.py b/src/alphafold3/model/atom_layout/atom_layout.py index 541fe7f8..f74b23f6 100644 --- a/src/alphafold3/model/atom_layout/atom_layout.py +++ b/src/alphafold3/model/atom_layout/atom_layout.py @@ -677,7 +677,7 @@ def get_link_drop_atoms( *chemical_component_sets.GLYCAN_OTHER_LIGANDS, *chemical_component_sets.GLYCAN_LINKING_LIGANDS, }: - if 'O1' not in bonded_atoms: + if bonded_atoms and 'O1' not in bonded_atoms: drop_atoms.update({'O1'}) return drop_atoms diff --git a/src/alphafold3/model/pipeline/structure_cleaning.py b/src/alphafold3/model/pipeline/structure_cleaning.py index 4043a3f8..91938a6d 100644 --- a/src/alphafold3/model/pipeline/structure_cleaning.py +++ b/src/alphafold3/model/pipeline/structure_cleaning.py @@ -166,9 +166,13 @@ def clean_structure( *chemical_component_sets.GLYCAN_OTHER_LIGANDS, *chemical_component_sets.GLYCAN_LINKING_LIGANDS, } - # If only glycan ligands and no O1 atoms, we can do parallel drop. + # If only glycan ligands and no O1 atoms, we can do parallel drop. If there are no glycan bonds at all, keep O1. + has_any_glycan_bond = bool( + ligand_ligand_bonds.atom_name.size or polymer_ligand_bonds.atom_name.size + ) if ( only_glycan_ligands_for_leaving_atoms + and has_any_glycan_bond and (not (ligand_ligand_bonds.atom_name == 'O1').any()) and (not (polymer_ligand_bonds.atom_name == 'O1').any()) ):