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
c8821fb1
Commit
c8821fb1
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
fix marking of coarse polymer traces
parent
2325ac9a
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/util/common.ts
+1
-1
1 addition, 1 deletion
src/mol-repr/structure/visual/util/common.ts
src/mol-repr/structure/visual/util/polymer.ts
+40
-14
40 additions, 14 deletions
src/mol-repr/structure/visual/util/polymer.ts
with
41 additions
and
15 deletions
src/mol-repr/structure/visual/util/common.ts
+
1
−
1
View file @
c8821fb1
...
...
@@ -11,7 +11,7 @@ import { OrderedSet, SortedArray } from 'mol-data/int';
import
{
EmptyLoci
,
Loci
}
from
'
mol-model/loci
'
;
/** Return a Loci for the elements of a whole residue the elementIndex belongs to. */
export
function
getResidueLoci
(
structure
:
Structure
,
unit
:
Unit
,
elementIndex
:
ElementIndex
):
Loci
{
export
function
getResidueLoci
(
structure
:
Structure
,
unit
:
Unit
.
Atomic
,
elementIndex
:
ElementIndex
):
Loci
{
const
{
elements
,
model
}
=
unit
if
(
OrderedSet
.
indexOf
(
elements
,
elementIndex
)
!==
-
1
)
{
const
{
index
,
offsets
}
=
model
.
atomicHierarchy
.
residueAtomSegments
...
...
This diff is collapsed.
Click to expand it.
src/mol-repr/structure/visual/util/polymer.ts
+
40
−
14
View file @
c8821fb1
...
...
@@ -72,12 +72,25 @@ export function getPolymerElementLoci(pickingId: PickingId, structureGroup: Stru
if
(
id
===
objectId
)
{
const
{
structure
,
group
}
=
structureGroup
const
unit
=
group
.
units
[
instanceId
]
return
getResidueLoci
(
structure
,
unit
,
unit
.
polymerElements
[
groupId
])
if
(
Unit
.
isAtomic
(
unit
))
{
return
getResidueLoci
(
structure
,
unit
,
unit
.
polymerElements
[
groupId
])
}
else
{
const
{
elements
}
=
unit
const
elementIndex
=
unit
.
polymerElements
[
groupId
]
const
unitIndex
=
OrderedSet
.
indexOf
(
elements
,
elementIndex
)
as
StructureElement
.
UnitIndex
|
-
1
if
(
unitIndex
!==
-
1
)
{
const
indices
=
OrderedSet
.
ofSingleton
(
unitIndex
)
return
StructureElement
.
Loci
(
structure
,
[{
unit
,
indices
}])
}
}
}
return
EmptyLoci
}
/** Mark a polymer element (e.g. part of a cartoon trace) when all its residue's elements are in a loci. */
/**
* Mark a polymer element (e.g. part of a cartoon trace)
* - for atomic units mark only when all its residue's elements are in a loci
*/
export
function
eachPolymerElement
(
loci
:
Loci
,
structureGroup
:
StructureGroup
,
apply
:
(
interval
:
Interval
)
=>
boolean
)
{
let
changed
=
false
if
(
!
StructureElement
.
isLoci
(
loci
))
return
false
...
...
@@ -90,19 +103,32 @@ export function eachPolymerElement(loci: Loci, structureGroup: StructureGroup, a
for
(
const
e
of
loci
.
elements
)
{
const
unitIdx
=
group
.
unitIndexMap
.
get
(
e
.
unit
.
id
)
if
(
unitIdx
!==
undefined
)
{
// TODO optimized implementation for intervals
OrderedSet
.
forEach
(
e
.
indices
,
v
=>
{
const
rI
=
index
[
elements
[
v
]]
const
unitIndexMin
=
OrderedSet
.
findPredecessorIndex
(
elements
,
offsets
[
rI
])
const
unitIndexMax
=
OrderedSet
.
findPredecessorIndex
(
elements
,
offsets
[
rI
+
1
]
-
1
)
const
unitIndexInterval
=
Interval
.
ofRange
(
unitIndexMin
,
unitIndexMax
)
if
(
!
OrderedSet
.
isSubset
(
e
.
indices
,
unitIndexInterval
))
return
const
eI
=
traceElementIndex
[
rI
]
const
idx
=
OrderedSet
.
indexOf
(
e
.
unit
.
polymerElements
,
eI
)
if
(
idx
!==
-
1
)
{
if
(
apply
(
Interval
.
ofSingleton
(
unitIdx
*
groupCount
+
idx
)))
changed
=
true
if
(
Unit
.
isAtomic
(
e
.
unit
))
{
// TODO optimized implementation for intervals
OrderedSet
.
forEach
(
e
.
indices
,
v
=>
{
const
rI
=
index
[
elements
[
v
]]
const
unitIndexMin
=
OrderedSet
.
findPredecessorIndex
(
elements
,
offsets
[
rI
])
const
unitIndexMax
=
OrderedSet
.
findPredecessorIndex
(
elements
,
offsets
[
rI
+
1
]
-
1
)
const
unitIndexInterval
=
Interval
.
ofRange
(
unitIndexMin
,
unitIndexMax
)
if
(
!
OrderedSet
.
isSubset
(
e
.
indices
,
unitIndexInterval
))
return
const
eI
=
traceElementIndex
[
rI
]
const
idx
=
OrderedSet
.
indexOf
(
e
.
unit
.
polymerElements
,
eI
)
if
(
idx
!==
-
1
)
{
if
(
apply
(
Interval
.
ofSingleton
(
unitIdx
*
groupCount
+
idx
)))
changed
=
true
}
})
}
else
{
if
(
Interval
.
is
(
e
.
indices
))
{
const
start
=
unitIdx
*
groupCount
+
Interval
.
start
(
e
.
indices
);
const
end
=
unitIdx
*
groupCount
+
Interval
.
end
(
e
.
indices
);
if
(
apply
(
Interval
.
ofBounds
(
start
,
end
)))
changed
=
true
}
else
{
for
(
let
i
=
0
,
_i
=
e
.
indices
.
length
;
i
<
_i
;
i
++
)
{
const
idx
=
unitIdx
*
groupCount
+
e
.
indices
[
i
];
if
(
apply
(
Interval
.
ofSingleton
(
idx
)))
changed
=
true
}
}
}
)
}
}
}
return
changed
...
...
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