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
e3470396
Commit
e3470396
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
trace iterator optimiation
parent
a500e55c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-repr/structure/visual/util/polymer/trace-iterator.ts
+21
-17
21 additions, 17 deletions
src/mol-repr/structure/visual/util/polymer/trace-iterator.ts
with
21 additions
and
17 deletions
src/mol-repr/structure/visual/util/polymer/trace-iterator.ts
+
21
−
17
View file @
e3470396
...
@@ -6,12 +6,11 @@
...
@@ -6,12 +6,11 @@
import
{
Unit
,
StructureElement
,
ElementIndex
,
ResidueIndex
}
from
'
mol-model/structure
'
;
import
{
Unit
,
StructureElement
,
ElementIndex
,
ResidueIndex
}
from
'
mol-model/structure
'
;
import
{
Segmentation
}
from
'
mol-data/int
'
;
import
{
Segmentation
}
from
'
mol-data/int
'
;
import
{
MoleculeType
,
SecondaryStructureType
,
AtomRole
}
from
'
mol-model/structure/model/types
'
;
import
{
MoleculeType
,
SecondaryStructureType
}
from
'
mol-model/structure/model/types
'
;
import
Iterator
from
'
mol-data/iterator
'
;
import
Iterator
from
'
mol-data/iterator
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
SortedRanges
from
'
mol-data/int/sorted-ranges
'
;
import
SortedRanges
from
'
mol-data/int/sorted-ranges
'
;
import
{
CoarseSphereConformation
,
CoarseGaussianConformation
}
from
'
mol-model/structure/model/properties/coarse
'
;
import
{
CoarseSphereConformation
,
CoarseGaussianConformation
}
from
'
mol-model/structure/model/properties/coarse
'
;
import
{
getAtomicMoleculeType
,
getElementIndexForAtomRole
}
from
'
mol-model/structure/util
'
;
import
{
getPolymerRanges
}
from
'
../polymer
'
;
import
{
getPolymerRanges
}
from
'
../polymer
'
;
import
{
AtomicConformation
}
from
'
mol-model/structure/model/properties/atomic
'
;
import
{
AtomicConformation
}
from
'
mol-model/structure/model/properties/atomic
'
;
...
@@ -69,6 +68,9 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
...
@@ -69,6 +68,9 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
private
nextSecStrucType
:
SecondaryStructureType
private
nextSecStrucType
:
SecondaryStructureType
private
state
:
AtomicPolymerTraceIteratorState
=
AtomicPolymerTraceIteratorState
.
nextPolymer
private
state
:
AtomicPolymerTraceIteratorState
=
AtomicPolymerTraceIteratorState
.
nextPolymer
private
residueAtomSegments
:
Segmentation
<
ElementIndex
,
ResidueIndex
>
private
residueAtomSegments
:
Segmentation
<
ElementIndex
,
ResidueIndex
>
private
traceElementIndex
:
ArrayLike
<
ElementIndex
>
private
directionElementIndex
:
ArrayLike
<
ElementIndex
>
private
moleculeType
:
ArrayLike
<
MoleculeType
>
private
atomicConformation
:
AtomicConformation
private
atomicConformation
:
AtomicConformation
private
p0
=
Vec3
.
zero
();
private
p0
=
Vec3
.
zero
();
...
@@ -98,24 +100,23 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
...
@@ -98,24 +100,23 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
this
.
residueSegmentMax
=
index
[
this
.
unit
.
elements
[
polymerSegment
.
end
-
1
]]
this
.
residueSegmentMax
=
index
[
this
.
unit
.
elements
[
polymerSegment
.
end
-
1
]]
}
}
private
get
ElementIndex
(
r
esidueIndex
:
R
esidueIndex
,
atomRole
:
AtomRole
)
{
private
get
R
esidueIndex
(
r
esidueIndex
:
number
)
{
if
(
residueIndex
<
this
.
residueSegmentMin
)
{
if
(
residueIndex
<
this
.
residueSegmentMin
)
{
const
cyclicIndex
=
this
.
cyclicPolymerMap
.
get
(
this
.
residueSegmentMin
)
const
cyclicIndex
=
this
.
cyclicPolymerMap
.
get
(
this
.
residueSegmentMin
)
if
(
cyclicIndex
!==
undefined
)
{
if
(
cyclicIndex
!==
undefined
)
{
residueIndex
=
cyclicIndex
-
(
this
.
residueSegmentMin
-
residueIndex
-
1
)
as
ResidueIndex
residueIndex
=
cyclicIndex
-
(
this
.
residueSegmentMin
-
residueIndex
-
1
)
}
else
{
}
else
{
residueIndex
=
this
.
residueSegmentMin
residueIndex
=
this
.
residueSegmentMin
}
}
}
else
if
(
residueIndex
>
this
.
residueSegmentMax
)
{
}
else
if
(
residueIndex
>
this
.
residueSegmentMax
)
{
const
cyclicIndex
=
this
.
cyclicPolymerMap
.
get
(
this
.
residueSegmentMax
)
const
cyclicIndex
=
this
.
cyclicPolymerMap
.
get
(
this
.
residueSegmentMax
)
if
(
cyclicIndex
!==
undefined
)
{
if
(
cyclicIndex
!==
undefined
)
{
residueIndex
=
cyclicIndex
+
(
residueIndex
-
this
.
residueSegmentMax
-
1
)
as
ResidueIndex
residueIndex
=
cyclicIndex
+
(
residueIndex
-
this
.
residueSegmentMax
-
1
)
}
else
{
}
else
{
residueIndex
=
this
.
residueSegmentMax
residueIndex
=
this
.
residueSegmentMax
}
}
}
}
const
elementIndex
=
getElementIndexForAtomRole
(
this
.
unit
.
model
,
residueIndex
,
atomRole
)
return
residueIndex
as
ResidueIndex
return
elementIndex
===
-
1
?
this
.
residueAtomSegments
.
offsets
[
residueIndex
]
:
elementIndex
}
}
private
setControlPoint
(
out
:
Vec3
,
p1
:
Vec3
,
p2
:
Vec3
,
p3
:
Vec3
,
residueIndex
:
ResidueIndex
)
{
private
setControlPoint
(
out
:
Vec3
,
p1
:
Vec3
,
p2
:
Vec3
,
p3
:
Vec3
,
residueIndex
:
ResidueIndex
)
{
...
@@ -151,22 +152,22 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
...
@@ -151,22 +152,22 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
this
.
nextSecStrucType
=
residueIt
.
hasNext
?
this
.
secondaryStructureType
[
residueIndex
+
1
]
:
SecStrucTypeNA
this
.
nextSecStrucType
=
residueIt
.
hasNext
?
this
.
secondaryStructureType
[
residueIndex
+
1
]
:
SecStrucTypeNA
value
.
secStrucType
=
this
.
currSecStrucType
value
.
secStrucType
=
this
.
currSecStrucType
value
.
center
.
element
=
this
.
get
ElementIndex
(
residueIndex
,
'
trace
'
)
value
.
center
.
element
=
this
.
trace
ElementIndex
[
residueIndex
]
value
.
first
=
residueIndex
===
this
.
residueSegmentMin
value
.
first
=
residueIndex
===
this
.
residueSegmentMin
value
.
last
=
residueIndex
===
this
.
residueSegmentMax
value
.
last
=
residueIndex
===
this
.
residueSegmentMax
value
.
secStrucFirst
=
this
.
prevSecStrucType
!==
this
.
currSecStrucType
value
.
secStrucFirst
=
this
.
prevSecStrucType
!==
this
.
currSecStrucType
value
.
secStrucLast
=
this
.
currSecStrucType
!==
this
.
nextSecStrucType
value
.
secStrucLast
=
this
.
currSecStrucType
!==
this
.
nextSecStrucType
value
.
moleculeType
=
getAtomicM
oleculeType
(
this
.
unit
.
model
,
residueIndex
)
value
.
moleculeType
=
this
.
m
oleculeType
[
residueIndex
]
if
(
value
.
first
)
{
if
(
value
.
first
)
{
this
.
pos
(
this
.
p0
,
this
.
get
ElementIndex
(
r
esidueIndex
-
3
as
R
esidueIndex
,
'
trace
'
)
)
this
.
pos
(
this
.
p0
,
this
.
trace
ElementIndex
[
this
.
getR
esidueIndex
(
r
esidueIndex
-
3
)]
)
this
.
pos
(
this
.
p1
,
this
.
get
ElementIndex
(
r
esidueIndex
-
2
as
R
esidueIndex
,
'
trace
'
)
)
this
.
pos
(
this
.
p1
,
this
.
trace
ElementIndex
[
this
.
getR
esidueIndex
(
r
esidueIndex
-
2
)]
)
this
.
pos
(
this
.
p2
,
this
.
get
ElementIndex
(
r
esidueIndex
-
1
as
R
esidueIndex
,
'
trace
'
)
)
this
.
pos
(
this
.
p2
,
this
.
trace
ElementIndex
[
this
.
getR
esidueIndex
(
r
esidueIndex
-
1
)]
)
this
.
pos
(
this
.
p3
,
value
.
center
.
element
)
this
.
pos
(
this
.
p3
,
value
.
center
.
element
)
this
.
pos
(
this
.
p4
,
this
.
get
ElementIndex
(
r
esidueIndex
+
1
as
R
esidueIndex
,
'
trace
'
)
)
this
.
pos
(
this
.
p4
,
this
.
trace
ElementIndex
[
this
.
getR
esidueIndex
(
r
esidueIndex
+
1
)]
)
this
.
pos
(
this
.
p5
,
this
.
get
ElementIndex
(
r
esidueIndex
+
2
as
R
esidueIndex
,
'
trace
'
)
)
this
.
pos
(
this
.
p5
,
this
.
trace
ElementIndex
[
this
.
getR
esidueIndex
(
r
esidueIndex
+
2
)]
)
this
.
pos
(
this
.
v12
,
this
.
get
ElementIndex
(
r
esidueIndex
-
1
as
R
esidueIndex
,
'
direction
'
)
)
this
.
pos
(
this
.
v12
,
this
.
direction
ElementIndex
[
this
.
getR
esidueIndex
(
r
esidueIndex
-
1
)]
)
}
else
{
}
else
{
Vec3
.
copy
(
this
.
p0
,
this
.
p1
)
Vec3
.
copy
(
this
.
p0
,
this
.
p1
)
Vec3
.
copy
(
this
.
p1
,
this
.
p2
)
Vec3
.
copy
(
this
.
p1
,
this
.
p2
)
...
@@ -177,8 +178,8 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
...
@@ -177,8 +178,8 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
Vec3
.
copy
(
this
.
v12
,
this
.
v23
)
Vec3
.
copy
(
this
.
v12
,
this
.
v23
)
}
}
this
.
pos
(
this
.
p6
,
this
.
get
ElementIndex
(
residueIndex
+
3
as
ResidueIndex
,
'
trace
'
))
this
.
pos
(
this
.
p6
,
this
.
trace
ElementIndex
[
this
.
getResidueIndex
(
residueIndex
+
3
as
ResidueIndex
)
]
)
this
.
pos
(
this
.
v23
,
this
.
get
ElementIndex
(
residueIndex
,
'
direction
'
)
)
this
.
pos
(
this
.
v23
,
this
.
direction
ElementIndex
[
residueIndex
]
)
this
.
setControlPoint
(
value
.
p0
,
this
.
p0
,
this
.
p1
,
this
.
p2
,
residueIndex
-
2
as
ResidueIndex
)
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
)
this
.
setControlPoint
(
value
.
p1
,
this
.
p1
,
this
.
p2
,
this
.
p3
,
residueIndex
-
1
as
ResidueIndex
)
...
@@ -202,6 +203,9 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
...
@@ -202,6 +203,9 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
constructor
(
private
unit
:
Unit
.
Atomic
)
{
constructor
(
private
unit
:
Unit
.
Atomic
)
{
this
.
atomicConformation
=
unit
.
model
.
atomicConformation
this
.
atomicConformation
=
unit
.
model
.
atomicConformation
this
.
residueAtomSegments
=
unit
.
model
.
atomicHierarchy
.
residueAtomSegments
this
.
residueAtomSegments
=
unit
.
model
.
atomicHierarchy
.
residueAtomSegments
this
.
traceElementIndex
=
unit
.
model
.
atomicHierarchy
.
derived
.
residue
.
traceElementIndex
this
.
directionElementIndex
=
unit
.
model
.
atomicHierarchy
.
derived
.
residue
.
directionElementIndex
this
.
moleculeType
=
unit
.
model
.
atomicHierarchy
.
derived
.
residue
.
moleculeType
this
.
cyclicPolymerMap
=
unit
.
model
.
atomicHierarchy
.
cyclicPolymerMap
this
.
cyclicPolymerMap
=
unit
.
model
.
atomicHierarchy
.
cyclicPolymerMap
this
.
secondaryStructureType
=
unit
.
model
.
properties
.
secondaryStructure
.
type
this
.
secondaryStructureType
=
unit
.
model
.
properties
.
secondaryStructure
.
type
this
.
polymerIt
=
SortedRanges
.
transientSegments
(
getPolymerRanges
(
unit
),
unit
.
elements
)
this
.
polymerIt
=
SortedRanges
.
transientSegments
(
getPolymerRanges
(
unit
),
unit
.
elements
)
...
...
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