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
36eae744
Commit
36eae744
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
ensure that "single atom chains" units have same entity id
parent
00df6ae5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-model/structure/structure/structure.ts
+9
-5
9 additions, 5 deletions
src/mol-model/structure/structure/structure.ts
with
9 additions
and
5 deletions
src/mol-model/structure/structure/structure.ts
+
9
−
5
View file @
36eae744
...
...
@@ -373,7 +373,7 @@ namespace Structure {
* Construct a Structure from a model.
*
* Generally, a single unit corresponds to a single chain, with the exception
* of consecutive "single atom chains".
* of consecutive "single atom chains"
with same entity id
.
*/
export
function
ofModel
(
model
:
Model
):
Structure
{
const
chains
=
model
.
atomicHierarchy
.
chainAtomSegments
;
...
...
@@ -382,16 +382,20 @@ namespace Structure {
for
(
let
c
=
0
;
c
<
chains
.
count
;
c
++
)
{
const
start
=
chains
.
offsets
[
c
];
// merge all consecutive "single atom chains"
// merge all consecutive "single atom chains"
with same entity id
while
(
c
+
1
<
chains
.
count
&&
chains
.
offsets
[
c
+
1
]
-
chains
.
offsets
[
c
]
===
1
&&
chains
.
offsets
[
c
+
2
]
-
chains
.
offsets
[
c
+
1
]
===
1
)
{
&&
chains
.
offsets
[
c
+
2
]
-
chains
.
offsets
[
c
+
1
]
===
1
)
{
c
++
;
const
e1
=
model
.
atomicHierarchy
.
index
.
getEntityFromChain
(
c
as
ChainIndex
);
const
e2
=
model
.
atomicHierarchy
.
index
.
getEntityFromChain
(
c
+
1
as
ChainIndex
);
if
(
e1
!==
e2
)
break
}
const
elements
=
SortedArray
.
ofBounds
(
start
as
ElementIndex
,
chains
.
offsets
[
c
+
1
]
as
ElementIndex
);
if
(
isWaterChain
(
model
,
c
as
ChainIndex
,
elements
))
{
if
(
isWaterChain
(
model
,
c
as
ChainIndex
))
{
partitionAtomicUnit
(
model
,
elements
,
builder
);
}
else
{
builder
.
addUnit
(
Unit
.
Kind
.
Atomic
,
model
,
SymmetryOperator
.
Default
,
elements
);
...
...
@@ -411,7 +415,7 @@ namespace Structure {
return
builder
.
getStructure
();
}
function
isWaterChain
(
model
:
Model
,
chainIndex
:
ChainIndex
,
indices
:
SortedArray
)
{
function
isWaterChain
(
model
:
Model
,
chainIndex
:
ChainIndex
)
{
const
e
=
model
.
atomicHierarchy
.
index
.
getEntityFromChain
(
chainIndex
);
return
model
.
entities
.
data
.
type
.
value
(
e
)
===
'
water
'
;
}
...
...
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