Skip to content

Commit

Permalink
#2309 - Update layout for pathway reaction on canvas (#2439)
Browse files Browse the repository at this point in the history
  • Loading branch information
even1024 authored Oct 2, 2024
1 parent 498f603 commit 0669a87
Show file tree
Hide file tree
Showing 24 changed files with 116 additions and 63 deletions.
2 changes: 1 addition & 1 deletion api/c/indigo/src/indigo_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ CEXPORT int indigoLayout(int object)
BaseReaction& rxn = obj.getBaseReaction();
if (rxn.isPathwayReaction())
{
PathwayLayout pl(static_cast<PathwayReaction&>(rxn));
PathwayLayout pl(static_cast<PathwayReaction&>(rxn), self.layout_options);
pl.make();
}
else
Expand Down
1 change: 1 addition & 0 deletions api/c/indigo/src/indigo_reaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ CEXPORT int indigoLoadReaction(int source)
loader.ignore_noncritical_query_features = self.ignore_noncritical_query_features;
loader.dearomatize_on_load = self.dearomatize_on_load;
loader.arom_options = self.arom_options;
loader.layout_options = self.layout_options;
auto rxn = loader.loadReaction(false);
std::unique_ptr<IndigoBaseReaction> rxnptr;
if (rxn->isPathwayReaction())
Expand Down
5 changes: 2 additions & 3 deletions api/c/indigo/src/indigo_savers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,9 @@ CEXPORT int indigoSaveCdxml(int item, int output)
if (IndigoBaseReaction::is(obj))
{
ReactionCdxmlSaver saver(out);
if (obj.type == IndigoObject::REACTION)
if (obj.type == IndigoObject::REACTION || obj.type == IndigoObject::PATHWAY_REACTION)
{
Reaction& rxn = obj.getReaction();
saver.saveReaction(rxn);
saver.saveReaction(obj.getBaseReaction());
}
else if (obj.type == IndigoObject::QUERY_REACTION)
{
Expand Down
4 changes: 2 additions & 2 deletions api/tests/integration/tests/layout/ref/balance.ket
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
{
"label": "C",
"location": [
6.40000057220459,
6.400000095367432,
0.7999999523162842,
0.0
]
Expand All @@ -123,7 +123,7 @@
{
"label": "C",
"location": [
6.40000057220459,
6.400000095367432,
-0.7999999523162842,
0.0
]
Expand Down
2 changes: 1 addition & 1 deletion api/tests/integration/tests/reaction/pathway.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def find_diff(a, b):
# with open(os.path.join(ref_path, filename) + ".ket", "w") as file:
# file.write(rxn_txt)

rxn_ref = open(os.path.join(ref_path, filename) + ".ket", "r").read()
rxn_ref = open(getRefFilepath(filename + ".ket"), "r").read()

diff = find_diff(rxn_ref, rxn_txt)
if not diff:
Expand Down
2 changes: 1 addition & 1 deletion api/tests/integration/tests/reaction/ref/pathway1.ket
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"root":{"nodes":[{"$ref":"mol0"},{"$ref":"mol1"},{"$ref":"mol2"},{"$ref":"mol3"},{"$ref":"mol4"},{"$ref":"mol5"},{"type":"multi-tailed-arrow","data":{"head":{"position":{"x":10.887200355529786,"y":6.029025077819824,"z":0.0}},"spine":{"pos":[{"x":9.887200355529786,"y":10.788000106811524,"z":0.0},{"x":9.887200355529786,"y":1.2700501680374146,"z":0.0}]},"tails":{"pos":[{"x":9.387200355529786,"y":10.788000106811524,"z":0.0},{"x":9.387200355529786,"y":6.164050102233887,"z":0.0},{"x":9.387200355529786,"y":1.2700501680374146,"z":0.0}]},"zOrder":0}},{"type":"multi-tailed-arrow","data":{"head":{"position":{"x":4.789100646972656,"y":10.788000106811524,"z":0.0}},"spine":{"pos":[{"x":3.230299949645996,"y":12.923049926757813,"z":0.0},{"x":3.230299949645996,"y":8.652950286865235,"z":0.0}]},"tails":{"pos":[{"x":2.730299949645996,"y":12.923049926757813,"z":0.0},{"x":2.730299949645996,"y":8.652950286865235,"z":0.0}]},"zOrder":0}}]},"mol0":{"type":"molecule","atoms":[{"label":"C","location":[0.0,9.152899742126465,0.0]},{"label":"C","location":[1.730299949645996,9.153399467468262,0.0]},{"label":"C","location":[0.8668000102043152,9.652999877929688,0.0]},{"label":"C","location":[1.730299949645996,8.152399063110352,0.0]},{"label":"C","location":[0.0,8.147899627685547,0.0]},{"label":"C","location":[0.8690000176429749,7.652899742126465,0.0]}],"bonds":[{"type":2,"atoms":[2,0]},{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,5]},{"type":1,"atoms":[5,3]},{"type":2,"atoms":[3,1]},{"type":1,"atoms":[1,2]}]},"mol1":{"type":"molecule","atoms":[{"label":"C","location":[0.9205999374389648,13.693100929260254,0.0]},{"label":"C","location":[1.4210000038146973,12.153000831604004,0.0]},{"label":"C","location":[1.730299949645996,13.099300384521485,0.0]},{"label":"C","location":[0.4203000068664551,12.153000831604004,0.0]},{"label":"C","location":[0.1108999252319336,13.099300384521485,0.0]}],"bonds":[{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,3]},{"type":1,"atoms":[3,1]},{"type":2,"atoms":[1,2]},{"type":1,"atoms":[2,0]}]},"mol2":{"type":"molecule","atoms":[{"label":"C","location":[5.789100646972656,11.287999153137207,0.0]},{"label":"C","location":[5.789100646972656,10.287999153137207,0.0]},{"label":"C","location":[6.6551008224487309,9.787999153137207,0.0]},{"label":"C","location":[7.521200180053711,10.287999153137207,0.0]},{"label":"C","location":[7.521200180053711,11.287999153137207,0.0]},{"label":"C","location":[6.6551008224487309,11.787999153137207,0.0]},{"label":"C","location":[8.387200355529786,11.787999153137207,0.0]}],"bonds":[{"type":1,"atoms":[5,0]},{"type":1,"atoms":[0,1]},{"type":1,"atoms":[1,2]},{"type":1,"atoms":[2,3]},{"type":1,"atoms":[3,4]},{"type":1,"atoms":[4,5]},{"type":1,"atoms":[4,6]}]},"mol3":{"type":"molecule","atoms":[{"label":"C","location":[7.387200355529785,1.54010009765625,0.0]},{"label":"C","location":[7.887600898742676,0.0,0.0]},{"label":"C","location":[8.19680118560791,0.9463005065917969,0.0]},{"label":"C","location":[6.8867998123168949,0.0,0.0]},{"label":"C","location":[6.577500343322754,0.9463005065917969,0.0]},{"label":"C","location":[7.387200355529785,2.540100574493408,0.0]},{"label":"C","location":[8.387200355529786,2.540100574493408,0.0]}],"bonds":[{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,3]},{"type":1,"atoms":[3,1]},{"type":2,"atoms":[1,2]},{"type":1,"atoms":[2,0]},{"type":2,"atoms":[0,5]},{"type":1,"atoms":[5,6]}]},"mol4":{"type":"molecule","atoms":[{"label":"C","location":[6.196199893951416,6.670499801635742,0.0]},{"label":"C","location":[6.980099678039551,7.288000106811523,0.0]},{"label":"C","location":[7.953099727630615,7.065500259399414,0.0]},{"label":"C","location":[8.387199401855469,6.169699668884277,0.0]},{"label":"C","location":[6.201699733734131,5.663300514221191,0.0]},{"label":"C","location":[7.953799724578857,5.262599945068359,0.0]},{"label":"C","location":[6.980099678039551,5.04010009765625,0.0]},{"label":"C","location":[5.230299949645996,6.929300308227539,0.0]}],"bonds":[{"type":1,"atoms":[1,0]},{"type":1,"atoms":[0,4]},{"type":1,"atoms":[4,6]},{"type":1,"atoms":[6,5]},{"type":1,"atoms":[5,3]},{"type":1,"atoms":[3,2]},{"type":1,"atoms":[2,1]},{"type":1,"atoms":[0,7]}]},"mol5":{"type":"molecule","atoms":[{"label":"C","location":[12.753199577331543,6.882475852966309,0.0]},{"label":"C","location":[14.483498573303223,6.8829755783081059,0.0]},{"label":"C","location":[13.619999885559082,7.382575988769531,0.0]},{"label":"C","location":[14.483498573303223,5.882075309753418,0.0]},{"label":"C","location":[12.753199577331543,5.877575874328613,0.0]},{"label":"C","location":[13.622199058532715,5.382575988769531,0.0]},{"label":"C","location":[11.887200355529786,5.377575874328613,0.0]},{"label":"C","location":[12.915099143981934,4.67547607421875,0.0]},{"label":"C","location":[15.190600395202637,5.174975395202637,0.0]}],"bonds":[{"type":2,"atoms":[2,0]},{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,5]},{"type":1,"atoms":[5,3]},{"type":2,"atoms":[3,1]},{"type":1,"atoms":[1,2]},{"type":1,"atoms":[4,6]},{"type":2,"atoms":[5,7]},{"type":1,"atoms":[3,8]}]}}
{"root":{"nodes":[{"$ref":"mol0"},{"$ref":"mol1"},{"$ref":"mol2"},{"$ref":"mol3"},{"$ref":"mol4"},{"$ref":"mol5"},{"type":"multi-tailed-arrow","data":{"head":{"position":{"x":27.02608871459961,"y":7.66407585144043,"z":0.0}},"spine":{"pos":[{"x":18.49831199645996,"y":12.423049926757813,"z":0.0},{"x":18.49831199645996,"y":2.9051003456115724,"z":0.0}]},"tails":{"pos":[{"x":17.99831199645996,"y":12.423049926757813,"z":0.0},{"x":17.99831199645996,"y":7.529049873352051,"z":0.0},{"x":17.99831199645996,"y":2.9051003456115724,"z":0.0}]},"zOrder":0}},{"type":"multi-tailed-arrow","data":{"head":{"position":{"x":12.452522277832032,"y":2.9051003456115724,"z":0.0}},"spine":{"pos":[{"x":3.9247453212738039,"y":5.040150165557861,"z":0.0},{"x":3.9247453212738039,"y":0.770050048828125,"z":0.0}]},"tails":{"pos":[{"x":3.4247453212738039,"y":5.040150165557861,"z":0.0},{"x":3.4247453212738039,"y":0.770050048828125,"z":0.0}]},"zOrder":0}}]},"mol0":{"type":"molecule","atoms":[{"label":"C","location":[0.5000004768371582,5.54010009765625,0.0]},{"label":"C","location":[2.2303004264831545,5.540599822998047,0.0]},{"label":"C","location":[1.3668005466461182,6.040200233459473,0.0]},{"label":"C","location":[2.2303004264831545,4.539599895477295,0.0]},{"label":"C","location":[0.5000004768371582,4.535099983215332,0.0]},{"label":"C","location":[1.3690004348754883,4.04010009765625,0.0]}],"bonds":[{"type":2,"atoms":[2,0]},{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,5]},{"type":1,"atoms":[5,3]},{"type":2,"atoms":[3,1]},{"type":1,"atoms":[1,2]}]},"mol1":{"type":"molecule","atoms":[{"label":"C","location":[1.3651504516601563,1.54010009765625,0.0]},{"label":"C","location":[1.8655505180358887,0.0,0.0]},{"label":"C","location":[2.1748504638671877,0.9463000297546387,0.0]},{"label":"C","location":[0.8648505210876465,0.0,0.0]},{"label":"C","location":[0.555450439453125,0.9463000297546387,0.0]}],"bonds":[{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,3]},{"type":1,"atoms":[3,1]},{"type":2,"atoms":[1,2]},{"type":1,"atoms":[2,0]}]},"mol2":{"type":"molecule","atoms":[{"label":"C","location":[13.926365852355957,3.4051008224487306,0.0]},{"label":"C","location":[13.926365852355957,2.4051008224487306,0.0]},{"label":"C","location":[14.792366027832032,1.9051008224487305,0.0]},{"label":"C","location":[15.658465385437012,2.4051008224487306,0.0]},{"label":"C","location":[15.658465385437012,3.4051008224487306,0.0]},{"label":"C","location":[14.792366027832032,3.9051008224487306,0.0]},{"label":"C","location":[16.524465560913087,3.9051008224487306,0.0]}],"bonds":[{"type":1,"atoms":[5,0]},{"type":1,"atoms":[0,1]},{"type":1,"atoms":[1,2]},{"type":1,"atoms":[2,3]},{"type":1,"atoms":[3,4]},{"type":1,"atoms":[4,5]},{"type":1,"atoms":[4,6]}]},"mol3":{"type":"molecule","atoms":[{"label":"C","location":[15.130267143249512,12.693099975585938,0.0]},{"label":"C","location":[15.630667686462403,11.152999877929688,0.0]},{"label":"C","location":[15.939867973327637,12.099300384521485,0.0]},{"label":"C","location":[14.629866600036621,11.152999877929688,0.0]},{"label":"C","location":[14.32056713104248,12.099300384521485,0.0]},{"label":"C","location":[15.130267143249512,13.693099975585938,0.0]},{"label":"C","location":[16.130268096923829,13.693099975585938,0.0]}],"bonds":[{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,3]},{"type":1,"atoms":[3,1]},{"type":2,"atoms":[1,2]},{"type":1,"atoms":[2,0]},{"type":2,"atoms":[0,5]},{"type":1,"atoms":[5,6]}]},"mol4":{"type":"molecule","atoms":[{"label":"C","location":[14.61286735534668,8.035500526428223,0.0]},{"label":"C","location":[15.396766662597657,8.653000831604004,0.0]},{"label":"C","location":[16.369766235351564,8.430500984191895,0.0]},{"label":"C","location":[16.80386734008789,7.534700393676758,0.0]},{"label":"C","location":[14.618367195129395,7.028301239013672,0.0]},{"label":"C","location":[16.370468139648439,6.62760066986084,0.0]},{"label":"C","location":[15.396766662597657,6.4051008224487309,0.0]},{"label":"C","location":[13.646966934204102,8.29430103302002,0.0]}],"bonds":[{"type":1,"atoms":[1,0]},{"type":1,"atoms":[0,4]},{"type":1,"atoms":[4,6]},{"type":1,"atoms":[6,5]},{"type":1,"atoms":[5,3]},{"type":1,"atoms":[3,2]},{"type":1,"atoms":[2,1]},{"type":1,"atoms":[0,7]}]},"mol5":{"type":"molecule","atoms":[{"label":"C","location":[29.086532592773439,8.517525672912598,0.0]},{"label":"C","location":[30.816831588745118,8.518025398254395,0.0]},{"label":"C","location":[29.953332901000978,9.01762580871582,0.0]},{"label":"C","location":[30.816831588745118,7.517125129699707,0.0]},{"label":"C","location":[29.086532592773439,7.512625694274902,0.0]},{"label":"C","location":[29.95553207397461,7.01762580871582,0.0]},{"label":"C","location":[28.22053337097168,7.012625694274902,0.0]},{"label":"C","location":[29.248432159423829,6.310525894165039,0.0]},{"label":"C","location":[31.52393341064453,6.810025215148926,0.0]}],"bonds":[{"type":2,"atoms":[2,0]},{"type":1,"atoms":[0,4]},{"type":2,"atoms":[4,5]},{"type":1,"atoms":[5,3]},{"type":2,"atoms":[3,1]},{"type":1,"atoms":[1,2]},{"type":1,"atoms":[4,6]},{"type":2,"atoms":[5,7]},{"type":1,"atoms":[3,8]}]}}
Loading

0 comments on commit 0669a87

Please sign in to comment.