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
9ec1cbad
Commit
9ec1cbad
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
wip, symmetry-cluster color-theme
parent
19bfc353
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/apps/canvas/assembly-symmetry.ts
+45
-5
45 additions, 5 deletions
src/apps/canvas/assembly-symmetry.ts
with
45 additions
and
5 deletions
src/apps/canvas/assembly-symmetry.ts
+
45
−
5
View file @
9ec1cbad
...
@@ -6,12 +6,15 @@
...
@@ -6,12 +6,15 @@
import
{
AssemblySymmetry
}
from
'
mol-model-props/rcsb/symmetry
'
;
import
{
AssemblySymmetry
}
from
'
mol-model-props/rcsb/symmetry
'
;
import
{
Table
}
from
'
mol-data/db
'
;
import
{
Table
}
from
'
mol-data/db
'
;
import
{
Color
}
from
'
mol-util/color
'
;
import
{
Color
,
ColorScale
}
from
'
mol-util/color
'
;
import
{
MeshBuilder
}
from
'
mol-geo/mesh/mesh-builder
'
;
import
{
MeshBuilder
}
from
'
mol-geo/mesh/mesh-builder
'
;
import
{
Tensor
}
from
'
mol-math/linear-algebra
'
;
import
{
Tensor
}
from
'
mol-math/linear-algebra
'
;
import
{
addSphere
}
from
'
mol-geo/mesh/builder/sphere
'
;
import
{
addSphere
}
from
'
mol-geo/mesh/builder/sphere
'
;
import
{
addCylinder
}
from
'
mol-geo/mesh/builder/cylinder
'
;
import
{
addCylinder
}
from
'
mol-geo/mesh/builder/cylinder
'
;
import
{
Shape
}
from
'
mol-model/shape
'
;
import
{
Shape
}
from
'
mol-model/shape
'
;
import
{
ColorTheme
}
from
'
mol-view/theme/color
'
;
import
{
Location
}
from
'
mol-model/location
'
;
import
{
StructureElement
,
Unit
,
StructureProperties
}
from
'
mol-model/structure
'
;
export
function
getAxesShape
(
featureId
:
number
,
assemblySymmetry
:
AssemblySymmetry
)
{
export
function
getAxesShape
(
featureId
:
number
,
assemblySymmetry
:
AssemblySymmetry
)
{
const
f
=
assemblySymmetry
.
db
.
rcsb_assembly_symmetry_feature
const
f
=
assemblySymmetry
.
db
.
rcsb_assembly_symmetry_feature
...
@@ -45,15 +48,52 @@ export function getAxesShape(featureId: number, assemblySymmetry: AssemblySymmet
...
@@ -45,15 +48,52 @@ export function getAxesShape(featureId: number, assemblySymmetry: AssemblySymmet
return
shape
return
shape
}
}
export
function
getClusterColorTheme
(
featureId
:
number
,
assemblySymmetry
:
AssemblySymmetry
)
{
function
getAsymId
(
unit
:
Unit
):
StructureElement
.
Property
<
string
>
{
switch
(
unit
.
kind
)
{
case
Unit
.
Kind
.
Atomic
:
return
StructureProperties
.
chain
.
auth_asym_id
// TODO
case
Unit
.
Kind
.
Spheres
:
case
Unit
.
Kind
.
Gaussians
:
return
StructureProperties
.
coarse
.
asym_id
}
}
function
memberKey
(
asym_id
:
string
,
oper_list_id
?:
number
)
{
return
`
${
asym_id
}
|
${
oper_list_id
}
`
}
export
function
getClusterColorTheme
(
featureId
:
number
,
assemblySymmetry
:
AssemblySymmetry
):
ColorTheme
{
const
DefaultColor
=
Color
(
0xCCCCCC
)
const
f
=
assemblySymmetry
.
db
.
rcsb_assembly_symmetry_feature
const
f
=
assemblySymmetry
.
db
.
rcsb_assembly_symmetry_feature
const
feature
=
Table
.
pickRow
(
f
,
i
=>
f
.
id
.
value
(
i
)
===
featureId
)
const
feature
=
Table
.
pickRow
(
f
,
i
=>
f
.
id
.
value
(
i
)
===
featureId
)
if
(
!
feature
)
return
if
(
!
feature
)
return
{
kind
:
'
uniform
'
,
color
:
()
=>
DefaultColor
}
const
clusters
=
assemblySymmetry
.
getClusters
(
featureId
)
const
clusters
=
assemblySymmetry
.
getClusters
(
featureId
)
if
(
!
clusters
.
_rowCount
)
return
if
(
!
clusters
.
_rowCount
)
return
{
kind
:
'
uniform
'
,
color
:
()
=>
DefaultColor
}
const
clusterByMember
=
new
Map
<
string
,
number
>
()
for
(
let
i
=
0
,
il
=
clusters
.
_rowCount
;
i
<
il
;
++
i
)
{
for
(
let
i
=
0
,
il
=
clusters
.
_rowCount
;
i
<
il
;
++
i
)
{
console
.
log
(
clusters
.
members
.
value
(
i
),
clusters
.
avg_rmsd
.
value
(
i
),
feature
.
stoichiometry_value
,
feature
.
stoichiometry_description
)
clusters
.
members
.
value
(
i
).
forEach
(
m
=>
{
const
ms
=
m
.
split
(
'
_
'
)
const
asym_id
=
ms
[
0
]
const
oper_list_id
=
ms
.
length
===
2
?
parseInt
(
ms
[
1
])
:
undefined
clusterByMember
.
set
(
memberKey
(
asym_id
,
oper_list_id
),
i
)
})
}
const
scale
=
ColorScale
.
create
({
domain
:
[
0
,
clusters
.
_rowCount
-
1
]
})
return
{
kind
:
'
instance
'
,
color
:
(
location
:
Location
):
Color
=>
{
if
(
StructureElement
.
isLocation
(
location
))
{
const
ns
=
location
.
unit
.
conformation
.
operator
.
name
.
split
(
'
-
'
)
const
asym_id
=
getAsymId
(
location
.
unit
)
const
oper_list_id
=
ns
.
length
===
2
?
parseInt
(
ns
[
1
])
:
undefined
const
cluster
=
clusterByMember
.
get
(
memberKey
(
asym_id
(
location
),
oper_list_id
))
return
cluster
!==
undefined
?
scale
.
color
(
cluster
)
:
DefaultColor
}
return
DefaultColor
}
}
}
}
}
\ 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