Skip to content
Snippets Groups Projects
Commit 52a59696 authored by Alexander Rose's avatar Alexander Rose
Browse files

fixed and updated rcsb assembly symmetry prop

parent b74b7744
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
"files.associations": {
"*.glsl.ts": "glsl",
"*.frag.ts": "glsl",
"*.vert.ts": "glsl"
"*.vert.ts": "glsl",
"*.gql.ts": "graphql"
},
}
\ No newline at end of file
......@@ -120,12 +120,13 @@ If node complains about a missine acorn peer dependency, run the following comma
### Editor
To get syntax highlighting for the shader files add the following to Visual Code's settings files
To get syntax highlighting for shader and graphql files add the following to Visual Code's settings files and make sure relevant extanesions are installed in the editor.
"files.associations": {
"*.glsl.ts": "glsl",
"*.frag.ts": "glsl",
"*.vert.ts": "glsl"
"*.vert.ts": "glsl",
"*.gql.ts": "graphql"
},
## Contributing
......
......@@ -13,11 +13,11 @@
"scripts": {
"lint": "tslint src/**/*.ts",
"test": "npm run lint && jest",
"build": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html,gql}\" lib/ && tsc",
"build": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html}\" lib/ && tsc",
"postinstall": "npm run build",
"watch": "concurrently --kill-others \"npm:watch-ts\" \"npm:watch-extra\" \"npm:watch-webpack\"",
"watch-ts": "tsc -watch",
"watch-extra": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html,gql}\" lib/ --watch",
"watch-extra": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html}\" lib/ --watch",
"build-webpack": "webpack --mode production",
"watch-webpack": "webpack -w --mode development --display minimal",
"model-server": "node lib/servers/model/server.js",
......
......@@ -273,9 +273,9 @@ export namespace AssemblySymmetry {
console.error(e)
return false;
}
if (!result || !result.assemblies) return false;
if (!result || !result.entry || !result.entry.assemblies) return false;
db = createDatabaseFromJson(result.assemblies as ReadonlyArray<AssemblySymmetryGraphQL.Assemblies>)
db = createDatabaseFromJson(result.entry.assemblies as ReadonlyArray<AssemblySymmetryGraphQL.Assemblies>)
}
model.customProperties.add(Descriptor);
......
export default `query AssemblySymmetry($pdbId: String!) {
assemblies(pdbId: $pdbId) {
pdbx_struct_assembly {
id
}
rcsb_struct_symmetry {
clusters {
avg_rmsd
members {
asym_id
pdbx_struct_oper_list_ids
}
entry(pdbId: $pdbId) {
assemblies {
pdbx_struct_assembly {
id
}
kind
oligomeric_state
rotation_axes {
start
end
order
rcsb_struct_symmetry {
clusters {
avg_rmsd
members {
asym_id
pdbx_struct_oper_list_ids
}
}
kind
oligomeric_state
rotation_axes {
start
end
order
}
stoichiometry
symbol
type
}
stoichiometry
symbol
type
}
}
}`
\ No newline at end of file
// Generated in 2019-03-01T14:48:33-08:00
// Generated in 2019-06-04T12:44:49-07:00
export type Maybe<T> = T | null;
/** Built-in scalar representing an instant in time */
......@@ -19,6 +19,12 @@ export namespace AssemblySymmetry {
export type Query = {
__typename?: "Query";
entry: Maybe<Entry>;
};
export type Entry = {
__typename?: "CoreEntry";
assemblies: Maybe<(Maybe<Assemblies>)[]>;
};
......
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
......@@ -9,11 +9,13 @@ import { ColorTheme, LocationColor } from '../../../mol-theme/color';
import { ParamDefinition as PD } from '../../../mol-util/param-definition'
import { Table } from '../../../mol-data/db';
import { AssemblySymmetry } from '../assembly-symmetry';
import { ColorScale, Color } from '../../../mol-util/color';
import { Color } from '../../../mol-util/color';
import { Unit, StructureElement, StructureProperties } from '../../../mol-model/structure';
import { Location } from '../../../mol-model/location';
import { ColorListName, ColorListOptions } from '../../../mol-util/color/scale';
import { ScaleLegend } from '../../../mol-util/color/scale';
import { getSymmetrySelectParam } from '../util';
import { getPalette, getPaletteParams } from '../../../mol-theme/color/util';
import { TableLegend } from '../../../mol-util/color/tables';
const DefaultColor = Color(0xCCCCCC)
......@@ -32,7 +34,7 @@ function clusterMemberKey(assemblyId: string, asymId: string, operList: string[]
}
export const AssemblySymmetryClusterColorThemeParams = {
list: PD.Select<ColorListName>('Viridis', ColorListOptions),
...getPaletteParams({ scaleList: 'RedYellowBlue' }),
symmetryId: getSymmetrySelectParam(),
}
export type AssemblySymmetryClusterColorThemeParams = typeof AssemblySymmetryClusterColorThemeParams
......@@ -44,6 +46,7 @@ export function getAssemblySymmetryClusterColorThemeParams(ctx: ThemeDataContext
export function AssemblySymmetryClusterColorTheme(ctx: ThemeDataContext, props: PD.Values<AssemblySymmetryClusterColorThemeParams>): ColorTheme<AssemblySymmetryClusterColorThemeParams> {
let color: LocationColor = () => DefaultColor
let legend: ScaleLegend | TableLegend | undefined
const { symmetryId } = props
......@@ -68,7 +71,8 @@ export function AssemblySymmetryClusterColorTheme(ctx: ThemeDataContext, props:
}
}
const scale = ColorScale.create({ listOrName: props.list, domain: [ 0, clusters._rowCount - 1 ] })
const palette = getPalette(clusters._rowCount, props)
legend = palette.legend
color = (location: Location): Color => {
if (StructureElement.isLocation(location)) {
......@@ -76,7 +80,7 @@ export function AssemblySymmetryClusterColorTheme(ctx: ThemeDataContext, props:
if (assembly && assembly.id === symmetry.assembly_id) {
const asymId = getAsymId(location.unit)(location)
const cluster = clusterByMember.get(clusterMemberKey(assembly.id, asymId, assembly.operList))
return cluster !== undefined ? scale.color(cluster) : DefaultColor
return cluster !== undefined ? palette.color(cluster) : DefaultColor
}
}
return DefaultColor
......@@ -91,6 +95,7 @@ export function AssemblySymmetryClusterColorTheme(ctx: ThemeDataContext, props:
color,
props,
description: 'Assigns chain colors according to assembly symmetry cluster membership.',
legend
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment