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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
fb78b886
Commit
fb78b886
authored
Oct 10, 2019
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
collapse link labels to hide repeated ids
parent
aed0b87b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-theme/label.ts
+22
-11
22 additions, 11 deletions
src/mol-theme/label.ts
with
22 additions
and
11 deletions
src/mol-theme/label.ts
+
22
−
11
View file @
fb78b886
...
@@ -54,7 +54,7 @@ function getResidueCount(unit: Unit.Atomic) {
...
@@ -54,7 +54,7 @@ function getResidueCount(unit: Unit.Atomic) {
return
residueAtomSegments
.
index
[
elementEnd
]
-
residueAtomSegments
.
index
[
elementStart
]
return
residueAtomSegments
.
index
[
elementEnd
]
-
residueAtomSegments
.
index
[
elementStart
]
}
}
export
function
structureElementStatsLabel
(
stats
:
StructureElement
.
Stats
,
countsOnly
=
false
)
{
export
function
structureElementStatsLabel
(
stats
:
StructureElement
.
Stats
,
countsOnly
=
false
)
:
string
{
const
{
unitCount
,
residueCount
,
elementCount
}
=
stats
const
{
unitCount
,
residueCount
,
elementCount
}
=
stats
if
(
!
countsOnly
&&
elementCount
===
1
&&
residueCount
===
0
&&
unitCount
===
0
)
{
if
(
!
countsOnly
&&
elementCount
===
1
&&
residueCount
===
0
&&
unitCount
===
0
)
{
...
@@ -74,34 +74,45 @@ export function structureElementStatsLabel(stats: StructureElement.Stats, counts
...
@@ -74,34 +74,45 @@ export function structureElementStatsLabel(stats: StructureElement.Stats, counts
}
}
}
}
export
function
linkLabel
(
link
:
Link
.
Location
)
{
export
function
linkLabel
(
link
:
Link
.
Location
)
:
string
{
if
(
!
elementLocA
)
elementLocA
=
StructureElement
.
Location
.
create
()
if
(
!
elementLocA
)
elementLocA
=
StructureElement
.
Location
.
create
()
if
(
!
elementLocB
)
elementLocB
=
StructureElement
.
Location
.
create
()
if
(
!
elementLocB
)
elementLocB
=
StructureElement
.
Location
.
create
()
setElementLocation
(
elementLocA
,
link
.
aUnit
,
link
.
aIndex
)
setElementLocation
(
elementLocA
,
link
.
aUnit
,
link
.
aIndex
)
setElementLocation
(
elementLocB
,
link
.
bUnit
,
link
.
bIndex
)
setElementLocation
(
elementLocB
,
link
.
bUnit
,
link
.
bIndex
)
return
`
${
elementLabel
(
elementLocA
)}
-
${
elementLabel
(
elementLocB
)}
`
const
labelA
=
_elementLabel
(
elementLocA
)
const
labelB
=
_elementLabel
(
elementLocB
)
let
offset
=
0
for
(
let
i
=
0
,
il
=
Math
.
min
(
labelA
.
length
,
labelB
.
length
);
i
<
il
;
++
i
)
{
if
(
labelA
[
i
]
===
labelB
[
i
])
offset
+=
1
else
break
}
return
`
${
labelA
.
join
(
'
|
'
)}
\u2014
${
labelB
.
slice
(
offset
).
join
(
'
|
'
)}
`
}
}
export
type
LabelGranularity
=
'
element
'
|
'
residue
'
|
'
chain
'
|
'
structure
'
export
type
LabelGranularity
=
'
element
'
|
'
residue
'
|
'
chain
'
|
'
structure
'
export
function
elementLabel
(
location
:
StructureElement
.
Location
,
granularity
:
LabelGranularity
=
'
element
'
)
{
export
function
elementLabel
(
location
:
StructureElement
.
Location
,
granularity
:
LabelGranularity
=
'
element
'
):
string
{
return
_elementLabel
(
location
,
granularity
).
join
(
'
|
'
)
}
function
_elementLabel
(
location
:
StructureElement
.
Location
,
granularity
:
LabelGranularity
=
'
element
'
):
string
[]
{
const
entry
=
location
.
unit
.
model
.
entry
const
entry
=
location
.
unit
.
model
.
entry
const
model
=
`Model
${
location
.
unit
.
model
.
modelNum
}
`
const
model
=
`Model
${
location
.
unit
.
model
.
modelNum
}
`
const
instance
=
location
.
unit
.
conformation
.
operator
.
name
const
instance
=
location
.
unit
.
conformation
.
operator
.
name
const
label
=
[
entry
,
model
,
instance
]
const
label
=
[
entry
,
model
,
instance
]
if
(
Unit
.
isAtomic
(
location
.
unit
))
{
if
(
Unit
.
isAtomic
(
location
.
unit
))
{
label
.
push
(
atomicElementLabel
(
location
as
StructureElement
.
Location
<
Unit
.
Atomic
>
,
granularity
))
label
.
push
(
...
_
atomicElementLabel
(
location
as
StructureElement
.
Location
<
Unit
.
Atomic
>
,
granularity
))
}
else
if
(
Unit
.
isCoarse
(
location
.
unit
))
{
}
else
if
(
Unit
.
isCoarse
(
location
.
unit
))
{
label
.
push
(
coarseElementLabel
(
location
as
StructureElement
.
Location
<
Unit
.
Spheres
|
Unit
.
Gaussians
>
,
granularity
))
label
.
push
(
...
_
coarseElementLabel
(
location
as
StructureElement
.
Location
<
Unit
.
Spheres
|
Unit
.
Gaussians
>
,
granularity
))
}
else
{
}
else
{
label
.
push
(
'
Unknown
'
)
label
.
push
(
'
Unknown
'
)
}
}
return
label
.
join
(
'
|
'
)
return
label
}
}
export
function
atomicElementLabel
(
location
:
StructureElement
.
Location
<
Unit
.
Atomic
>
,
granularity
:
LabelGranularity
)
{
function
_
atomicElementLabel
(
location
:
StructureElement
.
Location
<
Unit
.
Atomic
>
,
granularity
:
LabelGranularity
)
:
string
[]
{
const
label_asym_id
=
Props
.
chain
.
label_asym_id
(
location
)
const
label_asym_id
=
Props
.
chain
.
label_asym_id
(
location
)
const
auth_asym_id
=
Props
.
chain
.
auth_asym_id
(
location
)
const
auth_asym_id
=
Props
.
chain
.
auth_asym_id
(
location
)
const
seq_id
=
location
.
unit
.
model
.
atomicHierarchy
.
residues
.
auth_seq_id
.
isDefined
?
Props
.
residue
.
auth_seq_id
(
location
)
:
Props
.
residue
.
label_seq_id
(
location
)
const
seq_id
=
location
.
unit
.
model
.
atomicHierarchy
.
residues
.
auth_seq_id
.
isDefined
?
Props
.
residue
.
auth_seq_id
(
location
)
:
Props
.
residue
.
label_seq_id
(
location
)
...
@@ -126,10 +137,10 @@ export function atomicElementLabel(location: StructureElement.Location<Unit.Atom
...
@@ -126,10 +137,10 @@ export function atomicElementLabel(location: StructureElement.Location<Unit.Atom
label
.
push
(
`Chain
${
label_asym_id
}
:
${
auth_asym_id
}
`
)
label
.
push
(
`Chain
${
label_asym_id
}
:
${
auth_asym_id
}
`
)
}
}
return
label
.
reverse
()
.
join
(
'
|
'
)
return
label
.
reverse
()
}
}
export
function
coarseElementLabel
(
location
:
StructureElement
.
Location
<
Unit
.
Spheres
|
Unit
.
Gaussians
>
,
granularity
:
LabelGranularity
)
{
function
_
coarseElementLabel
(
location
:
StructureElement
.
Location
<
Unit
.
Spheres
|
Unit
.
Gaussians
>
,
granularity
:
LabelGranularity
)
:
string
[]
{
const
asym_id
=
Props
.
coarse
.
asym_id
(
location
)
const
asym_id
=
Props
.
coarse
.
asym_id
(
location
)
const
seq_id_begin
=
Props
.
coarse
.
seq_id_begin
(
location
)
const
seq_id_begin
=
Props
.
coarse
.
seq_id_begin
(
location
)
const
seq_id_end
=
Props
.
coarse
.
seq_id_end
(
location
)
const
seq_id_end
=
Props
.
coarse
.
seq_id_end
(
location
)
...
@@ -151,5 +162,5 @@ export function coarseElementLabel(location: StructureElement.Location<Unit.Sphe
...
@@ -151,5 +162,5 @@ export function coarseElementLabel(location: StructureElement.Location<Unit.Sphe
label
.
push
(
`Chain
${
asym_id
}
`
)
label
.
push
(
`Chain
${
asym_id
}
`
)
}
}
return
label
.
reverse
()
.
join
(
'
|
'
)
return
label
.
reverse
()
}
}
\ 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