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
dd6dcdda
Commit
dd6dcdda
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
Update Structure construction from Model
parent
52a8a0e5
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/apps/structure-info/model.ts
+1
-1
1 addition, 1 deletion
src/apps/structure-info/model.ts
src/mol-model/structure/structure/structure.ts
+11
-9
11 additions, 9 deletions
src/mol-model/structure/structure/structure.ts
with
12 additions
and
10 deletions
src/apps/structure-info/model.ts
+
1
−
1
View file @
dd6dcdda
...
...
@@ -196,7 +196,7 @@ async function run(mmcif: mmCIF_Database) {
//printIHMModels(models[0]);
printUnits
(
structure
);
//printRings(structure);
printLinks
(
structure
,
true
,
true
);
//
printLinks(structure, true, true);
//printModRes(models[0]);
//printSecStructure(models[0]);
}
...
...
This diff is collapsed.
Click to expand it.
src/mol-model/structure/structure/structure.ts
+
11
−
9
View file @
dd6dcdda
...
...
@@ -94,25 +94,27 @@ namespace Structure {
export
function
create
(
units
:
ReadonlyArray
<
Unit
>
):
Structure
{
return
new
Structure
(
units
);
}
/**
* Construct a Structure from a model.
*
* Generally, a single unit corresponds to a single chain, with the exception
* of consecutive "single atom chains".
*/
export
function
ofModel
(
model
:
Model
):
Structure
{
const
chains
=
model
.
atomicHierarchy
.
chainSegments
;
const
builder
=
new
StructureBuilder
();
const
{
residueSegments
:
{
segmentMap
:
residueIndex
}
}
=
model
.
atomicHierarchy
;
for
(
let
c
=
0
;
c
<
chains
.
count
;
c
++
)
{
const
start
=
chains
.
segments
[
c
];
let
end
=
chains
.
segments
[
c
+
1
];
let
rStart
=
residueIndex
[
start
],
rEnd
=
residueIndex
[
end
-
1
];
while
(
rEnd
-
rStart
<=
1
&&
c
+
1
<
chains
.
count
)
{
// merge all consecutive "single atom chains"
while
(
c
+
1
<
chains
.
count
&&
chains
.
segments
[
c
+
1
]
-
chains
.
segments
[
c
]
===
1
&&
chains
.
segments
[
c
+
2
]
-
chains
.
segments
[
c
+
1
]
===
1
)
{
c
++
;
end
=
chains
.
segments
[
c
+
1
];
rStart
=
rEnd
;
rEnd
=
residueIndex
[
end
-
1
];
}
const
elements
=
SortedArray
.
ofBounds
(
start
,
end
);
const
elements
=
SortedArray
.
ofBounds
(
start
,
chains
.
segments
[
c
+
1
]
);
builder
.
addUnit
(
Unit
.
Kind
.
Atomic
,
model
,
SymmetryOperator
.
Default
,
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