Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AMIBIO
VARNA-api
Commits
9a4cedfe
Commit
9a4cedfe
authored
Jan 13, 2022
by
htyao
Browse files
Show image in jupyter
parent
e5e846b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
param.py
View file @
9a4cedfe
...
...
@@ -190,7 +190,7 @@ def _params_type_check(par, val):
raise
TypeError
(
str
(
e
))
elif
par
==
'border'
:
try
:
assert
val
is
None
or
(
isinstance
(
val
[
0
],
int
)
and
isinstance
(
type
(
val
[
1
]
)
,
int
))
assert
val
is
None
or
(
isinstance
(
val
[
0
],
int
)
and
isinstance
(
val
[
1
],
int
))
except
AssertionError
:
raise
TypeError
(
"Value for border should be a pair of integers"
)
elif
typ
==
'choices'
:
...
...
varnaapi.py
View file @
9a4cedfe
...
...
@@ -6,6 +6,8 @@ from colour import Color
import
subprocess
from
deprecated
import
deprecated
from
IPython.display
import
Image
,
display
,
SVG
from
param
import
VarnaConfig
,
BasesStyle
,
_Title
,
_Highlight
,
_Annotation
,
_BPStyle
,
_ChemProb
,
_ColorMap
...
...
@@ -226,7 +228,7 @@ class BasicDraw(VarnaConfig):
def
_gen_input_cmd
(
self
):
pass
def
savefig
(
self
,
output
):
def
savefig
(
self
,
output
,
show
=
False
):
"""
Call VARNA to draw and store the paint in output
"""
...
...
@@ -235,6 +237,12 @@ class BasicDraw(VarnaConfig):
print
(
cmd
)
subprocess
.
run
(
cmd
)
if
show
:
if
output
[
-
3
:]
==
'png'
:
display
(
Image
(
filename
=
output
))
elif
output
[
-
3
:]
==
'svg'
:
display
(
SVG
(
filename
=
output
))
class
Structure
(
BasicDraw
):
def
__init__
(
self
,
sequence
=
None
,
structure
=
None
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment