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
478033d4
Commit
478033d4
authored
4 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-plugin: added excludeTargetFromSurroundings to Focus behavior
parent
4753271a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package-lock.json
+0
-0
0 additions, 0 deletions
package-lock.json
src/mol-plugin/behavior/dynamic/selection/structure-focus-representation.ts
+28
-5
28 additions, 5 deletions
...avior/dynamic/selection/structure-focus-representation.ts
with
28 additions
and
5 deletions
package-lock.json
-4 B (0%)
View file @
478033d4
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
This diff is collapsed.
Click to expand it.
src/mol-plugin/behavior/dynamic/selection/structure-focus-representation.ts
+
28
−
5
View file @
478033d4
...
@@ -39,7 +39,8 @@ const StructureFocusRepresentationParams = (plugin: PluginContext) => {
...
@@ -39,7 +39,8 @@ const StructureFocusRepresentationParams = (plugin: PluginContext) => {
size
:
SizeTheme
.
BuiltIn
.
uniform
size
:
SizeTheme
.
BuiltIn
.
uniform
})
})
}),
}),
components
:
PD
.
MultiSelect
(
FocusComponents
,
PD
.
arrayToOptions
(
FocusComponents
))
components
:
PD
.
MultiSelect
(
FocusComponents
,
PD
.
arrayToOptions
(
FocusComponents
)),
excludeTargetFromSurroundings
:
PD
.
Boolean
(
false
,
{
label
:
'
Exclude Target
'
,
description
:
'
Exclude the focus "target" from the surroudings component.
'
})
};
};
};
};
...
@@ -106,6 +107,7 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
...
@@ -106,6 +107,7 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
private
clear
(
root
:
StateTransform
.
Ref
)
{
private
clear
(
root
:
StateTransform
.
Ref
)
{
const
state
=
this
.
plugin
.
state
.
data
;
const
state
=
this
.
plugin
.
state
.
data
;
this
.
currentSource
=
void
0
;
const
foci
=
state
.
select
(
StateSelection
.
Generators
.
byRef
(
root
).
subtree
().
withTag
(
StructureFocusRepresentationTags
.
TargetSel
));
const
foci
=
state
.
select
(
StateSelection
.
Generators
.
byRef
(
root
).
subtree
().
withTag
(
StructureFocusRepresentationTags
.
TargetSel
));
const
surrs
=
state
.
select
(
StateSelection
.
Generators
.
byRef
(
root
).
subtree
().
withTag
(
StructureFocusRepresentationTags
.
SurrSel
));
const
surrs
=
state
.
select
(
StateSelection
.
Generators
.
byRef
(
root
).
subtree
().
withTag
(
StructureFocusRepresentationTags
.
SurrSel
));
...
@@ -125,21 +127,31 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
...
@@ -125,21 +127,31 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
return
PluginCommands
.
State
.
Update
(
this
.
plugin
,
{
state
,
tree
:
update
,
options
:
{
doNotLogTiming
:
true
,
doNotUpdateCurrent
:
true
}
});
return
PluginCommands
.
State
.
Update
(
this
.
plugin
,
{
state
,
tree
:
update
,
options
:
{
doNotLogTiming
:
true
,
doNotUpdateCurrent
:
true
}
});
}
}
private
currentSource
:
StructureElement
.
Loci
|
undefined
=
void
0
;
private
async
focus
(
sourceLoci
:
StructureElement
.
Loci
)
{
private
async
focus
(
sourceLoci
:
StructureElement
.
Loci
)
{
const
parent
=
this
.
plugin
.
helpers
.
substructureParent
.
get
(
sourceLoci
.
structure
);
const
parent
=
this
.
plugin
.
helpers
.
substructureParent
.
get
(
sourceLoci
.
structure
);
if
(
!
parent
||
!
parent
.
obj
)
return
;
if
(
!
parent
||
!
parent
.
obj
)
return
;
this
.
currentSource
=
sourceLoci
;
const
loci
=
StructureElement
.
Loci
.
remap
(
sourceLoci
,
parent
.
obj
!
.
data
);
const
loci
=
StructureElement
.
Loci
.
remap
(
sourceLoci
,
parent
.
obj
!
.
data
);
const
residueLoci
=
StructureElement
.
Loci
.
extendToWholeResidues
(
loci
);
const
residueLoci
=
StructureElement
.
Loci
.
extendToWholeResidues
(
loci
);
const
residueBundle
=
StructureElement
.
Bundle
.
fromLoci
(
residueLoci
);
const
residueBundle
=
StructureElement
.
Bundle
.
fromLoci
(
residueLoci
);
const
surroundings
=
MS
.
struct
.
modifier
.
includeSurroundings
({
const
target
=
StructureElement
.
Bundle
.
toExpression
(
residueBundle
);
0
:
StructureElement
.
Bundle
.
toExpression
(
residueBundle
),
let
surroundings
=
MS
.
struct
.
modifier
.
includeSurroundings
({
0
:
target
,
radius
:
this
.
params
.
expandRadius
,
radius
:
this
.
params
.
expandRadius
,
'
as-whole-residues
'
:
true
'
as-whole-residues
'
:
true
});
});
if
(
this
.
params
.
excludeTargetFromSurroundings
)
{
surroundings
=
MS
.
struct
.
modifier
.
exceptBy
({
0
:
surroundings
,
by
:
target
});
}
const
{
state
,
builder
,
refs
}
=
this
.
ensureShape
(
parent
);
const
{
state
,
builder
,
refs
}
=
this
.
ensureShape
(
parent
);
builder
.
to
(
refs
[
StructureFocusRepresentationTags
.
TargetSel
]
!
).
update
(
StateTransforms
.
Model
.
StructureSelectionFromBundle
,
old
=>
({
...
old
,
bundle
:
residueBundle
}));
builder
.
to
(
refs
[
StructureFocusRepresentationTags
.
TargetSel
]
!
).
update
(
StateTransforms
.
Model
.
StructureSelectionFromBundle
,
old
=>
({
...
old
,
bundle
:
residueBundle
}));
...
@@ -159,6 +171,13 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
...
@@ -159,6 +171,13 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
const
old
=
this
.
params
;
const
old
=
this
.
params
;
this
.
params
=
params
;
this
.
params
=
params
;
if
(
old
.
excludeTargetFromSurroundings
!==
params
.
excludeTargetFromSurroundings
)
{
if
(
this
.
currentSource
)
{
this
.
focus
(
this
.
currentSource
);
}
return
true
;
}
const
state
=
this
.
plugin
.
state
.
data
;
const
state
=
this
.
plugin
.
state
.
data
;
const
builder
=
state
.
build
();
const
builder
=
state
.
build
();
...
@@ -187,8 +206,12 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
...
@@ -187,8 +206,12 @@ class StructureFocusRepresentationBehavior extends PluginBehavior.WithSubscriber
await
PluginCommands
.
State
.
Update
(
this
.
plugin
,
{
state
,
tree
:
builder
,
options
:
{
doNotLogTiming
:
true
,
doNotUpdateCurrent
:
true
}
});
await
PluginCommands
.
State
.
Update
(
this
.
plugin
,
{
state
,
tree
:
builder
,
options
:
{
doNotLogTiming
:
true
,
doNotUpdateCurrent
:
true
}
});
// TODO: update properly
if
(
params
.
expandRadius
!==
old
.
expandRadius
)
{
if
(
params
.
expandRadius
!==
old
.
expandRadius
)
await
this
.
clear
(
StateTransform
.
RootRef
);
if
(
this
.
currentSource
)
{
this
.
focus
(
this
.
currentSource
);
}
return
true
;
}
return
true
;
return
true
;
}
}
...
...
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