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
93e107f3
Commit
93e107f3
authored
2 years ago
by
yakomaxa
Browse files
Options
Downloads
Patches
Plain Diff
give pymol the ability to deal with negatively indexed residue numbering
parent
655b334b
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/transpilers/pymol/properties.ts
+45
-11
45 additions, 11 deletions
src/mol-script/transpilers/pymol/properties.ts
with
45 additions
and
11 deletions
src/mol-script/transpilers/pymol/properties.ts
+
45
−
11
View file @
93e107f3
...
@@ -14,31 +14,65 @@ const reFloat = /[-+]?[0-9]*\.?[0-9]+/;
...
@@ -14,31 +14,65 @@ const reFloat = /[-+]?[0-9]*\.?[0-9]+/;
function
atomNameListMap
(
x
:
string
)
{
return
x
.
split
(
'
+
'
).
map
(
B
.
atomName
);
}
function
atomNameListMap
(
x
:
string
)
{
return
x
.
split
(
'
+
'
).
map
(
B
.
atomName
);
}
function
listMap
(
x
:
string
)
{
return
x
.
split
(
'
+
'
).
map
(
x
=>
x
.
replace
(
/^
[
"'
]
|
[
"'
]
$/g
,
''
));
}
function
listMap
(
x
:
string
)
{
return
x
.
split
(
'
+
'
).
map
(
x
=>
x
.
replace
(
/^
[
"'
]
|
[
"'
]
$/g
,
''
));
}
function
rangeMap
(
x
:
string
)
{
const
[
min
,
max
]
=
x
.
split
(
'
-
'
).
map
(
x
=>
parseInt
(
x
));
return
{
min
,
max
};
}
function
listOrRangeMap
(
x
:
string
)
{
function
listOrRangeMap
(
x
:
string
)
{
// cases
if
(
x
.
includes
(
'
-
'
)
&&
x
.
includes
(
'
+
'
))
{
if
(
x
.
includes
(
'
-
'
)
&&
x
.
includes
(
'
+
'
))
{
const
pSplit
=
x
.
split
(
'
+
'
).
map
(
x
=>
x
.
replace
(
/^
[
"'
]
|
[
"'
]
$/g
,
''
));
const
pSplit
=
x
.
split
(
'
+
'
).
map
(
x
=>
x
.
replace
(
/^
[
"'
]
|
[
"'
]
$/g
,
''
));
const
res
:
number
[]
=
[];
const
res
:
number
[]
=
[];
pSplit
.
forEach
(
x
=>
{
pSplit
.
forEach
(
x
=>
{
if
(
x
.
includes
(
'
-
'
))
{
if
(
x
.
includes
(
'
-
'
)
&&
!
x
.
startsWith
(
"
-
"
)
)
{
const
[
min
,
max
]
=
x
.
split
(
'
-
'
).
map
(
x
=>
parseInt
(
x
));
const
[
min
,
max
]
=
x
.
split
(
'
-
'
).
map
(
x
=>
parseInt
(
x
));
for
(
let
i
=
min
;
i
<=
max
;
i
++
)
{
for
(
let
i
=
min
;
i
<=
max
;
i
++
)
{
res
.
push
(
i
);
res
.
push
(
i
);
}
}
}
else
{
}
else
if
(
x
.
includes
(
'
-
'
)
&&
x
.
startsWith
(
"
-
"
)
&&
x
.
match
(
/
[
0-9
]
+-
[
-0-9
]
+/
))
{
const
min
=
-
parseInt
(
x
.
split
(
'
-
'
)[
1
]);
var
max
;
if
(
x
.
includes
(
'
--
'
))
{
max
=
-
parseInt
(
x
.
split
(
'
-
'
)[
3
])
}
else
{
max
=
parseInt
(
x
.
split
(
'
-
'
)[
2
])
}
for
(
let
i
=
min
;
i
<=
max
;
i
++
)
{
res
.
push
(
i
);
}
}
else
if
(
x
.
includes
(
'
-
'
)
&&
x
.
startsWith
(
"
-
"
)
&&
!
x
.
match
(
/
[
0-9
]
+-
[
0-9
]
+/
))
{
res
.
push
(
parseInt
(
x
));
}
else
{
res
.
push
(
parseInt
(
x
));
res
.
push
(
parseInt
(
x
));
}
}
});
});
return
res
;
return
res
;
}
else
if
(
x
.
includes
(
'
-
'
)
&&
!
x
.
includes
(
'
+
'
))
{
}
else
if
(
x
.
includes
(
'
-
'
)
&&
!
x
.
includes
(
'
+
'
))
{
return
rangeMap
(
x
);
const
res
:
number
[]
=
[];
if
(
!
x
.
startsWith
(
"
-
"
))
{
const
[
min
,
max
]
=
x
.
split
(
'
-
'
).
map
(
x
=>
parseInt
(
x
));
for
(
let
i
=
min
;
i
<=
max
;
i
++
)
{
res
.
push
(
i
);
}
}
else
if
(
x
.
startsWith
(
"
-
"
)
&&
x
.
match
(
/
[
0-9
]
+-
[
-0-9
]
+/
))
{
const
min
=
-
parseInt
(
x
.
split
(
'
-
'
)[
1
]);
console
.
log
(
min
)
var
max
;
if
(
x
.
includes
(
'
--
'
))
{
max
=
-
parseInt
(
x
.
split
(
'
-
'
)[
3
])
}
else
{
max
=
parseInt
(
x
.
split
(
'
-
'
)[
2
])
}
for
(
let
i
=
min
;
i
<=
max
;
i
++
)
{
res
.
push
(
i
);
}
}
else
if
(
x
.
startsWith
(
"
-
"
)
&&
!
x
.
match
(
/
[
0-9
]
+-
[
0-9
]
+/
))
{
res
.
push
(
parseInt
(
x
));
}
else
{
res
.
push
(
parseInt
(
x
));
}
return
res
;
}
else
if
(
!
x
.
includes
(
'
-
'
)
&&
x
.
includes
(
'
+
'
))
{
}
else
if
(
!
x
.
includes
(
'
-
'
)
&&
x
.
includes
(
'
+
'
))
{
return
listMap
(
x
).
map
(
x
=>
parseInt
(
x
));
return
listMap
(
x
).
map
(
x
=>
parseInt
(
x
));
}
else
{
}
else
{
return
listMap
(
x
).
map
(
x
=>
parseInt
(
x
)
)
;
return
[
parseInt
(
x
)
]
;
}
}
}
}
...
...
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