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
190c1f96
Commit
190c1f96
authored
2 years ago
by
yakomaxa
Browse files
Options
Downloads
Patches
Plain Diff
Added pymol, jmol and vmd alongside mol-script: pymol is now enabled
parent
2ccfdb12
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/mol-script/script.ts
+14
-4
14 additions, 4 deletions
src/mol-script/script.ts
with
14 additions
and
4 deletions
src/mol-script/script.ts
+
14
−
4
View file @
190c1f96
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
*/
import
{
transpileMolScript
}
from
'
./script/mol-script/symbols
'
;
import
{
parseMolScript
}
from
'
./language/parser
'
;
import
{
parse
}
from
'
./transpile
'
;
import
{
parse
}
from
'
./transpile
'
;
import
{
Expression
}
from
'
./language/expression
'
;
import
{
Expression
}
from
'
./language/expression
'
;
import
{
StructureElement
,
QueryContext
,
StructureSelection
,
Structure
,
QueryFn
,
QueryContextOptions
}
from
'
../mol-model/structure
'
;
import
{
StructureElement
,
QueryContext
,
StructureSelection
,
Structure
,
QueryFn
,
QueryContextOptions
}
from
'
../mol-model/structure
'
;
...
@@ -19,7 +21,7 @@ function Script(expression: string, language: Script.Language): Script {
...
@@ -19,7 +21,7 @@ function Script(expression: string, language: Script.Language): Script {
}
}
namespace
Script
{
namespace
Script
{
export
type
Language
=
'
pymol
'
export
type
Language
=
'
mol-script
'
|
'
pymol
'
|
'
vmd
'
|
'
jmol
'
export
function
is
(
x
:
any
):
x
is
Script
{
export
function
is
(
x
:
any
):
x
is
Script
{
return
!!
x
&&
typeof
(
x
as
Script
).
expression
===
'
string
'
&&
!!
(
x
as
Script
).
language
;
return
!!
x
&&
typeof
(
x
as
Script
).
expression
===
'
string
'
&&
!!
(
x
as
Script
).
language
;
...
@@ -31,10 +33,18 @@ namespace Script {
...
@@ -31,10 +33,18 @@ namespace Script {
export
function
toExpression
(
script
:
Script
):
Expression
{
export
function
toExpression
(
script
:
Script
):
Expression
{
switch
(
script
.
language
)
{
switch
(
script
.
language
)
{
case
'
pymol
'
:
case
'
mol-script
'
:
const
parsed
=
parse
(
"
pymol
"
,
script
.
expression
);
const
parsed
=
parseMolScript
(
script
.
expression
);
return
parsed
as
Expression
;
if
(
parsed
.
length
===
0
)
throw
new
Error
(
'
No query
'
);
return
transpileMolScript
(
parsed
[
0
]);
case
'
pymol
'
:
return
parse
(
"
pymol
"
,
script
.
expression
)
as
Expression
;
case
'
jmol
'
:
return
parse
(
"
jmol
"
,
script
.
expression
)
as
Expression
;
case
'
vmd
'
:
return
parse
(
"
vmd
"
,
script
.
expression
)
as
Expression
;
}
}
throw
new
Error
(
'
unsupported script language
'
);
throw
new
Error
(
'
unsupported script language
'
);
}
}
...
...
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