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
bbaa6371
Commit
bbaa6371
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
wip, sequence selector
parent
a3094b4d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-plugin/ui/sequence.tsx
+50
-12
50 additions, 12 deletions
src/mol-plugin/ui/sequence.tsx
src/mol-plugin/ui/sequence/sequence.tsx
+0
-2
0 additions, 2 deletions
src/mol-plugin/ui/sequence/sequence.tsx
with
50 additions
and
14 deletions
src/mol-plugin/ui/sequence.tsx
+
50
−
12
View file @
bbaa6371
...
@@ -10,29 +10,52 @@ import { PluginUIComponent } from './base';
...
@@ -10,29 +10,52 @@ import { PluginUIComponent } from './base';
import
{
StateTreeSpine
}
from
'
../../mol-state/tree/spine
'
;
import
{
StateTreeSpine
}
from
'
../../mol-state/tree/spine
'
;
import
{
PluginStateObject
as
SO
}
from
'
../state/objects
'
;
import
{
PluginStateObject
as
SO
}
from
'
../state/objects
'
;
import
{
Sequence
}
from
'
./sequence/sequence
'
;
import
{
Sequence
}
from
'
./sequence/sequence
'
;
import
{
Structure
}
from
'
../../mol-model/structure
'
;
import
{
Structure
,
StructureElement
,
StructureProperties
as
SP
}
from
'
../../mol-model/structure
'
;
import
{
SequenceWrapper
}
from
'
./sequence/util
'
;
import
{
SequenceWrapper
}
from
'
./sequence/util
'
;
import
{
PolymerSequenceWrapper
}
from
'
./sequence/polymer
'
;
import
{
PolymerSequenceWrapper
}
from
'
./sequence/polymer
'
;
import
{
StructureElementSelectionManager
}
from
'
../util/structure-element-selection
'
;
import
{
StructureElementSelectionManager
}
from
'
../util/structure-element-selection
'
;
import
{
MarkerAction
}
from
'
../../mol-util/marker-action
'
;
import
{
MarkerAction
}
from
'
../../mol-util/marker-action
'
;
import
{
ParameterControls
}
from
'
./controls/parameters
'
;
import
{
ParamDefinition
as
PD
}
from
'
../../mol-util/param-definition
'
;
function
getSequenceWrappersForStructure
(
structure
:
Structure
,
structureSelection
:
StructureElementSelectionManager
)
{
function
getSequenceWrapperForStructure
(
index
:
number
,
structure
:
Structure
,
structureSelection
:
StructureElementSelectionManager
):
SequenceWrapper
.
Any
|
undefined
{
const
sequenceWrappers
:
SequenceWrapper
.
Any
[]
=
[]
let
j
=
0
for
(
let
i
=
0
,
il
=
structure
.
units
.
length
;
i
<
il
;
++
i
)
{
const
unit
=
structure
.
units
[
i
]
if
(
unit
.
polymerElements
.
length
===
0
)
continue
if
(
j
===
index
)
{
const
sw
=
new
PolymerSequenceWrapper
({
structure
,
unit
})
sw
.
markResidue
(
structureSelection
.
get
(
structure
),
MarkerAction
.
Select
)
return
sw
}
j
+=
1
}
}
function
getPolymerOptionsForStructure
(
structure
:
Structure
)
{
const
options
:
[
number
,
string
][]
=
[]
let
i
=
0
structure
.
units
.
forEach
(
unit
=>
{
structure
.
units
.
forEach
(
unit
=>
{
if
(
unit
.
polymerElements
.
length
===
0
)
return
if
(
unit
.
polymerElements
.
length
===
0
)
return
const
sw
=
new
PolymerSequenceWrapper
({
structure
,
unit
})
const
l
=
StructureElement
.
create
(
unit
,
unit
.
elements
[
0
])
sw
.
markResidue
(
structureSelection
.
get
(
structure
),
MarkerAction
.
Select
)
const
entityDescription
=
SP
.
entity
.
pdbx_description
(
l
)
sequenceWrappers
.
push
(
sw
)
const
label_asym_id
=
SP
.
chain
.
label_asym_id
(
l
)
const
label
=
`
${
label_asym_id
}
:
${
entityDescription
}
`
options
.
push
([
i
,
label
])
i
+=
1
})
})
return
sequenceWrapper
s
return
option
s
}
}
export
class
SequenceView
extends
PluginUIComponent
<
{
},
{
}
>
{
export
class
SequenceView
extends
PluginUIComponent
<
{
},
{
polymer
:
number
}
>
{
private
spine
:
StateTreeSpine
.
Impl
private
spine
:
StateTreeSpine
.
Impl
state
=
{
polymer
:
0
}
componentDidMount
()
{
componentDidMount
()
{
this
.
spine
=
new
StateTreeSpine
.
Impl
(
this
.
plugin
.
state
.
dataState
.
cells
);
this
.
spine
=
new
StateTreeSpine
.
Impl
(
this
.
plugin
.
state
.
dataState
.
cells
);
...
@@ -54,6 +77,18 @@ export class SequenceView extends PluginUIComponent<{ }, { }> {
...
@@ -54,6 +77,18 @@ export class SequenceView extends PluginUIComponent<{ }, { }> {
return
so
&&
so
.
data
return
so
&&
so
.
data
}
}
private
getParams
(
structure
:
Structure
)
{
return
{
polymer
:
PD
.
Select
(
0
,
getPolymerOptionsForStructure
(
structure
))
}
}
private
setParamProps
=
(
p
:
{
param
:
PD
.
Base
<
any
>
,
name
:
string
,
value
:
any
})
=>
{
if
(
p
.
name
===
'
polymer
'
)
{
this
.
setState
({
polymer
:
p
.
value
})
}
}
render
()
{
render
()
{
const
structure
=
this
.
getStructure
();
const
structure
=
this
.
getStructure
();
if
(
!
structure
)
return
<
div
className
=
'msp-sequence'
>
if
(
!
structure
)
return
<
div
className
=
'msp-sequence'
>
...
@@ -61,11 +96,14 @@ export class SequenceView extends PluginUIComponent<{ }, { }> {
...
@@ -61,11 +96,14 @@ export class SequenceView extends PluginUIComponent<{ }, { }> {
</
div
>;
</
div
>;
const
{
structureSelection
}
=
this
.
plugin
.
helpers
const
{
structureSelection
}
=
this
.
plugin
.
helpers
const
sequenceWrappers
=
getSequenceWrappersForStructure
(
structure
,
structureSelection
)
const
params
=
this
.
getParams
(
structure
)
const
sequenceWrapper
=
getSequenceWrapperForStructure
(
this
.
state
.
polymer
,
structure
,
structureSelection
)
return
<
div
className
=
'msp-sequence'
>
return
<
div
className
=
'msp-sequence'
>
{
sequenceWrappers
.
map
((
sequenceWrapper
,
i
)
=>
{
<
ParameterControls
params
=
{
params
}
values
=
{
this
.
state
}
onChange
=
{
this
.
setParamProps
}
/>
return
<
Sequence
key
=
{
i
}
sequenceWrapper
=
{
sequenceWrapper
}
/>
{
sequenceWrapper
!==
undefined
})
}
?
<
Sequence
sequenceWrapper
=
{
sequenceWrapper
}
/>
:
<
div
className
=
'msp-sequence-entity'
>
No sequence available
</
div
>
}
</
div
>;
</
div
>;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-plugin/ui/sequence/sequence.tsx
+
0
−
2
View file @
bbaa6371
...
@@ -88,7 +88,6 @@ export class Sequence<P extends SequenceProps> extends PluginUIComponent<P, Sequ
...
@@ -88,7 +88,6 @@ export class Sequence<P extends SequenceProps> extends PluginUIComponent<P, Sequ
render
()
{
render
()
{
const
{
markerData
}
=
this
.
state
;
const
{
markerData
}
=
this
.
state
;
const
{
label
}
=
this
.
props
.
sequenceWrapper
const
{
offset
,
sequence
}
=
this
.
props
.
sequenceWrapper
.
sequence
;
const
{
offset
,
sequence
}
=
this
.
props
.
sequenceWrapper
.
sequence
;
const
elems
:
JSX
.
Element
[]
=
[];
const
elems
:
JSX
.
Element
[]
=
[];
...
@@ -101,7 +100,6 @@ export class Sequence<P extends SequenceProps> extends PluginUIComponent<P, Sequ
...
@@ -101,7 +100,6 @@ export class Sequence<P extends SequenceProps> extends PluginUIComponent<P, Sequ
onContextMenu
=
{
this
.
contextMenu
}
onContextMenu
=
{
this
.
contextMenu
}
onMouseDown
=
{
this
.
mouseDown
}
onMouseDown
=
{
this
.
mouseDown
}
>
>
<
span
style
=
{
{
fontWeight
:
'
bold
'
}
}
>
{
label
}
:
{
offset
}
</
span
>
{
elems
}
{
elems
}
</
div
>;
</
div
>;
}
}
...
...
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