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
0e2b6d97
Commit
0e2b6d97
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
dssp tweak, caMinDist and grid cellCount
parent
ff8c751f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-math/geometry/lookup3d/grid.ts
+10
-7
10 additions, 7 deletions
src/mol-math/geometry/lookup3d/grid.ts
src/mol-model/structure/model/properties/utils/secondary-structure.ts
+9
-2
9 additions, 2 deletions
...l/structure/model/properties/utils/secondary-structure.ts
with
19 additions
and
9 deletions
src/mol-math/geometry/lookup3d/grid.ts
+
10
−
7
View file @
0e2b6d97
...
...
@@ -17,8 +17,8 @@ interface GridLookup3D<T = number> extends Lookup3D<T> {
readonly
buckets
:
{
readonly
offset
:
ArrayLike
<
number
>
,
readonly
count
:
ArrayLike
<
number
>
,
readonly
array
:
ArrayLike
<
number
>
}
}
function
GridLookup3D
(
data
:
PositionData
,
cellSize
?:
Vec3
):
GridLookup3D
{
return
new
GridLookup3DImpl
(
data
,
cellSize
);
function
GridLookup3D
(
data
:
PositionData
,
cellSize
OrCount
?:
Vec3
|
number
):
GridLookup3D
{
return
new
GridLookup3DImpl
(
data
,
cellSize
OrCount
);
}
export
{
GridLookup3D
}
...
...
@@ -47,8 +47,8 @@ class GridLookup3DImpl implements GridLookup3D<number> {
return
query
(
this
.
ctx
);
}
constructor
(
data
:
PositionData
,
cellSize
?:
Vec3
)
{
const
structure
=
build
(
data
,
cellSize
);
constructor
(
data
:
PositionData
,
cellSize
OrCount
?:
Vec3
|
number
)
{
const
structure
=
build
(
data
,
cellSize
OrCount
);
this
.
ctx
=
createContext
(
structure
);
this
.
boundary
=
{
box
:
structure
.
boundingBox
,
sphere
:
structure
.
boundingSphere
};
this
.
buckets
=
{
offset
:
structure
.
bucketOffset
,
count
:
structure
.
bucketCounts
,
array
:
structure
.
bucketArray
};
...
...
@@ -184,7 +184,7 @@ function getBoundary(data: PositionData) {
return
{
boundingBox
:
boundaryHelper
.
getBox
(),
boundingSphere
:
boundaryHelper
.
getSphere
()
};
}
function
build
(
data
:
PositionData
,
cellSize
?:
Vec3
)
{
function
build
(
data
:
PositionData
,
cellSize
OrCount
?:
Vec3
|
number
)
{
const
{
boundingBox
,
boundingSphere
}
=
getBoundary
(
data
);
// need to expand the grid bounds to avoid rounding errors
const
expandedBox
=
Box3D
.
expand
(
Box3D
.
empty
(),
boundingBox
,
Vec3
.
create
(
0.5
,
0.5
,
0.5
));
...
...
@@ -195,13 +195,16 @@ function build(data: PositionData, cellSize?: Vec3) {
const
elementCount
=
OrderedSet
.
size
(
indices
);
const
cellCount
=
typeof
cellSizeOrCount
===
'
number
'
?
cellSizeOrCount
:
32
const
cellSize
=
Array
.
isArray
(
cellSizeOrCount
)
&&
cellSizeOrCount
if
(
cellSize
)
{
size
=
[
Math
.
ceil
(
S
[
0
]
/
cellSize
[
0
]),
Math
.
ceil
(
S
[
1
]
/
cellSize
[
1
]),
Math
.
ceil
(
S
[
2
]
/
cellSize
[
2
])];
delta
=
cellSize
;
}
else
if
(
elementCount
>
0
)
{
// size of the box
// required "grid volume" so that each cell contains on average
32
elements.
const
V
=
Math
.
ceil
(
elementCount
/
32
);
// required "grid volume" so that each cell contains on average
'cellCount'
elements.
const
V
=
Math
.
ceil
(
elementCount
/
cellCount
);
const
f
=
Math
.
pow
(
V
/
(
S
[
0
]
*
S
[
1
]
*
S
[
2
]),
1
/
3
);
size
=
[
Math
.
ceil
(
S
[
0
]
*
f
),
Math
.
ceil
(
S
[
1
]
*
f
),
Math
.
ceil
(
S
[
2
]
*
f
)];
delta
=
[
S
[
0
]
/
size
[
0
],
S
[
1
]
/
size
[
1
],
S
[
2
]
/
size
[
2
]];
...
...
This diff is collapsed.
Click to expand it.
src/mol-model/structure/model/properties/utils/secondary-structure.ts
+
9
−
2
View file @
0e2b6d97
...
...
@@ -88,6 +88,9 @@ namespace DSSPType {
/** max distance between two C-alpha atoms to check for hbond */
const
caMaxDist
=
7.0
;
/** min distance between two C-alpha atoms to check for hbond */
const
caMinDist
=
4.0
;
function
calcAtomicTraceLookup3D
(
hierarchy
:
AtomicHierarchy
,
conformation
:
AtomicConformation
)
{
const
{
x
,
y
,
z
}
=
conformation
;
const
{
moleculeType
,
traceElementIndex
}
=
hierarchy
.
derived
.
residue
...
...
@@ -99,7 +102,7 @@ function calcAtomicTraceLookup3D(hierarchy: AtomicHierarchy, conformation: Atomi
_proteinResidues
[
_proteinResidues
.
length
]
=
i
}
}
const
lookup3d
=
GridLookup3D
({
x
,
y
,
z
,
indices
:
SortedArray
.
ofSortedArray
(
indices
)
});
const
lookup3d
=
GridLookup3D
({
x
,
y
,
z
,
indices
:
SortedArray
.
ofSortedArray
(
indices
)
}
,
4
);
const
proteinResidues
=
SortedArray
.
ofSortedArray
<
ResidueIndex
>
(
_proteinResidues
)
return
{
lookup3d
,
proteinResidues
}
}
...
...
@@ -160,6 +163,8 @@ function calcBackboneHbonds(hierarchy: AtomicHierarchy, conformation: AtomicConf
const
cPosPrev
=
Vec3
.
zero
()
const
oPosPrev
=
Vec3
.
zero
()
const
caMinDistSq
=
caMinDist
*
caMinDist
for
(
let
i
=
0
,
il
=
proteinResidues
.
length
;
i
<
il
;
++
i
)
{
const
oPI
=
i
const
oRI
=
proteinResidues
[
i
]
...
...
@@ -178,9 +183,11 @@ function calcBackboneHbonds(hierarchy: AtomicHierarchy, conformation: AtomicConf
position
(
cAtom
,
cPos
)
position
(
caAtom
,
caPos
)
const
{
indices
,
count
}
=
lookup3d
.
find
(
caPos
[
0
],
caPos
[
1
],
caPos
[
2
],
caMaxDist
)
const
{
indices
,
count
,
squaredDistances
}
=
lookup3d
.
find
(
caPos
[
0
],
caPos
[
1
],
caPos
[
2
],
caMaxDist
)
for
(
let
j
=
0
;
j
<
count
;
++
j
)
{
if
(
squaredDistances
[
j
]
<
caMinDistSq
)
continue
const
nPI
=
indices
[
j
]
// ignore bonds within a residue or to prev or next residue, TODO take chain border into account
...
...
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