#1256 - Inability to save a structure with R-Group in the SDF file format#3763
#1256 - Inability to save a structure with R-Group in the SDF file format#3763ost2025 wants to merge 13 commits into
Conversation
- API updated to transfer functionality of the sdf conversion into one call; - tests updated; - new test for case 1256 created;
| // separate sub-molecule whose atoms are not vertices of the main graph, so the | ||
| // component iteration never visits them on its own. Returns the number of such | ||
| // out-of-graph atoms (currently those held by R-group fragments). | ||
| static int countOutOfGraphAtoms(BaseMolecule& mol) |
There was a problem hiding this comment.
it seems like this function just counts number of all atoms in r-groups
| // atoms remain that were not part of any written fragment (e.g. a free R-group | ||
| // whose atoms live outside the main graph), emit the whole molecule as one more | ||
| // record so the owning structure is preserved instead of being lost. (#1256) | ||
| if (written_atoms == 0 && countOutOfGraphAtoms(mol) > 0) |
There was a problem hiding this comment.
it will make more sense to write each r-group independent if it is does not belong to any existing structure. also, it makes sense to consider not only written_atoms=0 case (e.g. if structure contains r-group assigned to atoms, and r-group outside the graph
| root = joinPathPy("molecules/", __file__) | ||
| ref_path = joinPathPy("ref/", __file__) | ||
|
|
||
| files = ["1256-ketR20-from2815"] |
There was a problem hiding this comment.
add tests with
2 independent r-groups
1 standard r-group and 2 independent r-group
reaction with 1 and 2 independent r-groups
There was a problem hiding this comment.
Could you please provide specific files in ket format to fill the gap?
There was a problem hiding this comment.
Some similar data has been added
| root = joinPathPy("molecules/", __file__) | ||
| ref_path = joinPathPy("ref/", __file__) | ||
|
|
||
| files = ["1256-ketR20-from2815"] |
There was a problem hiding this comment.
On top of the cases already requested above, please also add a case with ≥2 disconnected normal components plus one attached R-group (e.g. a simple salt)
There was a problem hiding this comment.
Could you please provide specific files in ket format to fill the gap?
There was a problem hiding this comment.
Some similar data has been added
| // Splits the item into fragments (connected components for a molecule, | ||
| // constituent molecules for a reaction) and returns the whole multi-record | ||
| // SDF as a string. Single entry point for SDF-by-fragments serialization. | ||
| CEXPORT const char* indigoGetFragmentSdf(int item); |
There was a problem hiding this comment.
Minor: Consider align naming to support consistency across application.
| return IndigoLib.checkResultString(self._lib().indigoCml(self.id)) | ||
|
|
||
| def getFragmentSdf(self): | ||
| """Structure method returns the structure as a string in SDF format, |
There was a problem hiding this comment.
Non-blocker: Let's either add comment in all wrappers or take it off from all places.
There was a problem hiding this comment.
it is depended from file. indigo_object.py has comments in this style.
- new test data added; - r-groups processing updated; - API renamed for naming consistency; - comments fixed;
- eliminated unnecessary data copying due to the use of the clone() function;
- copying only the one R-group we're keeping; - test input data extended with one of the QueryMolecule case;
Generic request
#1234 – issue name