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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
79510614
Commit
79510614
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
add .uniqueElementCount and .polymerUnitCount to Structure
parent
f8c9bc68
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-model/structure/structure/structure.ts
+47
-5
47 additions, 5 deletions
src/mol-model/structure/structure/structure.ts
with
47 additions
and
5 deletions
src/mol-model/structure/structure/structure.ts
+
47
−
5
View file @
79510614
...
@@ -56,7 +56,9 @@ class Structure {
...
@@ -56,7 +56,9 @@ class Structure {
/** Hash based on all unit.id values in the structure, reflecting the units transformation */
/** Hash based on all unit.id values in the structure, reflecting the units transformation */
transformHash
:
number
,
transformHash
:
number
,
elementCount
:
number
,
elementCount
:
number
,
uniqueElementCount
:
number
,
polymerResidueCount
:
number
,
polymerResidueCount
:
number
,
polymerUnitCount
:
number
,
coordinateSystem
:
SymmetryOperator
,
coordinateSystem
:
SymmetryOperator
,
label
:
string
,
label
:
string
,
propertyData
?:
any
,
propertyData
?:
any
,
...
@@ -65,7 +67,9 @@ class Structure {
...
@@ -65,7 +67,9 @@ class Structure {
hashCode
:
-
1
,
hashCode
:
-
1
,
transformHash
:
-
1
,
transformHash
:
-
1
,
elementCount
:
-
1
,
elementCount
:
-
1
,
uniqueElementCount
:
-
1
,
polymerResidueCount
:
-
1
,
polymerResidueCount
:
-
1
,
polymerUnitCount
:
-
1
,
coordinateSystem
:
SymmetryOperator
.
Default
,
coordinateSystem
:
SymmetryOperator
.
Default
,
label
:
''
label
:
''
};
};
...
@@ -106,15 +110,25 @@ class Structure {
...
@@ -106,15 +110,25 @@ class Structure {
/** Count of all polymer residues in the structure */
/** Count of all polymer residues in the structure */
get
polymerResidueCount
()
{
get
polymerResidueCount
()
{
if
(
this
.
_props
.
polymerResidueCount
===
-
1
)
{
if
(
this
.
_props
.
polymerResidueCount
===
-
1
)
{
let
polymerResidueCount
=
0
this
.
_props
.
polymerResidueCount
=
getPolymerResidueCount
(
this
)
for
(
let
i
=
0
,
_i
=
this
.
units
.
length
;
i
<
_i
;
i
++
)
{
polymerResidueCount
+=
this
.
units
[
i
].
polymerElements
.
length
;
}
this
.
_props
.
polymerResidueCount
=
polymerResidueCount
}
}
return
this
.
_props
.
polymerResidueCount
;
return
this
.
_props
.
polymerResidueCount
;
}
}
get
polymerUnitCount
()
{
if
(
this
.
_props
.
polymerUnitCount
===
-
1
)
{
this
.
_props
.
polymerUnitCount
=
getPolymerUnitCount
(
this
)
}
return
this
.
_props
.
polymerUnitCount
;
}
get
uniqueElementCount
()
{
if
(
this
.
_props
.
uniqueElementCount
===
-
1
)
{
this
.
_props
.
uniqueElementCount
=
getUniqueElementCount
(
this
)
}
return
this
.
_props
.
uniqueElementCount
;
}
/** Coarse structure, defined as Containing less than twice as many elements as polymer residues */
/** Coarse structure, defined as Containing less than twice as many elements as polymer residues */
get
isCoarse
()
{
get
isCoarse
()
{
const
ec
=
this
.
elementCount
const
ec
=
this
.
elementCount
...
@@ -131,6 +145,7 @@ class Structure {
...
@@ -131,6 +145,7 @@ class Structure {
return
this
.
computeHash
();
return
this
.
computeHash
();
}
}
/** Hash based on all unit.id values in the structure, reflecting the units transformation */
get
transformHash
()
{
get
transformHash
()
{
if
(
this
.
_props
.
transformHash
!==
-
1
)
return
this
.
_props
.
transformHash
;
if
(
this
.
_props
.
transformHash
!==
-
1
)
return
this
.
_props
.
transformHash
;
this
.
_props
.
transformHash
=
hashFnv32a
(
this
.
units
.
map
(
u
=>
u
.
id
))
this
.
_props
.
transformHash
=
hashFnv32a
(
this
.
units
.
map
(
u
=>
u
.
id
))
...
@@ -408,6 +423,33 @@ function getUniqueAtomicResidueIndices(structure: Structure): ReadonlyMap<UUID,
...
@@ -408,6 +423,33 @@ function getUniqueAtomicResidueIndices(structure: Structure): ReadonlyMap<UUID,
return
ret
;
return
ret
;
}
}
function
getUniqueElementCount
(
structure
:
Structure
):
number
{
const
{
unitSymmetryGroups
}
=
structure
let
uniqueElementCount
=
0
for
(
let
i
=
0
,
_i
=
unitSymmetryGroups
.
length
;
i
<
_i
;
i
++
)
{
uniqueElementCount
+=
unitSymmetryGroups
[
i
].
elements
.
length
}
return
uniqueElementCount
}
function
getPolymerResidueCount
(
structure
:
Structure
):
number
{
const
{
units
}
=
structure
let
polymerResidueCount
=
0
for
(
let
i
=
0
,
_i
=
units
.
length
;
i
<
_i
;
i
++
)
{
polymerResidueCount
+=
units
[
i
].
polymerElements
.
length
;
}
return
polymerResidueCount
}
function
getPolymerUnitCount
(
structure
:
Structure
):
number
{
const
{
units
}
=
structure
let
polymerUnitCount
=
0
for
(
let
i
=
0
,
_i
=
units
.
length
;
i
<
_i
;
i
++
)
{
if
(
units
[
i
].
polymerElements
.
length
>
0
)
polymerUnitCount
+=
1
}
return
polymerUnitCount
}
interface
SerialMapping
{
interface
SerialMapping
{
/** Cummulative count of elements for each unit */
/** Cummulative count of elements for each unit */
unitElementCount
:
ArrayLike
<
number
>
unitElementCount
:
ArrayLike
<
number
>
...
...
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