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
b88bf9bd
Commit
b88bf9bd
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
LociStructureSelection based on StructureElement.Query
parent
df0f15d1
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-plugin/state/transforms/model.ts
+40
-9
40 additions, 9 deletions
src/mol-plugin/state/transforms/model.ts
with
40 additions
and
9 deletions
src/mol-plugin/state/transforms/model.ts
+
40
−
9
View file @
b88bf9bd
...
...
@@ -27,7 +27,6 @@ import { transpileMolScript } from '../../../mol-script/script/mol-script/symbol
import
{
shapeFromPly
}
from
'
../../../mol-model-formats/shape/ply
'
;
import
{
SymmetryOperator
}
from
'
../../../mol-math/geometry
'
;
import
{
ensureSecondaryStructure
}
from
'
./helpers
'
;
import
{
formatMolScript
}
from
'
../../../mol-script/language/expression-formatter
'
;
export
{
TrajectoryFromBlob
};
export
{
TrajectoryFromMmCif
};
...
...
@@ -41,6 +40,7 @@ export { TransformStructureConformation };
export
{
TransformStructureConformationByMatrix
};
export
{
StructureSelection
};
export
{
UserStructureSelection
};
export
{
LociStructureSelection
};
export
{
StructureComplexElement
};
export
{
CustomModelProperties
};
export
{
CustomStructureProperties
};
...
...
@@ -369,7 +369,7 @@ const StructureSelection = PluginStateTransform.BuiltIn({
type
UserStructureSelection
=
typeof
UserStructureSelection
const
UserStructureSelection
=
PluginStateTransform
.
BuiltIn
({
name
:
'
user-structure-selection
'
,
display
:
{
name
:
'
Structure Selection
'
,
description
:
'
Create a molecular structure from the specified query expression.
'
},
display
:
{
name
:
'
Structure Selection
'
,
description
:
'
Create a molecular structure from the specified query expression
string
.
'
},
from
:
SO
.
Molecule
.
Structure
,
to
:
SO
.
Molecule
.
Structure
,
params
:
{
...
...
@@ -387,13 +387,6 @@ const UserStructureSelection = PluginStateTransform.BuiltIn({
const
result
=
compiled
(
new
QueryContext
(
a
.
data
));
const
s
=
Sel
.
unionStructure
(
result
);
// TODO for debug purposes only, later move to StructureSelection where the expression is not visible to the user
let
loci
=
Structure
.
toStructureElementLoci
(
Structure
.
Loci
(
s
))
if
(
s
.
parent
)
loci
=
StructureElement
.
Loci
.
remap
(
loci
,
s
.
parent
)
const
expression
=
formatMolScript
(
StructureElement
.
Loci
.
toScriptExpression
(
loci
))
console
.
log
({
before
:
params
.
query
.
expression
,
after
:
expression
})
params
.
query
.
expression
=
expression
const
props
=
{
label
:
`
${
params
.
label
||
'
Selection
'
}
`
,
description
:
structureDesc
(
s
)
};
return
new
SO
.
Molecule
.
Structure
(
s
,
props
);
},
...
...
@@ -425,6 +418,44 @@ function updateStructureFromQuery(query: QueryFn<Sel>, src: Structure, obj: SO.M
return
true
;
}
type
LociStructureSelection
=
typeof
LociStructureSelection
const
LociStructureSelection
=
PluginStateTransform
.
BuiltIn
({
name
:
'
loci-structure-selection
'
,
display
:
{
name
:
'
Structure Selection
'
,
description
:
'
Create a molecular structure from the specified structure-element query.
'
},
from
:
SO
.
Molecule
.
Structure
,
to
:
SO
.
Molecule
.
Structure
,
params
:
{
query
:
PD
.
Value
<
StructureElement
.
Query
>
(
StructureElement
.
Query
.
Empty
,
{
isHidden
:
true
}),
label
:
PD
.
Optional
(
PD
.
Text
(
''
,
{
isHidden
:
true
}))
}
})({
apply
({
a
,
params
,
cache
})
{
(
cache
as
{
source
:
Structure
}).
source
=
a
.
data
;
const
s
=
StructureElement
.
Query
.
toStructure
(
params
.
query
,
a
.
data
);
if
(
s
.
elementCount
===
0
)
return
StateObject
.
Null
;
const
props
=
{
label
:
`
${
params
.
label
||
'
Selection
'
}
`
,
description
:
structureDesc
(
s
)
};
return
new
SO
.
Molecule
.
Structure
(
s
,
props
);
},
update
:
({
a
,
b
,
oldParams
,
newParams
,
cache
})
=>
{
if
(
!
StructureElement
.
Query
.
areEqual
(
oldParams
.
query
,
newParams
.
query
))
return
StateTransformer
.
UpdateResult
.
Recreate
;
if
((
cache
as
{
source
:
Structure
}).
source
===
a
.
data
)
{
return
StateTransformer
.
UpdateResult
.
Unchanged
;
}
(
cache
as
{
source
:
Structure
}).
source
=
a
.
data
;
const
s
=
StructureElement
.
Query
.
toStructure
(
newParams
.
query
,
a
.
data
);
if
(
s
.
elementCount
===
0
)
return
StateTransformer
.
UpdateResult
.
Null
;
b
.
label
=
`
${
newParams
.
label
||
'
Selection
'
}
`
;
b
.
description
=
structureDesc
(
s
);
b
.
data
=
s
;
return
StateTransformer
.
UpdateResult
.
Updated
;
}
});
namespace
StructureComplexElement
{
export
type
Types
=
'
atomic-sequence
'
|
'
water
'
|
'
atomic-het
'
|
'
spheres
'
}
...
...
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