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
ad379e7a
Commit
ad379e7a
authored
Mar 7, 2020
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
improved Interactions params
parent
9d45beea
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-props/computed/interactions/interactions.ts
+31
-20
31 additions, 20 deletions
src/mol-model-props/computed/interactions/interactions.ts
with
31 additions
and
20 deletions
src/mol-model-props/computed/interactions/interactions.ts
+
31
−
20
View file @
ad379e7a
...
@@ -11,7 +11,7 @@ import { ValenceModelProvider } from '../valence-model';
...
@@ -11,7 +11,7 @@ import { ValenceModelProvider } from '../valence-model';
import
{
InteractionsIntraContacts
,
InteractionsInterContacts
,
FeatureType
,
interactionTypeLabel
}
from
'
./common
'
;
import
{
InteractionsIntraContacts
,
InteractionsInterContacts
,
FeatureType
,
interactionTypeLabel
}
from
'
./common
'
;
import
{
IntraContactsBuilder
,
InterContactsBuilder
}
from
'
./contacts-builder
'
;
import
{
IntraContactsBuilder
,
InterContactsBuilder
}
from
'
./contacts-builder
'
;
import
{
IntMap
}
from
'
../../../mol-data/int
'
;
import
{
IntMap
}
from
'
../../../mol-data/int
'
;
import
{
addUnitContacts
,
ContactTester
,
addStructureContacts
,
ContactProvider
,
ContactsParams
,
ContactsProps
}
from
'
./contacts
'
;
import
{
addUnitContacts
,
ContactTester
,
addStructureContacts
,
ContactsParams
,
ContactsProps
}
from
'
./contacts
'
;
import
{
HalogenDonorProvider
,
HalogenAcceptorProvider
,
HalogenBondsProvider
}
from
'
./halogen-bonds
'
;
import
{
HalogenDonorProvider
,
HalogenAcceptorProvider
,
HalogenBondsProvider
}
from
'
./halogen-bonds
'
;
import
{
HydrogenDonorProvider
,
WeakHydrogenDonorProvider
,
HydrogenAcceptorProvider
,
HydrogenBondsProvider
,
WeakHydrogenBondsProvider
}
from
'
./hydrogen-bonds
'
;
import
{
HydrogenDonorProvider
,
WeakHydrogenDonorProvider
,
HydrogenAcceptorProvider
,
HydrogenBondsProvider
,
WeakHydrogenBondsProvider
}
from
'
./hydrogen-bonds
'
;
import
{
NegativChargeProvider
,
PositiveChargeProvider
,
AromaticRingProvider
,
IonicProvider
,
PiStackingProvider
,
CationPiProvider
}
from
'
./charged
'
;
import
{
NegativChargeProvider
,
PositiveChargeProvider
,
AromaticRingProvider
,
IonicProvider
,
PiStackingProvider
,
CationPiProvider
}
from
'
./charged
'
;
...
@@ -25,6 +25,7 @@ import { CentroidHelper } from '../../../mol-math/geometry/centroid-helper';
...
@@ -25,6 +25,7 @@ import { CentroidHelper } from '../../../mol-math/geometry/centroid-helper';
import
{
Sphere3D
}
from
'
../../../mol-math/geometry
'
;
import
{
Sphere3D
}
from
'
../../../mol-math/geometry
'
;
import
{
DataLoci
}
from
'
../../../mol-model/loci
'
;
import
{
DataLoci
}
from
'
../../../mol-model/loci
'
;
import
{
bondLabel
,
LabelGranularity
}
from
'
../../../mol-theme/label
'
;
import
{
bondLabel
,
LabelGranularity
}
from
'
../../../mol-theme/label
'
;
import
{
ObjectKeys
}
from
'
../../../mol-util/type-helpers
'
;
export
{
Interactions
}
export
{
Interactions
}
...
@@ -147,15 +148,21 @@ const ContactProviders = {
...
@@ -147,15 +148,21 @@ const ContactProviders = {
}
}
type
ContactProviders
=
typeof
ContactProviders
type
ContactProviders
=
typeof
ContactProviders
function
getProvidersParams
()
{
function
getProvidersParams
(
defaultOn
:
string
[]
=
[])
{
const
params
:
{
[
k
in
keyof
ContactProviders
]:
PD
.
Group
<
ContactProviders
[
k
][
'
params
'
]
>
}
=
Object
.
create
(
null
)
const
params
:
{
[
k
in
keyof
ContactProviders
]:
PD
.
Mapped
<
PD
.
NamedParamUnion
<
{
on
:
PD
.
Group
<
ContactProviders
[
k
][
'
params
'
]
>
off
:
PD
.
Group
<
{}
>
}
>>
}
=
Object
.
create
(
null
)
Object
.
keys
(
ContactProviders
).
forEach
(
k
=>
{
Object
.
keys
(
ContactProviders
).
forEach
(
k
=>
{
(
params
as
any
)[
k
]
=
PD
.
Group
(
ContactProviders
[
k
as
keyof
ContactProviders
].
params
)
(
params
as
any
)[
k
]
=
PD
.
MappedStatic
(
defaultOn
.
includes
(
k
)
?
'
on
'
:
'
off
'
,
{
on
:
PD
.
Group
(
ContactProviders
[
k
as
keyof
ContactProviders
].
params
),
off
:
PD
.
Group
({})
},
{
cycle
:
true
})
})
})
return
params
return
params
}
}
export
const
InteractionsParams
=
{
export
const
ContactProviderParams
=
getProvidersParams
([
types
:
PD
.
MultiSelect
([
// 'ionic',
// 'ionic',
'
cation-pi
'
,
'
cation-pi
'
,
'
pi-stacking
'
,
'
pi-stacking
'
,
...
@@ -164,9 +171,11 @@ export const InteractionsParams = {
...
@@ -164,9 +171,11 @@ export const InteractionsParams = {
// 'hydrophobic',
// 'hydrophobic',
'
metal-coordination
'
,
'
metal-coordination
'
,
// 'weak-hydrogen-bonds',
// 'weak-hydrogen-bonds',
],
PD
.
objectToOptions
(
ContactProviders
)),
])
contacts
:
PD
.
Group
(
ContactsParams
,
{
isFlat
:
true
}),
...
getProvidersParams
()
export
const
InteractionsParams
=
{
providers
:
PD
.
Group
(
ContactProviderParams
,
{
isFlat
:
true
}),
contacts
:
PD
.
Group
(
ContactsParams
,
{
label
:
'
Advanced Options
'
}),
}
}
export
type
InteractionsParams
=
typeof
InteractionsParams
export
type
InteractionsParams
=
typeof
InteractionsParams
export
type
InteractionsProps
=
PD
.
Values
<
InteractionsParams
>
export
type
InteractionsProps
=
PD
.
Values
<
InteractionsParams
>
...
@@ -175,11 +184,13 @@ export async function computeInteractions(ctx: CustomProperty.Context, structure
...
@@ -175,11 +184,13 @@ export async function computeInteractions(ctx: CustomProperty.Context, structure
const
p
=
{
...
PD
.
getDefaultValues
(
InteractionsParams
),
...
props
}
const
p
=
{
...
PD
.
getDefaultValues
(
InteractionsParams
),
...
props
}
await
ValenceModelProvider
.
attach
(
ctx
,
structure
)
await
ValenceModelProvider
.
attach
(
ctx
,
structure
)
const
contactProviders
:
ContactProvider
<
any
>
[]
=
[]
const
contactTesters
:
ContactTester
[]
=
[];
Object
.
keys
(
ContactProviders
).
forEach
(
k
=>
{
ObjectKeys
(
ContactProviders
).
forEach
(
k
=>
{
if
(
p
.
types
.
includes
(
k
))
contactProviders
.
push
(
ContactProviders
[
k
as
keyof
typeof
ContactProviders
])
const
{
name
,
params
}
=
p
.
providers
[
k
]
if
(
name
===
'
on
'
)
{
contactTesters
.
push
(
ContactProviders
[
k
].
createTester
(
params
as
any
))
}
})
})
const
contactTesters
=
contactProviders
.
map
(
l
=>
l
.
createTester
(
p
[
l
.
name
as
keyof
InteractionsProps
]))
const
requiredFeatures
=
new
Set
<
FeatureType
>
()
const
requiredFeatures
=
new
Set
<
FeatureType
>
()
contactTesters
.
forEach
(
l
=>
SetUtils
.
add
(
requiredFeatures
,
l
.
requiredFeatures
))
contactTesters
.
forEach
(
l
=>
SetUtils
.
add
(
requiredFeatures
,
l
.
requiredFeatures
))
...
...
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