lhasa-ligand-builder 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +18 -0
- package/LICENSE +674 -0
- package/README.md +41 -0
- package/index.html +49 -0
- package/package.json +37 -0
- package/public/.gitkeep +0 -0
- package/public/Components-inchikey.ich +48167 -0
- package/public/icons/README +7 -0
- package/public/icons/dark/layla_3c.svg +82 -0
- package/public/icons/dark/layla_4c.svg +82 -0
- package/public/icons/dark/layla_5c.svg +82 -0
- package/public/icons/dark/layla_6arom.svg +89 -0
- package/public/icons/dark/layla_6c.svg +82 -0
- package/public/icons/dark/layla_7c.svg +82 -0
- package/public/icons/dark/layla_8c.svg +82 -0
- package/public/icons/dark/layla_charge_tool.svg +78 -0
- package/public/icons/dark/layla_delete_hydrogens_tool.svg +384 -0
- package/public/icons/dark/layla_double_bond.svg +78 -0
- package/public/icons/dark/layla_format_tool.svg +283 -0
- package/public/icons/dark/layla_geometry_tool.svg +105 -0
- package/public/icons/dark/layla_key.svg +76 -0
- package/public/icons/dark/layla_move_tool.svg +110 -0
- package/public/icons/dark/layla_single_bond.svg +73 -0
- package/public/icons/dark/layla_triple_bond.svg +87 -0
- package/public/icons/dark/lhasa_delete_tool.svg +401 -0
- package/public/icons/dark/lhasa_flip_x_tool.svg +106 -0
- package/public/icons/dark/lhasa_flip_y_tool.svg +106 -0
- package/public/icons/dark/lhasa_rotate_tool.svg +112 -0
- package/public/icons/icons/hicolor_apps_scalable_coot-layla.svg +105 -0
- package/public/icons/layla_3c.svg +82 -0
- package/public/icons/layla_4c.svg +82 -0
- package/public/icons/layla_5c.svg +82 -0
- package/public/icons/layla_6arom.svg +89 -0
- package/public/icons/layla_6c.svg +82 -0
- package/public/icons/layla_7c.svg +82 -0
- package/public/icons/layla_8c.svg +82 -0
- package/public/icons/layla_charge_tool.svg +78 -0
- package/public/icons/layla_delete_hydrogens_tool.svg +384 -0
- package/public/icons/layla_double_bond.svg +78 -0
- package/public/icons/layla_format_tool.svg +283 -0
- package/public/icons/layla_geometry_tool-dark.svg +105 -0
- package/public/icons/layla_geometry_tool.svg +105 -0
- package/public/icons/layla_key.svg +76 -0
- package/public/icons/layla_move_tool.svg +110 -0
- package/public/icons/layla_single_bond.svg +73 -0
- package/public/icons/layla_triple_bond.svg +87 -0
- package/public/icons/lhasa_delete_tool.svg +401 -0
- package/public/icons/lhasa_flip_x_tool.svg +106 -0
- package/public/icons/lhasa_flip_y_tool.svg +106 -0
- package/public/icons/lhasa_rotate_tool.svg +112 -0
- package/public/lhasa.js +2 -0
- package/public/lhasa.wasm +0 -0
- package/public/react.svg +1 -0
- package/src/Lhasa.tsx +1452 -0
- package/src/assets/.gitkeep +0 -0
- package/src/bansu_integration.tsx +315 -0
- package/src/customize_mui.scss +97 -0
- package/src/inchikey_database_parse.tsx +20 -0
- package/src/index.d.ts +11 -0
- package/src/index.scss +352 -0
- package/src/main.tsx +79 -0
- package/src/qed_property_infobox.tsx +14 -0
- package/src/types.d.ts +375 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# LhasaReact
|
|
2
|
+
|
|
3
|
+
Moorhen's frontend for Lhasa - web version of Coot's ligand builder
|
|
4
|
+
|
|
5
|
+
## Installation / embedding
|
|
6
|
+
|
|
7
|
+
NPM package is coming soon.
|
|
8
|
+
Before that happens, you have to do the build yourself.
|
|
9
|
+
|
|
10
|
+
## How to build and run
|
|
11
|
+
|
|
12
|
+
LhasaReact can be used standalone, outside of Moorhen.
|
|
13
|
+
|
|
14
|
+
Lhasa is part of [Coot](https://github.com/pemsley/coot) and you need to compile the C++ WebAssembly module first.
|
|
15
|
+
|
|
16
|
+
NOTE: All build scripts are Unix scripts. On Windows, you might need to use WSL or MinGW's shell (if it works with Emscripten?)
|
|
17
|
+
|
|
18
|
+
### Building WebAssembly module
|
|
19
|
+
|
|
20
|
+
#### Tools you will need
|
|
21
|
+
|
|
22
|
+
* Emscripten
|
|
23
|
+
* meson
|
|
24
|
+
* curl, tar, etc.
|
|
25
|
+
|
|
26
|
+
Clone the [Coot](https://github.com/pemsley/coot) repo and go to `lhasa/`.
|
|
27
|
+
|
|
28
|
+
The build procedure is very much like [Moorhen](https://github.com/moorhen-coot/Moorhen)'s:
|
|
29
|
+
|
|
30
|
+
* Run `get_sources` (download C++ dependencies)
|
|
31
|
+
* Run `initial_build.sh` to build all the necessary dependencies using Emscripten
|
|
32
|
+
* Run `build_lhasa.sh` to build Lhasa WebAssembly module
|
|
33
|
+
* Copy `lhasa.js`, `lhasa.worker.js` (if it exists) and `lhasa.wasm` from `Coot/lhasa/lhbuild/` to `LhasaReact/public`
|
|
34
|
+
|
|
35
|
+
### Running LhasaReact
|
|
36
|
+
|
|
37
|
+
After you had built and copied the WebAssembly module, you can launch LhasaReact (you'll need Node.JS / npm):
|
|
38
|
+
|
|
39
|
+
* Get JS dependencies: `npm install`
|
|
40
|
+
* Run `npx vite serve`
|
|
41
|
+
* Done!
|
package/index.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/react.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Lhasa</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script>
|
|
12
|
+
window.onload = () => {
|
|
13
|
+
|
|
14
|
+
// Copied from Moorhen
|
|
15
|
+
const loadScript = (src) => {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const script = document.createElement('script')
|
|
18
|
+
// ES6 modules appear to use a different mechanism for synchronization
|
|
19
|
+
// script.setAttribute('type', 'module');
|
|
20
|
+
script.src = src
|
|
21
|
+
script.onload = () => resolve(src)
|
|
22
|
+
script.onerror = () => reject(new Error('Failed to load script: ' + src))
|
|
23
|
+
document.head.appendChild(script)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Adapted from Moorhen
|
|
28
|
+
loadScript('lhasa.js')
|
|
29
|
+
.then(src => {
|
|
30
|
+
console.log(src + ' loaded successfully.')
|
|
31
|
+
Lhasa({
|
|
32
|
+
// print(t) { console.log(["output", t]) },
|
|
33
|
+
// printErr(t) { console.error(["output", t]) }
|
|
34
|
+
})
|
|
35
|
+
.then((returnedModule) => {
|
|
36
|
+
window.LhasaModule = returnedModule;
|
|
37
|
+
const lhasaModuleAttachedEvent = new CustomEvent("lhasaModuleAttached", { });
|
|
38
|
+
document.dispatchEvent(lhasaModuleAttachedEvent);
|
|
39
|
+
})
|
|
40
|
+
.catch((e) => {
|
|
41
|
+
console.log("There was a problem creating Lhasa module:", e);
|
|
42
|
+
});
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lhasa-ligand-builder",
|
|
3
|
+
"description": "Mooren's ligand builder: React + WebAssembly version of Layla - Coot's ligand builder",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
+
"preview": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@emotion/react": "^11.14.0",
|
|
14
|
+
"@emotion/styled": "^11.14.0",
|
|
15
|
+
"@mui/icons-material": "^6.4.2",
|
|
16
|
+
"@mui/material": "^6.4.2",
|
|
17
|
+
"d3": "^7.9.0",
|
|
18
|
+
"react": "^19.0.0",
|
|
19
|
+
"react-dom": "^19.0.0",
|
|
20
|
+
"react-hotkeys": "^2.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/react": "^19.0.3",
|
|
24
|
+
"@types/react-dom": "^19.0.3",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^8.22.0",
|
|
26
|
+
"@typescript-eslint/parser": "^8.22.0",
|
|
27
|
+
"@vitejs/plugin-react-swc": "^3.7.2",
|
|
28
|
+
"eslint": "^9.19.0",
|
|
29
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
30
|
+
"eslint-plugin-react-refresh": "^0.4.18",
|
|
31
|
+
"sass": "^1.83.4",
|
|
32
|
+
"typescript": "^5.7.3",
|
|
33
|
+
"vite": "^6.0.11",
|
|
34
|
+
"vite-plugin-cross-origin-isolation": "^0.1.6",
|
|
35
|
+
"vite-plugin-top-level-await": "^1.4.4"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/public/.gitkeep
ADDED
|
File without changes
|