Skip to content

Commit

Permalink
further draft find or create entry
Browse files Browse the repository at this point in the history
  • Loading branch information
aliaksei-chareshneu committed Jun 27, 2024
1 parent 8a4e58b commit 966bda7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export async function findOrCreateVolsegEntry(entryId: string, source: string, p
const nodes = plugin.state.data.selectQ(q => q.ofType(VolsegEntry)).map(cell => cell?.obj).filter(isDefined);
const targetNode = nodes.find(n => n.data.entryId === entryId && n.data.source === source);
debugger;
const globalStateNode = plugin.state.data.selectQ(q => q.ofType(VolsegGlobalState))[0];
if (!globalStateNode) {
await plugin.state.data.build().toRoot().apply(VolsegGlobalStateFromRoot, {}, { state: { isGhost: !DEBUGGING } }).commit();
}
if (targetNode) {
// TODO: return selector?
// return targetNode;
Expand All @@ -93,8 +97,9 @@ export async function findOrCreateVolsegEntry(entryId: string, source: string, p
// source: SourceChoice.PDSelect(),
// entryId: ParamDefinition.Text('emd-1832', { description: 'Entry identifier, including the source prefix, e.g. "emd-1832"' }),
// };
debugger;
const entryNode = await plugin.state.data.build().toRoot().apply(VolsegEntryFromRoot, entryParams).commit();
await plugin.state.data.build().to(entryNode).apply(VolsegStateFromEntry, {}, { state: { isGhost: !DEBUGGING } }).commit();
debugger;
return entryNode;
}
}
Expand Down
5 changes: 4 additions & 1 deletion molstar-extension/src/viewer/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { StateObjectRef } from 'molstar/lib/mol-state';
import { Color } from 'molstar/lib/mol-util/color';
import 'molstar/lib/mol-util/polyfill';
import { ObjectKeys } from 'molstar/lib/mol-util/type-helpers';
import { Volseg } from '../extensions/volumes-and-segmentations';
import { Volseg, findOrCreateVolsegEntry } from '../extensions/volumes-and-segmentations';
import { CVSXSpec } from '../extensions/cvsx-extension/behaviour';
import { loadCVSXFromAnything } from '../extensions/cvsx-extension';

Expand Down Expand Up @@ -195,6 +195,9 @@ export class Viewer {
plugin.builders.structure.representation.registerPreset(ViewerAutoPreset);
}
});
// const nn = await findOrCreateVolsegEntry('emd-1832', 'emdb', plugin)
// console.log(nn);
// debugger;
return new Viewer(plugin);
}

Expand Down

0 comments on commit 966bda7

Please sign in to comment.