This commit is contained in:
Alexander Rose
2026-03-01 10:58:57 -08:00
4 changed files with 55 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ Note that since we don't clearly distinguish between a public and private interf
- Add `Structure.coordination` sites
- Add `Polyhedron` representation showing coordination sites
- Guard against `xr-spatial-tracking` blocked in `Permissions-Policy`
- Add `putty` as a mol-view-spec representation.
## [v5.6.1] - 2026-01-23
- Disable occlusion culling in `ImagePass` (#1758)

View File

@@ -405,6 +405,15 @@ function representationPropsBase(node: MolstarSubtree<'representation'>): Partia
sizeTheme: { name: 'physical', params: { scale: params.size_factor } },
};
}
case 'putty': {
const sizeTheme = params.size_theme ?? 'uniform';
return {
type: { name: 'putty', params: { alpha, sizeFactor: params.size_factor } },
sizeTheme: sizeTheme === 'uncertainty'
? { name: 'uncertainty', params: {} }
: { name: 'uniform', params: { value: params.size_factor } },
};
}
default:
throw new Error('NotImplementedError');
}

View File

@@ -3,6 +3,7 @@
*
* @author Adam Midlik <midlik@gmail.com>
* @author David Sehnal <david.sehnal@gmail.com>
* @author Zachary Charlop-Powers <zach.charlop.powers@gmail.com>
*/
import { MVSData } from '../../../mvs-data';
@@ -17,6 +18,42 @@ describe('mvs-builder', () => {
expect(MVSData.validationIssues(mvsData)).toEqual(undefined);
});
it('putty representation works', () => {
const builder = createMVSBuilder();
builder
.download({ url: 'https://files.rcsb.org/download/1cbs.cif' })
.parse({ format: 'mmcif' })
.modelStructure()
.component({ selector: 'polymer' })
.representation({ type: 'putty' });
const state = builder.getState();
expect(MVSData.validationIssues(state)).toEqual(undefined);
});
it('putty representation works with uniform size_theme', () => {
const builder = createMVSBuilder();
builder
.download({ url: 'https://files.rcsb.org/download/1cbs.cif' })
.parse({ format: 'mmcif' })
.modelStructure()
.component({ selector: 'polymer' })
.representation({ type: 'putty', size_theme: 'uniform', size_factor: 0.5 });
const state = builder.getState();
expect(MVSData.validationIssues(state)).toEqual(undefined);
});
it('putty representation works with uncertainty size_theme', () => {
const builder = createMVSBuilder();
builder
.download({ url: 'https://files.rcsb.org/download/1cbs.cif' })
.parse({ format: 'mmcif' })
.modelStructure()
.component({ selector: 'polymer' })
.representation({ type: 'putty', size_theme: 'uncertainty' });
const state = builder.getState();
expect(MVSData.validationIssues(state)).toEqual(undefined);
});
it('volume builder works', () => {
const builder = createMVSBuilder();
builder

View File

@@ -46,6 +46,13 @@ const Carbohydrate = {
size_factor: OptionalField(float, 1, 'Scales the corresponding visuals.'),
};
const Putty = {
/** Scales the corresponding visuals */
size_factor: OptionalField(float, 1, 'Scales the corresponding visuals.'),
/** Controls how the tube radius is determined. */
size_theme: OptionalField(literal('uniform', 'uncertainty'), 'uniform', "Controls how the tube radius is determined. 'uniform' uses a constant radius scaled by size_factor. 'uncertainty' drives the radius from per-residue B-factor/RMSF values."),
};
const Surface = {
/** Type of surface representation. (Default is 'molecular') */
surface_type: OptionalField(literal('molecular', 'gaussian'), 'molecular', `Type of surface representation. (Default is 'molecular')`),
@@ -66,6 +73,7 @@ export const MVSRepresentationParams = UnionParamsSchema(
spacefill: SimpleParamsSchema(Spacefill),
carbohydrate: SimpleParamsSchema(Carbohydrate),
surface: SimpleParamsSchema(Surface),
putty: SimpleParamsSchema(Putty),
},
);