Skip to content

Commit

Permalink
Test with chain
Browse files Browse the repository at this point in the history
  • Loading branch information
p3rcypj committed Dec 5, 2024
1 parent 6b7668e commit 6e10fd1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/3dbio_viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"typescript": "4.5.4"
},
"scripts": {
"start": "export NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
"start": "react-scripts start",
"build-inline": "react-scripts build",
"test": "react-scripts test",
"test:nowatch": "react-scripts test --watchAll=false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export function usePluginRef(options: Options) {
const pluginAlreadyRendered = Boolean(pdbePlugin);
const ligandChanged =
currentSelection && currentSelection.ligandId !== newSelection.ligandId;
const chainChanged =
currentSelection && currentSelection.chainId !== newSelection.chainId;

if (!ligandChanged && pluginAlreadyRendered) return;

Expand Down Expand Up @@ -114,21 +116,21 @@ export function usePluginRef(options: Options) {
updateLoader(loaderKeys.initPlugin, loadComplete);
}

function subscribeSequenceComplete() {
const sequenceComplete = new Promise<void>((resolve, reject) => {
plugin.events.sequenceComplete.subscribe({
next: sequence => {
console.debug("molstar.events.sequenceComplete", sequence);
},
error: err => {
console.error(err);
reject(err);
},
});
});
// function subscribeSequenceComplete() {
// const sequenceComplete = new Promise<void>((resolve, reject) => {
// plugin.events.sequenceComplete.subscribe({
// next: sequence => {
// console.debug("molstar.events.sequenceComplete", sequence);
// },
// error: err => {
// console.error(err);
// reject(err);
// },
// });
// });

updateLoader(loaderKeys.readingSequence, sequenceComplete);
}
// updateLoader(loaderKeys.readingSequence, sequenceComplete);
// }

async function loadFromUploadData(element: HTMLDivElement) {
if (!uploadDataToken) {
Expand Down Expand Up @@ -193,6 +195,10 @@ export function usePluginRef(options: Options) {
.catch(err => loadVoidMolstar(err));
}

if (chainChanged && pluginAlreadyRendered && newSelection.chainId) {
plugin.visual.updateSequence(newSelection.chainId);
}

if (pluginAlreadyRendered) {
//When ligand has changed
molstarState.current = MolstarStateActions.fromInitParams(initParams, newSelection);
Expand All @@ -210,7 +216,7 @@ export function usePluginRef(options: Options) {
}
} else if (!mainPdb && emdbId) getPdbFromEmdb(emdbId);
else {
subscribeSequenceComplete();
// subscribeSequenceComplete();
subscribeLoadComplete();
const pdbId = initParams.moleculeId;
if (pdbId) loadFromPdb(pdbId, element);
Expand Down

0 comments on commit 6e10fd1

Please sign in to comment.