Browse Source

cellpack tweaks

Alexander Rose 5 years ago
parent
commit
f2b20a646e

+ 1 - 2
src/apps/viewer/extensions/cellpack/model.ts

@@ -313,8 +313,7 @@ async function loadHivMembrane(plugin: PluginContext, runtime: RuntimeContext, s
         .apply(StateTransforms.Model.TrajectoryFromMmCif, undefined, { state: { isGhost: true } })
         .apply(StateTransforms.Model.ModelFromTrajectory, undefined, { state: { isGhost: true } })
         .apply(StateTransforms.Model.StructureFromModel)
-    const membraneObj = await state.updateTree(membraneBuilder).runInContext(runtime)
-    console.log(membraneObj.data)
+    await state.updateTree(membraneBuilder).runInContext(runtime)
 
     const membraneParams = {
         representation: params.preset.representation,

+ 1 - 2
src/apps/viewer/extensions/cellpack/preset.ts

@@ -65,13 +65,12 @@ export const CellpackMembranePreset = StructureRepresentationPresetProvider({
     async apply(ref, params, plugin) {
         const structureCell = StateObjectRef.resolveAndCheck(plugin.state.data, ref);
         if (!structureCell) return {};
-        console.log(ref, structureCell)
 
         const reprProps = {
             ignoreHydrogens: true,
         };
         const components = {
-            membrane: await presetStaticComponent(plugin, structureCell, 'all')
+            membrane: await presetStaticComponent(plugin, structureCell, 'all', { label: 'Membrane' })
         };
 
         if (params.representation === 'gaussian-surface') {

+ 4 - 4
src/mol-plugin-state/builder/structure/representation-preset.ts

@@ -244,12 +244,12 @@ const atomicDetail = StructureRepresentationPresetProvider({
     }
 });
 
-export function presetStaticComponent(plugin: PluginContext, structure: StateObjectRef<PluginStateObject.Molecule.Structure>, type: StaticStructureComponentType) {
-    return plugin.builders.structure.tryCreateComponentStatic(structure, type, `static-${type}`);
+export function presetStaticComponent(plugin: PluginContext, structure: StateObjectRef<PluginStateObject.Molecule.Structure>, type: StaticStructureComponentType, params?: { label?: string, tags?: string[] }) {
+    return plugin.builders.structure.tryCreateComponentStatic(structure, type, `static-${type}`, params);
 }
 
-export function presetSelectionComponent(plugin: PluginContext, structure: StateObjectRef<PluginStateObject.Molecule.Structure>, query: keyof typeof Q) {
-    return plugin.builders.structure.tryCreateComponentFromSelection(structure, Q[query], `selection-${query}`);
+export function presetSelectionComponent(plugin: PluginContext, structure: StateObjectRef<PluginStateObject.Molecule.Structure>, query: keyof typeof Q, params?: { label?: string, tags?: string[] }) {
+    return plugin.builders.structure.tryCreateComponentFromSelection(structure, Q[query], `selection-${query}`, params);
 }
 
 export const PresetStructureRepresentations = {