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
f7e737c5
Commit
f7e737c5
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
trace caps only when sec struc type changes
parent
5a3fed3c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-repr/structure/visual/polymer-trace-mesh.ts
+3
-3
3 additions, 3 deletions
src/mol-repr/structure/visual/polymer-trace-mesh.ts
src/mol-repr/structure/visual/util/polymer/trace-iterator.ts
+24
-9
24 additions, 9 deletions
src/mol-repr/structure/visual/util/polymer/trace-iterator.ts
with
27 additions
and
12 deletions
src/mol-repr/structure/visual/polymer-trace-mesh.ts
+
3
−
3
View file @
f7e737c5
...
...
@@ -62,8 +62,8 @@ async function createPolymerTraceMesh(ctx: VisualContext, unit: Unit, structure:
if
(
isSheet
)
{
const
height
=
width
*
aspectRatio
const
arrowHeight
=
v
.
secStruc
Change
?
height
*
arrowFactor
:
0
addSheet
(
builder
,
curvePoints
,
normalVectors
,
binormalVectors
,
linearSegments
,
width
,
height
,
arrowHeight
,
true
,
true
)
const
arrowHeight
=
v
.
secStruc
Last
?
height
*
arrowFactor
:
0
addSheet
(
builder
,
curvePoints
,
normalVectors
,
binormalVectors
,
linearSegments
,
width
,
height
,
arrowHeight
,
v
.
secStrucFirst
,
v
.
secStrucLast
)
}
else
{
let
height
:
number
if
(
isHelix
)
{
...
...
@@ -74,7 +74,7 @@ async function createPolymerTraceMesh(ctx: VisualContext, unit: Unit, structure:
}
else
{
height
=
width
}
addTube
(
builder
,
curvePoints
,
normalVectors
,
binormalVectors
,
linearSegments
,
radialSegments
,
width
,
height
,
1
,
true
,
true
)
addTube
(
builder
,
curvePoints
,
normalVectors
,
binormalVectors
,
linearSegments
,
radialSegments
,
width
,
height
,
1
,
v
.
secStrucFirst
,
v
.
secStrucLast
)
}
if
(
i
%
10000
===
0
&&
ctx
.
runtime
.
shouldUpdate
)
{
...
...
This diff is collapsed.
Click to expand it.
src/mol-repr/structure/visual/util/polymer/trace-iterator.ts
+
24
−
9
View file @
f7e737c5
...
...
@@ -13,6 +13,7 @@ import SortedRanges from 'mol-data/int/sorted-ranges';
import
{
CoarseSphereConformation
,
CoarseGaussianConformation
}
from
'
mol-model/structure/model/properties/coarse
'
;
import
{
getAtomicMoleculeType
,
getElementIndexForAtomRole
}
from
'
mol-model/structure/util
'
;
import
{
getPolymerRanges
}
from
'
../polymer
'
;
import
{
AtomicConformation
}
from
'
mol-model/structure/model/properties/atomic
'
;
/**
* Iterates over individual residues/coarse elements in polymers of a unit while
...
...
@@ -30,20 +31,22 @@ export function PolymerTraceIterator(unit: Unit): Iterator<PolymerTraceElement>
interface
PolymerTraceElement
{
center
:
StructureElement
first
:
boolean
,
last
:
boolean
secStrucFirst
:
boolean
,
secStrucLast
:
boolean
secStrucType
:
SecondaryStructureType
secStrucChange
:
boolean
moleculeType
:
MoleculeType
p0
:
Vec3
,
p1
:
Vec3
,
p2
:
Vec3
,
p3
:
Vec3
,
p4
:
Vec3
d12
:
Vec3
,
d23
:
Vec3
}
const
SecStrucTypeNA
=
SecondaryStructureType
.
create
(
SecondaryStructureType
.
Flag
.
NA
)
function
createPolymerTraceElement
(
unit
:
Unit
):
PolymerTraceElement
{
return
{
center
:
StructureElement
.
create
(
unit
),
first
:
false
,
last
:
false
,
secStruc
Type
:
SecondaryStructureType
.
create
(
SecondaryStructureType
.
Flag
.
NA
)
,
secStruc
Change
:
false
,
secStruc
First
:
false
,
secStrucLast
:
false
,
secStruc
Type
:
SecStrucTypeNA
,
moleculeType
:
MoleculeType
.
unknown
,
p0
:
Vec3
.
zero
(),
p1
:
Vec3
.
zero
(),
p2
:
Vec3
.
zero
(),
p3
:
Vec3
.
zero
(),
p4
:
Vec3
.
zero
(),
d12
:
Vec3
.
create
(
1
,
0
,
0
),
d23
:
Vec3
.
create
(
1
,
0
,
0
),
...
...
@@ -57,10 +60,15 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
private
polymerIt
:
SortedRanges
.
Iterator
<
ElementIndex
,
ResidueIndex
>
private
residueIt
:
Segmentation
.
SegmentIterator
<
ResidueIndex
>
private
polymerSegment
:
Segmentation
.
Segment
<
ResidueIndex
>
private
secondaryStructureType
:
ArrayLike
<
SecondaryStructureType
>
private
residueSegmentMin
:
ResidueIndex
private
residueSegmentMax
:
ResidueIndex
private
prevSecStrucType
:
SecondaryStructureType
private
currSecStrucType
:
SecondaryStructureType
private
nextSecStrucType
:
SecondaryStructureType
private
state
:
AtomicPolymerTraceIteratorState
=
AtomicPolymerTraceIteratorState
.
nextPolymer
private
residueAtomSegments
:
Segmentation
<
ElementIndex
,
ResidueIndex
>
private
atomicConformation
:
AtomicConformation
private
p0
=
Vec3
.
zero
();
private
p1
=
Vec3
.
zero
();
...
...
@@ -78,13 +86,13 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
hasNext
:
boolean
=
false
;
private
pos
(
target
:
Vec3
,
index
:
number
)
{
target
[
0
]
=
this
.
unit
.
model
.
atomicConformation
.
x
[
index
]
target
[
1
]
=
this
.
unit
.
model
.
atomicConformation
.
y
[
index
]
target
[
2
]
=
this
.
unit
.
model
.
atomicConformation
.
z
[
index
]
target
[
0
]
=
this
.
atomicConformation
.
x
[
index
]
target
[
1
]
=
this
.
atomicConformation
.
y
[
index
]
target
[
2
]
=
this
.
atomicConformation
.
z
[
index
]
}
private
updateResidueSegmentRange
(
polymerSegment
:
Segmentation
.
Segment
<
ResidueIndex
>
)
{
const
{
index
}
=
this
.
unit
.
model
.
atomicHierarchy
.
residueAtomSegments
const
{
index
}
=
this
.
residueAtomSegments
this
.
residueSegmentMin
=
index
[
this
.
unit
.
elements
[
polymerSegment
.
start
]]
this
.
residueSegmentMax
=
index
[
this
.
unit
.
elements
[
polymerSegment
.
end
-
1
]]
}
...
...
@@ -151,7 +159,11 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
this
.
pos
(
this
.
v23
,
this
.
getElementIndex
(
residueIndex
,
'
direction
'
))
// this.pos(this.v34, this.getAtomIndex(residueIndex + 1 as ResidueIndex, 'direction'))
this
.
value
.
secStrucType
=
this
.
unit
.
model
.
properties
.
secondaryStructure
.
type
[
residueIndex
]
this
.
prevSecStrucType
=
this
.
currSecStrucType
this
.
currSecStrucType
=
this
.
nextSecStrucType
this
.
nextSecStrucType
=
residueIt
.
hasNext
?
this
.
secondaryStructureType
[
residueIndex
+
1
]
:
SecStrucTypeNA
this
.
value
.
secStrucType
=
this
.
currSecStrucType
this
.
setControlPoint
(
value
.
p0
,
this
.
p0
,
this
.
p1
,
this
.
p2
,
residueIndex
-
2
as
ResidueIndex
)
this
.
setControlPoint
(
value
.
p1
,
this
.
p1
,
this
.
p2
,
this
.
p3
,
residueIndex
-
1
as
ResidueIndex
)
...
...
@@ -164,7 +176,8 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
value
.
first
=
residueIndex
===
this
.
residueSegmentMin
value
.
last
=
residueIndex
===
this
.
residueSegmentMax
value
.
secStrucChange
=
this
.
unit
.
model
.
properties
.
secondaryStructure
.
key
[
residueIndex
]
!==
this
.
unit
.
model
.
properties
.
secondaryStructure
.
key
[
residueIndex
+
1
]
value
.
secStrucFirst
=
this
.
prevSecStrucType
!==
this
.
currSecStrucType
value
.
secStrucLast
=
this
.
currSecStrucType
!==
this
.
nextSecStrucType
value
.
moleculeType
=
getAtomicMoleculeType
(
this
.
unit
.
model
,
residueIndex
)
if
(
!
residueIt
.
hasNext
)
{
...
...
@@ -178,7 +191,9 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
}
constructor
(
private
unit
:
Unit
.
Atomic
)
{
this
.
atomicConformation
=
unit
.
model
.
atomicConformation
this
.
residueAtomSegments
=
unit
.
model
.
atomicHierarchy
.
residueAtomSegments
this
.
secondaryStructureType
=
unit
.
model
.
properties
.
secondaryStructure
.
type
this
.
polymerIt
=
SortedRanges
.
transientSegments
(
getPolymerRanges
(
unit
),
unit
.
elements
)
this
.
residueIt
=
Segmentation
.
transientSegments
(
this
.
residueAtomSegments
,
unit
.
elements
);
this
.
value
=
createPolymerTraceElement
(
unit
)
...
...
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