Skip to content

Commit

Permalink
feature-density: default to wireframe
Browse files Browse the repository at this point in the history
  • Loading branch information
sbittrich committed Oct 20, 2023
1 parent 17f4760 commit 60dd13d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
14 changes: 11 additions & 3 deletions src/viewer/helpers/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ type FeatureDensityProps = {
kind: 'feature-density',
target: Target,
radius?: number,
hiddenChannels?: string[]
hiddenChannels?: string[],
wireframe?: boolean,
} & BaseProps

export type MotifProps = {
Expand Down Expand Up @@ -295,7 +296,7 @@ export const RcsbPreset = TrajectoryHierarchyPresetProvider({
const target = chainMode ? loci : StructureElement.Loci.firstResidue(loci);

if (p.kind === 'feature-density') {
await initVolumeStreaming(plugin, structure, { overrideRadius: p.radius || 0, hiddenChannels: p.hiddenChannels || ['fo-fc(+ve)', 'fo-fc(-ve)'] });
await initVolumeStreaming(plugin, structure, { overrideRadius: p.radius ?? 5, hiddenChannels: p.hiddenChannels ?? [], wireframe: p.wireframe ?? true });
}

plugin.managers.structure.focus.setFromLoci(target);
Expand Down Expand Up @@ -406,13 +407,20 @@ function determineAssemblyId(traj: any, p: MotifProps) {
Object.assign(p, { assemblyId: '1' });
}

async function initVolumeStreaming(plugin: PluginContext, structure: StructureObject, props?: { overrideRadius?: number, hiddenChannels: string[] }) {
async function initVolumeStreaming(plugin: PluginContext, structure: StructureObject, props?: { overrideRadius?: number, hiddenChannels: string[], wireframe?: boolean }) {
if (!structure?.cell?.parent) return;

const volumeRoot = StateSelection.findTagInSubtree(structure.cell.parent.tree, structure.cell.transform.ref, VolumeStreaming.RootTag);
if (!volumeRoot) {
const state = plugin.state.data;
const params = PD.getDefaultValues(InitVolumeStreaming.definition.params!(structure.obj!, plugin));
// RO-4085: allow switching to wireframe
if (props?.wireframe) {
params.options.channelParams['em'] = { wireframe: true };
params.options.channelParams['2fo-fc'] = { wireframe: true };
params.options.channelParams['fo-fc(+ve)'] = { wireframe: true };
params.options.channelParams['fo-fc(-ve)'] = { wireframe: true };
}
await plugin.runTask(state.applyAction(InitVolumeStreaming, params, structure.ref));

// RO-2751: allow to specify radius of shown density
Expand Down
21 changes: 18 additions & 3 deletions src/viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ <h2> RCSB PDB Mol* Viewer - Test Page</h2>
labelAsymId: 'D',
authSeqId: 502
},
// radius: 0,
// hiddenChannels: ['fo-fc(+ve)', 'fo-fc(-ve)']
radius: 0,
hiddenChannels: ['fo-fc(+ve)', 'fo-fc(-ve)']
}
}
},
Expand Down Expand Up @@ -659,7 +659,22 @@ <h2> RCSB PDB Mol* Viewer - Test Page</h2>
assemblyId: '1'
}
}
}
},
{
id: '5UJC',
info: 'Ligand wireframe: Crystal structure of a C.elegans B12-trafficking protein CblC, a human MMACHC homologue',
config: {
props: {
kind: 'feature-density',
radius: 5,
hiddenChannels: [],
wireframe: true,
target: {
labelAsymId: 'B'
}
}
}
},
];

const examplesSelect = document.getElementById('examples');
Expand Down

0 comments on commit 60dd13d

Please sign in to comment.