icn3d 3.16.0 → 3.17.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/README.md CHANGED
@@ -1,6 +1,77 @@
1
- Python Scripts based on iCn3D
2
- =============================
1
+ icn3d
2
+ =====
3
3
 
4
- Either Python scripts in the directory "icn3dpython" or Node.js scripts in the directory "icn3dnode" can be used to analyze structures in command line <b>with one second sleep time in between</b>.
4
+ "I see in 3D" (iCn3D) Structure Viewer is not only a web-based 3D viewer, but also a structure analysis tool interactively or in the batch mode using NodeJS scripts based on the npm package icn3d. iCn3D synchronizes the display of 3D structure, 2D interaction, and 1D sequences and annotations. Users' custom display can be saved in a short URL or a PNG image. More features are listed at [iCn3D Doc](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#about).
5
+
6
+ Installation
7
+ ------------
8
+
9
+ iCn3D can be installed with the following command:
10
+
11
+ npm install icn3d
12
+
13
+ The following packages are required as shown in dependency:
14
+
15
+ npm install jquery
16
+ npm install jsdom
17
+ npm install three
18
+
19
+ Usage
20
+ --------
21
+
22
+ * <b>Use icn3d to generate Node.js scripts</b>
23
+
24
+ To use icn3d to generate Node.js scripts, the source code is from this icn3d npm package. As shown in [one example of Node.js script](https://github.com/ncbi/icn3d/blob/master/icn3dnode/interaction2.js), part of the script can be like the following. All classes and functions can be accessed with the variable "icn3dui". The class structure is listed at [iCn3D Doc](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#classstructure).
25
+
26
+ global.THREE = require('three');
27
+ let jsdom = require('jsdom');
28
+ global.$ = require('jquery')(new jsdom.JSDOM().window);
29
+
30
+ let icn3d = require('icn3d');
31
+ let icn3dui = new icn3d.iCn3DUI({});
32
+
33
+ * <b>Use icn3d as a 3D Viewer with React</b>
34
+
35
+ You can first specify the "dependencies.js" file as follows:
36
+
37
+ import * as THREE from 'icn3d/three'
38
+ import $ from 'jquery'
39
+ import 'jquery-ui-bundle';
40
+
41
+ import 'jquery-ui-bundle/jquery-ui.min.css';
42
+
43
+ global.THREE = THREE
44
+ global.$ = $
45
+ global.jQuery = $
46
+
47
+ Then specify the "icn3d-viewer.js" file as follows:
48
+
49
+ import React, { useEffect } from "react";
50
+ import './dependencies';
51
+
52
+ import * as icn3d from 'icn3d/module'
53
+ import "../node_modules/icn3d/css/icn3d.css"
54
+
55
+ function Icn3dViewer() {
56
+ useEffect(() => {
57
+ const cfg = {
58
+ divid: 'viewer',
59
+ mobilemenu: true
60
+ };
61
+ cfg['mmdbid'] = '1tup';
62
+ const icn3dui = new icn3d.iCn3DUI(cfg);
63
+ icn3dui.show3DStructure();
64
+ }, []);
65
+ return <div id="viewer"></div>;
66
+ }
67
+
68
+ export default Icn3dViewer;
69
+
70
+ * <b>Use icn3d as a 3D Viewer with jQuery</b>
71
+
72
+ The source code is available in the [iCn3D GitHub page](https://github.com/ncbi/icn3d). You can following the instruction at [iCn3D Doc](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#HowToUse). The JavaScript code could be as simple as the following:
73
+
74
+ var cfg = {'mmdbid': '1tup'};
75
+ var icn3dui = new icn3d.iCn3DUI(cfg);
76
+ icn3dui.show3DStructure();
5
77
 
6
- You can write Python scripts either based on iCn3D URLs as shown in the directory "icn3d_url", or by following the interactive steps in the directory "web_scraping", which enables you to extract any output from the UI.