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
e94d3a69
Commit
e94d3a69
authored
6 years ago
by
Sebastian Bittrich
Browse files
Options
Downloads
Patches
Plain Diff
employs switch-case for radii determination
parent
8d2ba31a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-model/structure/model/properties/utils/accessible-surface-area.ts
+23
-28
23 additions, 28 deletions
...ructure/model/properties/utils/accessible-surface-area.ts
with
23 additions
and
28 deletions
src/mol-model/structure/model/properties/utils/accessible-surface-area.ts
+
23
−
28
View file @
e94d3a69
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
{
AtomicHierarchy
,
AtomicConformation
}
from
'
../atomic
'
;
import
{
ElementSymbol
,
VdwRadii
}
from
'
../../types
'
;
import
{
skipUntil
}
from
'
rxjs/operators
'
;
import
{
atomicHet
}
from
'
mol-model/structure/query/queries/internal
'
;
import
{
compile
}
from
'
mol-script/runtime/query/compiler
'
;
const
defaultNumberOfPoints
=
960
;
const
defaultProbeSize
=
1.4
;
...
...
@@ -31,21 +28,12 @@ export function computeModelASA(hierarchy: AtomicHierarchy, conformation: Atomic
}
function
calculateASA
(
ctx
:
ASAContext
)
{
console
.
log
(
ctx
.
hierarchy
)
// 1. extract all heavy atoms
// 2. assign radius to all heavy atoms - depends on element
// 3. for each residue
// 3a. calculate the individual ASA of each atom
// 3b. sum up
// 3c. (optionally) normalize by maximum value expected for a particular amino acid - needs lookup of max values
// const { type_symbol } = ctx.hierarchy.atoms;
// console.log(type_symbol.value(0));
const
{
atoms
,
residues
,
residueAtomSegments
,
derived
}
=
ctx
.
hierarchy
;
const
{
type_symbol
}
=
atoms
;
const
radii
:
number
[]
=
[];
const
asa
:
number
[]
=
[];
// 1. extract all heavy atoms
// TODO can be more elegant by obtaining residue info once and then using offset to navigate to next residue
for
(
let
i
=
0
;
i
<
type_symbol
.
rowCount
;
++
i
)
{
// skip hydrogen atoms
...
...
@@ -62,8 +50,15 @@ function calculateASA(ctx: ASAContext) {
const
atomId
=
atoms
.
label_atom_id
.
value
(
i
);
const
compId
=
residues
.
label_comp_id
.
value
(
groupIndex
);
const
element
=
type_symbol
.
value
(
i
);
// 2. assign radius to all heavy atoms - depends on element and bonding patterns
radii
[
radii
.
length
]
=
determineRadius
(
atomId
,
element
,
compId
);
}
// 3. for each residue
// 3a. calculate the individual ASA of each atom
// 3b. sum up
// 3c. (optionally) normalize by maximum value expected for a particular amino acid - needs lookup of max values
}
/**
...
...
@@ -80,24 +75,24 @@ function determineRadius(atomId: string, element: ElementSymbol, compId: string)
case
'
N
'
:
return
atomId
===
'
NZ
'
?
tetrahedralNitrogenVdw
:
trigonalNitrogenVdw
;
case
'
C
'
:
if
(
atomId
===
'
C
'
||
atomId
===
'
CE1
'
||
atomId
===
'
CE2
'
||
atomId
===
'
CE3
'
||
atomId
===
'
CH2
'
||
atomId
===
'
CZ
'
||
atomId
===
'
CZ2
'
||
atomId
===
'
CZ3
'
)
{
return
trigonalCarbonVdw
;
}
else
if
(
atomId
===
'
CA
'
||
atomId
===
'
CB
'
||
atomId
===
'
CE
'
||
atomId
===
'
CG1
'
||
atomId
===
'
CG2
'
)
{
return
tetrahedralCarbonVdw
;
}
else
if
(
compId
===
'
PHE
'
||
compId
===
'
TRP
'
||
compId
===
'
TYR
'
||
compId
===
'
HIS
'
||
compId
===
'
ASP
'
||
compId
===
'
ASN
'
)
{
switch
(
atomId
)
{
case
'
C
'
:
case
'
CE1
'
:
case
'
CE2
'
:
case
'
CE3
'
:
case
'
CH2
'
:
case
'
CZ
'
:
case
'
CZ2
'
:
case
'
CZ3
'
:
return
trigonalCarbonVdw
;
}
else
if
(
compId
===
'
PRO
'
||
compId
===
'
LYS
'
||
compId
===
'
ARG
'
||
compId
===
'
MET
'
||
compId
===
'
ILE
'
||
compId
===
'
LEU
'
)
{
case
'
CA
'
:
case
'
CB
'
:
case
'
CE
'
:
case
'
CG1
'
:
case
'
CG2
'
:
return
tetrahedralCarbonVdw
;
}
else
if
(
compId
===
'
GLU
'
||
compId
===
'
GLN
'
)
{
return
atomId
===
'
CD
'
?
trigonalCarbonVdw
:
tetrahedralCarbonVdw
;
default
:
switch
(
compId
)
{
case
'
PHE
'
:
case
'
TRP
'
:
case
'
TYR
'
:
case
'
HIS
'
:
case
'
ASP
'
:
case
'
ASN
'
:
return
trigonalCarbonVdw
;
case
'
PRO
'
:
case
'
LYS
'
:
case
'
ARG
'
:
case
'
MET
'
:
case
'
ILE
'
:
case
'
LEU
'
:
return
tetrahedralCarbonVdw
;
case
'
GLU
'
:
case
'
GLN
'
:
return
atomId
===
'
CD
'
?
trigonalCarbonVdw
:
tetrahedralCarbonVdw
;
}
}
default
:
return
(
VdwRadii
as
any
)[
atomId
];
}
// TODO could potentially use logging or error thrown
return
(
VdwRadii
as
any
)[
atomId
];
}
/** Creates a collection of points on a sphere by the Golden Section Spiral algorithm. */
...
...
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