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
a6721155
Commit
a6721155
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://github.com/molstar/molstar
parents
8f54ea13
4171008c
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/apps/viewer/index.ts
+20
-11
20 additions, 11 deletions
src/apps/viewer/index.ts
with
20 additions
and
11 deletions
src/apps/viewer/index.ts
+
20
−
11
View file @
a6721155
...
...
@@ -23,6 +23,7 @@ import { ObjectKeys } from '../../mol-util/type-helpers';
import
{
PluginState
}
from
'
../../mol-plugin/state
'
;
import
{
DownloadDensity
}
from
'
../../mol-plugin-state/actions/volume
'
;
import
{
PluginLayoutControlsDisplay
}
from
'
../../mol-plugin/layout
'
;
import
{
BuiltInTrajectoryFormat
}
from
'
../../mol-plugin-state/formats/trajectory
'
;
require
(
'
mol-plugin-ui/skin/light.scss
'
);
...
...
@@ -59,7 +60,7 @@ type ViewerOptions = typeof DefaultViewerOptions;
export
class
Viewer
{
plugin
:
PluginContext
constructor
(
elementId
:
string
,
options
:
Partial
<
ViewerOptions
>
=
{})
{
constructor
(
element
Or
Id
:
string
|
HTMLElement
,
options
:
Partial
<
ViewerOptions
>
=
{})
{
const
o
=
{
...
DefaultViewerOptions
,
...
options
};
const
spec
:
PluginSpec
=
{
...
...
@@ -99,21 +100,23 @@ export class Viewer {
]
};
const
element
=
document
.
getElementById
(
elementId
);
if
(
!
element
)
throw
new
Error
(
`Could not get element with id '
${
elementId
}
'`
);
const
element
=
typeof
elementOrId
===
'
string
'
?
document
.
getElementById
(
elementOrId
)
:
elementOrId
;
if
(
!
element
)
throw
new
Error
(
`Could not get element with id '
${
elementOrId
}
'`
);
this
.
plugin
=
createPlugin
(
element
,
spec
);
}
async
setRemoteSnapshot
(
id
:
string
)
{
setRemoteSnapshot
(
id
:
string
)
{
const
url
=
`
${
this
.
plugin
.
config
.
get
(
PluginConfig
.
State
.
CurrentServer
)}
/get/
${
id
}
`
;
await
PluginCommands
.
State
.
Snapshots
.
Fetch
(
this
.
plugin
,
{
url
});
return
PluginCommands
.
State
.
Snapshots
.
Fetch
(
this
.
plugin
,
{
url
});
}
async
loadSnapshotFromUrl
(
url
:
string
,
type
:
PluginState
.
SnapshotType
)
{
await
PluginCommands
.
State
.
Snapshots
.
OpenUrl
(
this
.
plugin
,
{
url
,
type
});
loadSnapshotFromUrl
(
url
:
string
,
type
:
PluginState
.
SnapshotType
)
{
return
PluginCommands
.
State
.
Snapshots
.
OpenUrl
(
this
.
plugin
,
{
url
,
type
});
}
async
loadStructureFromUrl
(
url
:
string
,
format
=
'
cif
'
,
isBinary
=
false
)
{
loadStructureFromUrl
(
url
:
string
,
format
:
BuiltInTrajectoryFormat
=
'
mm
cif
'
,
isBinary
=
false
)
{
const
params
=
DownloadStructure
.
createDefaultParams
(
this
.
plugin
.
state
.
data
.
root
.
obj
!
,
this
.
plugin
);
return
this
.
plugin
.
runTask
(
this
.
plugin
.
state
.
data
.
applyAction
(
DownloadStructure
,
{
source
:
{
...
...
@@ -128,7 +131,13 @@ export class Viewer {
}));
}
async
loadPdb
(
pdb
:
string
)
{
async
loadStructureFromData
(
data
:
string
|
number
[],
format
:
BuiltInTrajectoryFormat
,
options
?:
{
dataLabel
?:
string
})
{
const
_data
=
await
this
.
plugin
.
builders
.
data
.
rawData
({
data
,
label
:
options
?.
dataLabel
});
const
trajectory
=
await
this
.
plugin
.
builders
.
structure
.
parseTrajectory
(
_data
,
format
);
await
this
.
plugin
.
builders
.
structure
.
hierarchy
.
applyPreset
(
trajectory
,
'
default
'
);
}
loadPdb
(
pdb
:
string
)
{
const
params
=
DownloadStructure
.
createDefaultParams
(
this
.
plugin
.
state
.
data
.
root
.
obj
!
,
this
.
plugin
);
const
provider
=
this
.
plugin
.
config
.
get
(
PluginConfig
.
Download
.
DefaultPdbProvider
)
!
;
return
this
.
plugin
.
runTask
(
this
.
plugin
.
state
.
data
.
applyAction
(
DownloadStructure
,
{
...
...
@@ -148,7 +157,7 @@ export class Viewer {
}));
}
async
loadPdbDev
(
pdbDev
:
string
)
{
loadPdbDev
(
pdbDev
:
string
)
{
const
params
=
DownloadStructure
.
createDefaultParams
(
this
.
plugin
.
state
.
data
.
root
.
obj
!
,
this
.
plugin
);
return
this
.
plugin
.
runTask
(
this
.
plugin
.
state
.
data
.
applyAction
(
DownloadStructure
,
{
source
:
{
...
...
@@ -164,7 +173,7 @@ export class Viewer {
}));
}
async
loadEmdb
(
emdb
:
string
)
{
loadEmdb
(
emdb
:
string
)
{
const
provider
=
this
.
plugin
.
config
.
get
(
PluginConfig
.
Download
.
DefaultEmdbProvider
)
!
;
return
this
.
plugin
.
runTask
(
this
.
plugin
.
state
.
data
.
applyAction
(
DownloadDensity
,
{
source
:
{
...
...
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