Commit 9a4cedfe authored by htyao's avatar htyao
Browse files

Show image in jupyter

parent e5e846b4
......@@ -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':
......
......@@ -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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment