diff --git a/.github/workflows/indigo-ci.yaml b/.github/workflows/indigo-ci.yaml index eb1a17702a..bddb688f6a 100644 --- a/.github/workflows/indigo-ci.yaml +++ b/.github/workflows/indigo-ci.yaml @@ -1216,4 +1216,4 @@ jobs: docker push epmlsop/indigo-service:enhanced-latest - name: Publish master if: github.ref == 'refs/heads/master' - run: docker push epmlsop/indigo-service:enhanced-latest + run: docker push epmlsop/indigo-service:enhanced-latest \ No newline at end of file diff --git a/api/c/indigo/src/indigo_layout.cpp b/api/c/indigo/src/indigo_layout.cpp index 8d6657fabb..106da0fdb9 100644 --- a/api/c/indigo/src/indigo_layout.cpp +++ b/api/c/indigo/src/indigo_layout.cpp @@ -98,19 +98,24 @@ CEXPORT int indigoLayout(int object) else if (IndigoBaseReaction::is(obj)) { BaseReaction& rxn = obj.getBaseReaction(); - ReactionLayout rl(rxn, self.smart_layout); - rl.max_iterations = self.layout_max_iterations; - rl.layout_orientation = (layout_orientation_value)self.layout_orientation; - rl.bond_length = 1.6f; - rl.horizontal_interval_factor = self.layout_horintervalfactor; - - rl.make(); - try - { - rxn.markStereocenterBonds(); - } - catch (Exception e) + if (rxn.isMultistep()) + throw IndigoError("Multistep layout is not implemented yet."); + else { + ReactionLayout rl(rxn, self.smart_layout); + rl.max_iterations = self.layout_max_iterations; + rl.layout_orientation = (layout_orientation_value)self.layout_orientation; + rl.bond_length = 1.6f; + rl.horizontal_interval_factor = self.layout_horintervalfactor; + + rl.make(); + try + { + rxn.markStereocenterBonds(); + } + catch (Exception e) + { + } } } else diff --git a/core/indigo-core/molecule/src/molecule_json_saver.cpp b/core/indigo-core/molecule/src/molecule_json_saver.cpp index e1f6016bd1..31d591c7d4 100644 --- a/core/indigo-core/molecule/src/molecule_json_saver.cpp +++ b/core/indigo-core/molecule/src/molecule_json_saver.cpp @@ -892,6 +892,10 @@ void MoleculeJsonSaver::saveMolecule(BaseMolecule& bmol, Writer& w int n_rgroups = mol->rgroups.getRGroupCount(); for (int i = 1; i <= n_rgroups; ++i) { + RGroup& rgroup = mol->rgroups.getRGroup(i); + if (rgroup.fragments.size() == 0) + continue; + buf.clear(); out.printf("rg%d", i); buf.push(0); diff --git a/core/indigo-core/reaction/reaction_json_saver.h b/core/indigo-core/reaction/reaction_json_saver.h index 588817c86e..f1af33b7f2 100644 --- a/core/indigo-core/reaction/reaction_json_saver.h +++ b/core/indigo-core/reaction/reaction_json_saver.h @@ -40,7 +40,7 @@ namespace indigo void saveReaction(BaseReaction& rxn); void saveSingleReaction(BaseReaction& rxn, BaseMolecule& merged, MoleculeJsonSaver& json_saver); - void saveReactionWithMetadata(BaseReaction& rxn, BaseMolecule& merged, MoleculeJsonSaver& json_saver); + void saveMultistepReaction(BaseReaction& rxn, BaseMolecule& merged, MoleculeJsonSaver& json_saver); bool _add_stereo_desc; DECL_ERROR; diff --git a/core/indigo-core/reaction/src/reaction_json_saver.cpp b/core/indigo-core/reaction/src/reaction_json_saver.cpp index e5b222ebb5..a1b5e6e2be 100644 --- a/core/indigo-core/reaction/src/reaction_json_saver.cpp +++ b/core/indigo-core/reaction/src/reaction_json_saver.cpp @@ -61,9 +61,8 @@ ReactionJsonSaver::~ReactionJsonSaver() { } -void ReactionJsonSaver::saveReactionWithMetadata(BaseReaction& rxn, BaseMolecule& merged, MoleculeJsonSaver& json_saver) +void ReactionJsonSaver::saveMultistepReaction(BaseReaction& rxn, BaseMolecule& merged, MoleculeJsonSaver& json_saver) { - for (int i = rxn.begin(); i != rxn.end(); i = rxn.next(i)) merged.mergeWithMolecule(rxn.getBaseMolecule(i), 0, 0); @@ -93,8 +92,8 @@ void ReactionJsonSaver::saveReactionWithMetadata(BaseReaction& rxn, BaseMolecule Value pos_array(kArrayType); Value pos1(kObjectType); Value pos2(kObjectType); - pos1.AddMember("x", Value().SetDouble(ar._begin.x), ket.GetAllocator()); - pos1.AddMember("y", Value().SetDouble(ar._begin.y), ket.GetAllocator()); + pos1.AddMember("x", Value().SetDouble(ar._end.x), ket.GetAllocator()); + pos1.AddMember("y", Value().SetDouble(ar._end.y), ket.GetAllocator()); pos1.AddMember("z", Value().SetDouble(0.0), ket.GetAllocator()); pos2.AddMember("x", Value().SetDouble(ar._begin.x), ket.GetAllocator()); pos2.AddMember("y", Value().SetDouble(ar._begin.y), ket.GetAllocator()); @@ -219,7 +218,7 @@ void ReactionJsonSaver::saveSingleReaction(BaseReaction& rxn, BaseMolecule& merg plus.AddMember("type", "plus", ket.GetAllocator()); Value location(kArrayType); location.PushBack(Value().SetDouble(plus_offset.x), ket.GetAllocator()); - location.PushBack(Value().SetDouble(-plus_offset.y), ket.GetAllocator()); // TODO: remove - + location.PushBack(Value().SetDouble(plus_offset.y), ket.GetAllocator()); location.PushBack(Value().SetDouble(0.0), ket.GetAllocator()); plus.AddMember("location", location, ket.GetAllocator()); nodes.PushBack(plus, ket.GetAllocator()); @@ -311,9 +310,9 @@ void ReactionJsonSaver::saveReaction(BaseReaction& rxn) merged = std::make_unique(); } - if (rxn.metaData().size()) + if (rxn.isMultistep()) { - saveReactionWithMetadata(rxn, *merged, json_saver); + saveMultistepReaction(rxn, *merged, json_saver); } else {