Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1917 Changed hydrogens layout in WASM #1918

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions api/wasm/indigo-ketcher/test/failed_unfold.ket
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"root": {
"nodes": [
{
"$ref": "mol0"
}
],
"connections": [],
"templates": []
},
"mol0": {
"type": "molecule",
"atoms": [
{
"label": "C",
"location": [
15.249374214363929,
-11.282470415521408,
0
],
"explicitValence": 8
},
{
"label": "C",
"location": [
16.25062578563607,
-11.282470415521408,
0
],
"explicitValence": 8
},
{
"label": "C",
"location": [
15.750050188048686,
-10.417529584478597,
0
],
"explicitValence": 8
}
],
"bonds": [
{
"type": 4,
"atoms": [
0,
1
],
"topology": 1
},
{
"type": 4,
"atoms": [
1,
2
],
"topology": 1
},
{
"type": 4,
"atoms": [
2,
0
],
"topology": 1
}
]
}
}
1 change: 1 addition & 0 deletions api/wasm/indigo-ketcher/test/failed_unfold_ref.ket
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"root":{"nodes":[{"$ref":"mol0"}]},"mol0":{"type":"molecule","atoms":[{"label":"C","location":[15.249374389648438,-11.282470703125,0.0],"explicitValence":8},{"label":"C","location":[16.250625610351564,-11.282470703125,0.0],"explicitValence":8},{"label":"C","location":[15.75005054473877,-10.417530059814454,0.0],"explicitValence":8},{"label":"H","location":[15.60797119140625,-12.048626899719239,0.0]},{"label":"H","location":[14.30993938446045,-10.939743995666504,0.0]},{"label":"H","location":[14.38306713104248,-11.781982421875,0.0]},{"label":"H","location":[14.76511001586914,-10.590422630310059,0.0]},{"label":"H","location":[15.075355529785157,-12.267212867736817,0.0]},{"label":"H","location":[16.734975814819337,-10.590508460998536,0.0]},{"label":"H","location":[17.190080642700197,-10.939798355102539,0.0]},{"label":"H","location":[16.42461585998535,-12.267218589782715,0.0]},{"label":"H","location":[15.892024040222168,-12.048624992370606,0.0]},{"label":"H","location":[17.116910934448243,-11.78201961517334,0.0]},{"label":"H","location":[14.908734321594239,-10.342500686645508,0.0]},{"label":"H","location":[16.59134864807129,-10.342525482177735,0.0]},{"label":"H","location":[16.51589012145996,-9.77449893951416,0.0]},{"label":"H","location":[15.750094413757325,-9.417530059814454,0.0]},{"label":"H","location":[14.98426628112793,-9.774432182312012,0.0]}],"bonds":[{"type":4,"topology":1,"atoms":[0,1]},{"type":4,"topology":1,"atoms":[1,2]},{"type":4,"topology":1,"atoms":[2,0]},{"type":1,"atoms":[0,3]},{"type":1,"atoms":[0,4]},{"type":1,"atoms":[0,5]},{"type":1,"atoms":[0,6]},{"type":1,"atoms":[0,7]},{"type":1,"atoms":[1,8]},{"type":1,"atoms":[1,9]},{"type":1,"atoms":[1,10]},{"type":1,"atoms":[1,11]},{"type":1,"atoms":[1,12]},{"type":1,"atoms":[2,13]},{"type":1,"atoms":[2,14]},{"type":1,"atoms":[2,15]},{"type":1,"atoms":[2,16]},{"type":1,"atoms":[2,17]}]}}
19 changes: 19 additions & 0 deletions api/wasm/indigo-ketcher/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,25 @@ M END
});
}

{
test("unfold-ci-error", "basic", () => {
var fs = require('fs');
let options = new indigo.MapStringString();
options.set("output-content-type", "application/json");
options.set("input-format", "chemical/x-indigo-ket");
const ket = fs.readFileSync("failed_unfold.ket");
const ket_unfold = JSON.parse(indigo.convert_explicit_hydrogens(ket, "unfold", "ket", options)).struct;

// fs.writeFileSync("failed_unfold_ref.ket", ket_unfold);

const ket_unfold_ref = fs.readFileSync("failed_unfold_ref.ket").toString();

assert.equal(ket_unfold, ket_unfold_ref);

options.delete();
});
}

// Run tests
run();
});
12 changes: 3 additions & 9 deletions core/indigo-core/layout/src/molecule_layout_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,10 @@ using namespace indigo;

IMPL_ERROR(MoleculeLayoutGraph, "layout_graph");

MoleculeLayoutGraph::MoleculeLayoutGraph() : Graph()
MoleculeLayoutGraph::MoleculeLayoutGraph()
: Graph(), _flipped(false), max_iterations(-1), layout_orientation(UNCPECIFIED), preserve_existing_layout(false), cancellation(nullptr),
_total_morgan_code(0), _first_vertex_idx(-1), _n_fixed(0), _molecule(nullptr), _molecule_edge_mapping(nullptr)
{
_total_morgan_code = 0;
_first_vertex_idx = -1;
_n_fixed = 0;
_molecule = 0;
_molecule_edge_mapping = 0;
cancellation = 0;
_flipped = false;
preserve_existing_layout = false;
}

MoleculeLayoutGraph::~MoleculeLayoutGraph()
Expand Down
Loading