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
54fcbd27
Commit
54fcbd27
authored
7 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
Use Structure.Builder for assemblies
parent
c8d0cfc4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-model/structure/structure/structure.ts
+2
-0
2 additions, 0 deletions
src/mol-model/structure/structure/structure.ts
src/mol-model/structure/structure/symmetry.ts
+5
-12
5 additions, 12 deletions
src/mol-model/structure/structure/symmetry.ts
src/mol-ql/TODO
+2
-0
2 additions, 0 deletions
src/mol-ql/TODO
with
9 additions
and
12 deletions
src/mol-model/structure/structure/structure.ts
+
2
−
0
View file @
54fcbd27
...
@@ -44,6 +44,7 @@ namespace Structure {
...
@@ -44,6 +44,7 @@ namespace Structure {
}
}
export
interface
Builder
{
export
interface
Builder
{
add
(
unit
:
Unit
,
atoms
:
OrderedSet
):
void
,
addUnit
(
unit
:
Unit
):
void
,
addUnit
(
unit
:
Unit
):
void
,
addAtoms
(
unitId
:
number
,
atoms
:
OrderedSet
):
void
,
addAtoms
(
unitId
:
number
,
atoms
:
OrderedSet
):
void
,
getStructure
():
Structure
,
getStructure
():
Structure
,
...
@@ -55,6 +56,7 @@ namespace Structure {
...
@@ -55,6 +56,7 @@ namespace Structure {
private
atoms
=
Object
.
create
(
null
);
private
atoms
=
Object
.
create
(
null
);
atomCount
=
0
;
atomCount
=
0
;
add
(
unit
:
Unit
,
atoms
:
OrderedSet
)
{
this
.
addUnit
(
unit
);
this
.
addAtoms
(
unit
.
id
,
atoms
);
}
addUnit
(
unit
:
Unit
)
{
this
.
units
[
unit
.
id
]
=
unit
;
}
addUnit
(
unit
:
Unit
)
{
this
.
units
[
unit
.
id
]
=
unit
;
}
addAtoms
(
unitId
:
number
,
atoms
:
OrderedSet
)
{
this
.
atoms
[
unitId
]
=
atoms
;
this
.
atomCount
+=
OrderedSet
.
size
(
atoms
);
}
addAtoms
(
unitId
:
number
,
atoms
:
OrderedSet
)
{
this
.
atoms
[
unitId
]
=
atoms
;
this
.
atomCount
+=
OrderedSet
.
size
(
atoms
);
}
getStructure
():
Structure
{
return
this
.
atomCount
>
0
?
Structure
.
create
(
this
.
units
,
AtomSet
.
create
(
this
.
atoms
))
:
Empty
;
}
getStructure
():
Structure
{
return
this
.
atomCount
>
0
?
Structure
.
create
(
this
.
units
,
AtomSet
.
create
(
this
.
atoms
))
:
Empty
;
}
...
...
This diff is collapsed.
Click to expand it.
src/mol-model/structure/structure/symmetry.ts
+
5
−
12
View file @
54fcbd27
...
@@ -23,12 +23,9 @@ function buildAssemblyImpl(structure: Structure, name: string) {
...
@@ -23,12 +23,9 @@ function buildAssemblyImpl(structure: Structure, name: string) {
const
assembly
=
ModelSymmetry
.
findAssembly
(
models
[
0
],
name
);
const
assembly
=
ModelSymmetry
.
findAssembly
(
models
[
0
],
name
);
if
(
!
assembly
)
throw
new
Error
(
`Assembly '
${
name
}
' is not defined.`
);
if
(
!
assembly
)
throw
new
Error
(
`Assembly '
${
name
}
' is not defined.`
);
const
{
operatorGroups
}
=
assembly
;
const
assembler
=
Structure
.
Builder
()
;
const
assemblyUnits
=
Object
.
create
(
null
);
for
(
const
g
of
assembly
.
operatorGroups
)
{
const
assemblyAtoms
=
Object
.
create
(
null
);
for
(
const
g
of
operatorGroups
)
{
const
selection
=
g
.
selector
(
structure
);
const
selection
=
g
.
selector
(
structure
);
if
(
Selection
.
structureCount
(
selection
)
===
0
)
continue
;
if
(
Selection
.
structureCount
(
selection
)
===
0
)
continue
;
const
{
units
,
atoms
}
=
Selection
.
union
(
selection
);
const
{
units
,
atoms
}
=
Selection
.
union
(
selection
);
...
@@ -37,15 +34,11 @@ function buildAssemblyImpl(structure: Structure, name: string) {
...
@@ -37,15 +34,11 @@ function buildAssemblyImpl(structure: Structure, name: string) {
for
(
const
oper
of
g
.
operators
)
{
for
(
const
oper
of
g
.
operators
)
{
for
(
let
uI
=
0
,
_uI
=
unitIds
.
length
;
uI
<
_uI
;
uI
++
)
{
for
(
let
uI
=
0
,
_uI
=
unitIds
.
length
;
uI
<
_uI
;
uI
++
)
{
const
unitId
=
unitIds
[
uI
];
const
unit
=
units
[
unitIds
[
uI
]];
const
unit
=
units
[
unitId
];
assembler
.
add
(
Unit
.
create
(
unit
.
model
,
oper
),
AtomSet
.
unitGetByIndex
(
atoms
,
uI
));
const
newUnit
=
Unit
.
create
(
unit
.
model
,
oper
);
assemblyUnits
[
newUnit
.
id
]
=
newUnit
;
assemblyAtoms
[
newUnit
.
id
]
=
AtomSet
.
unitGetByIndex
(
atoms
,
uI
);
}
}
}
}
}
}
return
Structure
.
create
(
assemblyUnits
,
AtomSet
.
create
(
assemblyAtoms
)
);
return
assembler
.
getStructure
(
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-ql/TODO
0 → 100644
+
2
−
0
View file @
54fcbd27
- Have the ability to define schemas for output.
Define properties for each pattern/whatever that could be exported as CIF/CSV/JSON.
\ No newline at end of file
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