Comments (15)
I just released npm icn3d 3.12.3. Please try it again and use the following to import css:
import "../node_modules/icn3d/css/icn3d.css"
from icn3d.
from icn3d.
Hi Philippe,
Apologies, I should described what ReactJS is, and our intended iCn3D use case in more detail. ReactJS itself is not the project we are working on. It is an open source framework used to build rich and interactive user interfaces built by Facebook. We use it extensively in some of our web-based projects.
I work at at the Center for Population Genomics with teams based in Melbourne and Sydney Australia. Part of our team is working on calculating missense constraint within a protein's tertiary structure using the structures predicted by AlphaFold2. We're looking at current open source structure viewers that we can embed into some of our web projects that have been built using ReactJS, one of which is based on a fork of seqr (github). Some of our requirements from a 3D structure viewer (some or all of which may already be implemented by iCn3D):
Core:
- A 3D structure display
- Ability to overlay a custom heatmap
- Ability to highlight custom sets of residues
- Ability to trigger a custom action when a residue is selected
- Compatible with declarative UI frameworks such as ReactJS
Nice but not essential:
- Analysis capabilities including:
- Selection in space
- View 3D domains, binding sites, active sites, alignments
- Display of 2 structures side by side
- Software that is extensible
Ideally we would like to contribute to an existing open source package to help implement some of these features rather than build our own.
from icn3d.
Hi Daniel,
We just released icn3d 3.11.7 at npm. Some instructions are in the section "Use icn3d as a 3D Viewer with React" in the README file. You can try it out and let us know. I am not familiar with React much. You could improve the mouse events and we'll add your feedback to the npm icn3d package. Here is the instruction:
You can specify jQuery and three.js in your HTML file by following the source code of example.html, then import "icn3d" in your React JavaScript file as shown below:
import React, { useEffect } from "react";
import * as icn3d from "icn3d/module";
function Icn3dViewer() {
useEffect(() => {
const cfg = {
divid: 'viewer',
mobilemenu: true
};
cfg['mmdbid'] = '1tup';
const icn3dui = new icn3d.iCn3DUI(cfg);
icn3dui.show3DStructure();
}, []);
return <div id="viewer"></div>;
}
export default Icn3dViewer;
from icn3d.
from icn3d.
@youkha My background is in Bioinformatics/Software Engineering, and I'm part of the software engineering team at the Centre for Population Genomics. As @tiboloic has suggested below, we'd be delighted to collaborate and contribute to iCn3D, and it would be great to set up a Zoom call at some point to discuss this in more details with the other members of our team. I'll leave further correspondence to Loic at this point.
@jiywang3 Thank you for your solution. Unfortunately it won't work because threejs, jquery and jquery-ui need to be available at compile time when React compiles and transpiles the source files into a single bundle. This is what worked for me:
dependencies.js
import * as THREE from 'three'
import $ from 'jquery'
import 'jquery-ui-bundle';
import 'jquery-ui-bundle/jquery-ui.min.css';
global.THREE = THREE
global.$ = $
global.jQuery = $
icn3d-viewer.css
@import url('https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.css');
icn3d-viewer.js
import React, { useEffect } from "react";
import './dependencies'
import * as icn3d from 'icn3d/module'
import './icn3d-viewer.css';
function Icn3dViewer() {
useEffect(() => {
const cfg = {
divid: 'icn3d-viewer',
width: '100%',
height: '100%',
resize: true,
rotate: 'right',
mobilemenu: true,
showcommand: false,
showtitle: false
};
cfg['mmdbid'] = '1tup';
const icn3dui = new icn3d.iCn3DUI(cfg);
icn3dui.show3DStructure();
}, [])
return <div id="icn3d-viewer" />;
}
export default Icn3dViewer
My two questions are:
- Would it be possible to include the CSS file in the npm package so that users can import it from there rather than a url? That way any changes to the CSS can be version controlled via npm.
- The solution works and renders, but now I am seeing a lot of WebGL errors in the console causing performance issues. When I googled the error I found this thread that you started https://discourse.threejs.org/t/shader-error-in-the-section-lights-physical-fragment/34246. It seems like you have encountered this error in the past. Do you have any suggestions on what might be causing it, or a possible solution?
from icn3d.
Dear Philippe and Jiyao,
I am a colleague of Daniel at the Centre for Population Genomics. I am a statistical geneticist and I lead the development of a new method to identify 3D regions in proteins depleted in missense variation.
We are delighted at the opportunity to collaborate on iCn3D and more generally on open Tools for Shareable Protein Analysis. We have a couple of ideas we could contribute to the protein codeathon and we would be keen to participate.
A challenge might be the need to work asynchronously given our respective time zones: I will be in France during the codeathon, the rest of the team will be in Australia and you will be based in Madison, WI.
I will send you an email today to take this conversation off github.
All the best
Loïc
from icn3d.
Hi Daniel,
Thanks for the feedback. Now you can get icn3d.css and the modified three.module.js from npm icn3d. The instruction is updated at https://www.npmjs.com/package/icn3d. Here are the details. Please let me know if you have any problems such as mouse functions.
You can first specify the "dependencies.js" file as follows:
import * as THREE from 'icn3d/three'
import $ from 'jquery'
import 'jquery-ui-bundle';
import 'jquery-ui-bundle/jquery-ui.min.css';
global.THREE = THREE
global.$ = $
global.jQuery = $
Then specify the "icn3d-viewer.js" file as follows:
import React, { useEffect } from "react";
import './dependencies';
import * as icn3d from 'icn3d/module'
import * from 'icn3d/css'
function Icn3dViewer() {
useEffect(() => {
const cfg = {
divid: 'viewer',
mobilemenu: true
};
cfg['mmdbid'] = '1tup';
const icn3dui = new icn3d.iCn3DUI(cfg);
icn3dui.show3DStructure();
}, []);
return <div id="viewer"></div>;
}
export default Icn3dViewer;
from icn3d.
I'm seeing compile errors because the css file in the npm package contains //
comments which are invalid. Are you able to replace these comments with the standard /* comment goes here */
style? Thanks for the quick updates!
from icn3d.
Could you modify the file icn3d.css in your node_modules/icn3d directory and try it again? I suspect there may be issues related to mouse functions and will fix them together.
from icn3d.
npm icn3d 3.12.0 was just released with the fix in css. You can try it again.
from icn3d.
Thanks Jiyao, I've tried the new release but unfortunately it does not work. Most of the errors relate to missing image and font assets, however one relates to a repeated declaration of the class GLTFLoader
.
Failed to compile.
SyntaxError: ./node_modules/icn3d/icn3d.module.js: Identifier 'GLTFLoader' has already been declared. (50311:6)
50309 | */
50310 |
> 50311 | class GLTFLoader extends THREE.Loader {
| ^
50312 |
50313 | constructor( manager ) {
50314 |
ERROR in ./node_modules/icn3d/icn3d.module.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: ./node_modules/icn3d/icn3d.module.js: Identifier 'GLTFLoader' has already been declared. (50311:6)
50309 | */
50310 |
> 50311 | class GLTFLoader extends THREE.Loader {
| ^
50312 |
50313 | constructor( manager ) {
50314 |
at instantiate (./node_modules/@babel/parser/lib/index.js:72:32)
at constructor (./node_modules/@babel/parser/lib/index.js:358:12)
at Parser.raise (./node_modules/@babel/parser/lib/index.js:3334:19)
at ScopeHandler.checkRedeclarationInScope (./node_modules/@babel/parser/lib/index.js:3518:19)
at ScopeHandler.declareName (./node_modules/@babel/parser/lib/index.js:3484:12)
at Parser.declareNameFromIdentifier (./node_modules/@babel/parser/lib/index.js:12059:16)
at Parser.parseClassId (./node_modules/@babel/parser/lib/index.js:15759:14)
at Parser.parseClass (./node_modules/@babel/parser/lib/index.js:15376:10)
at Parser.parseStatementContent (./node_modules/@babel/parser/lib/index.js:14597:21)
at Parser.parseStatement (./node_modules/@babel/parser/lib/index.js:14549:17)
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 5:36-82
Module not found: Error: Can't resolve 'color-picker-h.png' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 6:36-83
Module not found: Error: Can't resolve 'color-picker-sv.png' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 7:36-91
Module not found: Error: Can't resolve 'lib/fonts/la-brands-400.eot' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 8:36-93
Module not found: Error: Can't resolve 'lib/fonts/la-brands-400.woff2' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 9:36-92
Module not found: Error: Can't resolve 'lib/fonts/la-brands-400.woff' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 10:36-91
Module not found: Error: Can't resolve 'lib/fonts/la-brands-400.ttf' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 11:36-91
Module not found: Error: Can't resolve 'lib/fonts/la-brands-400.svg' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 12:36-92
Module not found: Error: Can't resolve 'lib/fonts/la-regular-400.eot' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 13:36-94
Module not found: Error: Can't resolve 'lib/fonts/la-regular-400.woff2' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 14:36-93
Module not found: Error: Can't resolve 'lib/fonts/la-regular-400.woff' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 15:37-93
Module not found: Error: Can't resolve 'lib/fonts/la-regular-400.ttf' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 16:37-93
Module not found: Error: Can't resolve 'lib/fonts/la-regular-400.svg' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 17:37-91
Module not found: Error: Can't resolve 'lib/fonts/la-solid-900.eot' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 18:37-93
Module not found: Error: Can't resolve 'lib/fonts/la-solid-900.woff2' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 19:37-92
Module not found: Error: Can't resolve 'lib/fonts/la-solid-900.woff' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 20:37-91
Module not found: Error: Can't resolve 'lib/fonts/la-solid-900.ttf' in './node_modules/icn3d'
ERROR in ./node_modules/icn3d/icn3d.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/icn3d/icn3d.css) 21:37-91
Module not found: Error: Can't resolve 'lib/fonts/la-solid-900.svg' in './node_modules/icn3d'
webpack compiled with 18 errors
from icn3d.
The integration of iCn3D in React framework is working.
from icn3d.
Thank you for all your help! It's integrating nicely with React now.
from icn3d.
from icn3d.
Related Issues (20)
- What do the colors mean for B factor? HOT 1
- Legends do not appear for hydrophobicity if Wimley-White is chosen HOT 1
- secondary structures are not being expressed in web page HOT 4
- The 3D structure information for mutations doesn't always match the info in the 2D representation HOT 1
- URL not displaying desired annotation HOT 1
- Mutation annotations HOT 6
- Bonds between atoms are appearing as thick black tubes HOT 2
- MTZ maps don't load properly /don't behave the same as other formats HOT 6
- Viewing predicted mutations in aligned structures HOT 3
- Ideas for improving the cartoon HOT 6
- Open AlphaFold PAE file with latest result file HOT 2
- Chemical display isn't right HOT 7
- Unable to show selected chemicals when using Chrome HOT 3
- Customize menus doesn't work as expected HOT 3
- Is there a command or function that can enable to display PAE map? HOT 2
- Inquiry drawing drawing a path from one residue to another residue HOT 9
- Legend - Coloring by Atom - show complete names HOT 2
- Please fix the spelling in Legend for Color by Charge HOT 1
- The hydrophocity legend should contain information about hydrophobicity HOT 1
- Color by Residue legend has uracil spelled wrong and is missing the X HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icn3d.