I've tried to export as an SDF file, a ligand extracted via a selection and noticed issues in relation with the bonds block of the SDF file.
code example:
const sview = component.structure.getView(new Selection('LIG'));
const w = new SDFWriter(sview)
console.log(w.getBlob())
The atom block looks correct, but the bond block contains every bond from the structure, with atom ids being the original indices, not the ones for each atom line number in the atom block.
Reading through the code, it appears that
StructureView.eachBond does not take into account the current selection.
The SDF writer directly outputs the atom indices from the bond proxy (i.e. the indices in the global bond store), not taking into account the position of the corresponding atom in the atom block.
The limitation to 999 atoms is not enforced, leading to issues with column alignment in the bond block:
I've tried to export as an SDF file, a ligand extracted via a selection and noticed issues in relation with the bonds block of the SDF file.
code example:
The atom block looks correct, but the bond block contains every bond from the structure, with atom ids being the original indices, not the ones for each atom line number in the atom block.
Reading through the code, it appears that
StructureView.eachBond
does not take into account the current selection.