Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
32e2552c
Commit
32e2552c
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
rudimentary cross-link color scheme
parent
c71c1b0f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-view/stage.ts
+1
-1
1 addition, 1 deletion
src/mol-view/stage.ts
src/mol-view/theme/color.ts
+4
-1
4 additions, 1 deletion
src/mol-view/theme/color.ts
src/mol-view/theme/color/cross-link.ts
+48
-0
48 additions, 0 deletions
src/mol-view/theme/color/cross-link.ts
with
53 additions
and
2 deletions
src/mol-view/stage.ts
+
1
−
1
View file @
32e2552c
...
...
@@ -36,7 +36,7 @@ const ballAndStickProps: Partial<BallAndStickProps> = {
const
distanceRestraintProps
:
Partial
<
DistanceRestraintProps
>
=
{
doubleSided
:
true
,
colorTheme
:
{
name
:
'
c
hain-id
'
},
colorTheme
:
{
name
:
'
c
ross-link
'
},
sizeTheme
:
{
name
:
'
uniform
'
,
value
:
0.6
},
quality
:
'
auto
'
,
useFog
:
false
...
...
This diff is collapsed.
Click to expand it.
src/mol-view/theme/color.ts
+
4
−
1
View file @
32e2552c
...
...
@@ -14,6 +14,7 @@ import { ChainIdColorTheme } from './color/chain-id';
import
{
ElementSymbolColorTheme
}
from
'
./color/element-symbol
'
;
import
{
UnitIndexColorTheme
}
from
'
./color/unit-index
'
;
import
{
UniformColorTheme
}
from
'
./color/uniform
'
;
import
{
CrossLinkColorTheme
}
from
'
./color/cross-link
'
;
export
interface
ColorTheme
{
kind
:
ColorType
...
...
@@ -24,6 +25,7 @@ export function ColorTheme(props: ColorThemeProps): ColorTheme {
switch
(
props
.
name
)
{
case
'
element-index
'
:
return
ElementIndexColorTheme
(
props
)
case
'
carbohydrate-symbol
'
:
return
CarbohydrateSymbolColorTheme
(
props
)
case
'
cross-link
'
:
return
CrossLinkColorTheme
(
props
)
case
'
chain-id
'
:
return
ChainIdColorTheme
(
props
)
case
'
element-symbol
'
:
return
ElementSymbolColorTheme
(
props
)
case
'
unit-index
'
:
return
UnitIndexColorTheme
(
props
)
...
...
@@ -32,7 +34,7 @@ export function ColorTheme(props: ColorThemeProps): ColorTheme {
}
export
interface
ColorThemeProps
{
name
:
'
element-index
'
|
'
chain-id
'
|
'
unit-index
'
|
'
uniform
'
|
'
carbohydrate-symbol
'
|
'
element-symbol
'
name
:
ColorThemeName
domain
?:
[
number
,
number
]
value
?:
Color
structure
?:
Structure
...
...
@@ -41,6 +43,7 @@ export interface ColorThemeProps {
export
const
ColorThemeInfo
=
{
'
element-index
'
:
{},
'
carbohydrate-symbol
'
:
{},
'
cross-link
'
:
{},
'
chain-id
'
:
{},
'
element-symbol
'
:
{},
'
unit-index
'
:
{},
...
...
This diff is collapsed.
Click to expand it.
src/mol-view/theme/color/cross-link.ts
0 → 100644
+
48
−
0
View file @
32e2552c
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import
{
Link
}
from
'
mol-model/structure
'
;
import
{
Color
,
ColorScale
,
ColorBrewer
}
from
'
mol-util/color
'
;
import
{
Location
}
from
'
mol-model/location
'
;
import
{
ColorThemeProps
,
ColorTheme
}
from
'
../color
'
;
import
{
LocationColor
}
from
'
mol-geo/util/color-data
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
const
DefaultColor
=
0xCCCCCC
;
const
distVecA
=
Vec3
.
zero
(),
distVecB
=
Vec3
.
zero
()
function
linkDistance
(
link
:
Link
.
Location
)
{
link
.
aUnit
.
conformation
.
position
(
link
.
aIndex
,
distVecA
)
link
.
bUnit
.
conformation
.
position
(
link
.
bIndex
,
distVecB
)
return
Vec3
.
distance
(
distVecA
,
distVecB
)
}
export
function
CrossLinkColorTheme
(
props
:
ColorThemeProps
):
ColorTheme
{
let
colorFn
:
LocationColor
if
(
props
.
structure
)
{
const
crosslinks
=
props
.
structure
.
crossLinkRestraints
const
scale
=
ColorScale
.
create
({
domain
:
[
-
10
,
10
],
colors
:
ColorBrewer
.
RdYlBu
})
colorFn
=
(
location
:
Location
):
Color
=>
{
if
(
Link
.
isLocation
(
location
))
{
const
pairs
=
crosslinks
.
getPairs
(
location
.
aIndex
,
location
.
aUnit
,
location
.
bIndex
,
location
.
bUnit
)
if
(
pairs
)
{
return
scale
.
color
(
linkDistance
(
location
)
-
pairs
[
0
].
distanceThreshold
)
}
}
return
DefaultColor
}
}
else
{
colorFn
=
()
=>
DefaultColor
}
return
{
kind
:
'
element
'
,
color
:
colorFn
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment