Using 703c734ad2ce2aa2199cfde9181bb8b8c5803e7a (current master), the following script:
import dnaplotlib as dpl
import matplotlib.pyplot as plt
p1 = {'type':'Promoter', 'name':'p1', 'fwd':True}
c1 = {'type':'CDS', 'name':'c1', 'fwd':True}
design1 = [p1, c1]
# Create the DNAplotlib renderer
dr = dpl.DNARenderer()
# Redend the DNA to axis
fig, ax = plt.subplots()
start, end = dr.renderDNA(ax, design1, dr.SBOL_part_renderers())
ax.set_xlim([start, end])
ax.set_ylim([-15,15])
ax.set_aspect('equal')
ax.set_xticks([])
ax.set_yticks([])
ax.axis('off')
plt.savefig('test_promoter.png', dpi=200)
only works when the fwd property in lines 4 and 5 are set to True, but fails if any of them are set to False with the following error message:
Traceback (most recent call last):
File "test_dnaplotlib.py", line 74, in <module>
start, end = dr.renderDNA(ax, design1, dr.SBOL_part_renderers())
File "C:\Users\casti\Anaconda3\lib\site-packages\dnaplotlib\dnaplotlib.py", line 2295, in renderDNA
start = part['start']
KeyError: 'start'
It seems that the code introduced in #14 is what causes this error. This makes sense, as 'start' and 'end' are not necessarily properties of all parts. Removing this piece of code restores the proper behavior.
Using 703c734ad2ce2aa2199cfde9181bb8b8c5803e7a (current master), the following script:
only works when the
fwd
property in lines 4 and 5 are set to True, but fails if any of them are set to False with the following error message:It seems that the code introduced in #14 is what causes this error. This makes sense, as
'start'
and'end'
are not necessarily properties of all parts. Removing this piece of code restores the proper behavior.