# --- Define design ---
# --- A gate ---
p0 = {
'type': 'Promoter',
'fwd': True,
'opts': {
'label':'PX',
'color':[0.8, 0.8, 0.8],
'label_size':10,
'label_y_offset': -5
},
}
rbs0 = {
'type': 'RBS',
'fwd': True,
'opts': {
'color':[0.8, 0.8, 0.8],
}
}
cds0 = {
'type': 'CDS',
'fwd': True,
'opts': {
'color':[0.38, 0.82, 0.32],
'label_size':10
},
}
t0 = {
'type': 'Terminator',
'fwd': True,
}
# --- B gate ---
p1 = {
'type': 'Promoter',
'fwd': True,
'opts': {
'label':'PY',
'label_size':10,
'label_y_offset': -5,
'color':[0.8, 0.8, 0.8],
},
}
rbs1 = {
'type': 'RBS',
'fwd': True,
'opts': {
'color':[0.8, 0.8, 0.8],
}
}
cds1 = {
'type': 'CDS',
'fwd': True,
'opts': {
'color':[0.38, 0.82, 0.32],
'label_size':10
},
}
t1 = {
'type': 'Terminator',
'fwd': True,
}
# --- inverter gate ---
p2 = {
'type': 'Promoter',
'fwd': True,
'opts': {
'color': [0.38, 0.82, 0.32],
'label': 'PZ',
'label_size': 10,
'label_y_offset': -5
},
}
# --- Define regulation ---
regulations = [
{
'from_part': cds0,
'to_part': p2,
'type': 'Repression',
'opts': {
'color': [0.38, 0.82, 0.32],
}
},
{
'from_part': cds1,
'to_part': p2,
'type': 'Repression',
'opts': {
'color': [0.38, 0.82, 0.32],
}
}
]
design = [
p0, rbs0, cds0, t0,
p1, rbs1, cds1, t1,
p2,
]
# --- Render DNA ---
fig, ax = plt.subplots(figsize=(6, 3))
# orange gate boxes
gate_x = [13, 13, 70, 70]
gate_y = [30, -20, -20, 30]
ax.fill(gate_x, gate_y, color='orange', alpha=0.3)
gate_x2 = [85, 85, 142, 142]
gate_y2 = [30, -20, -20, 30]
ax.fill(gate_x2, gate_y2, color='orange', alpha=0.3)
gate_x3 = [145, 145, 160, 160]
gate_y3 = [30, -20, -20, 30]
ax.fill(gate_x3, gate_y3, color='orange', alpha=0.3)
start_pos, end_pos = dr.renderDNA(
ax=ax,
parts=design,
regs=regulations,
part_renderers=renderers,
reg_renderers= dr.std_reg_renderers(),
)
ax.annotate(
'in X',
xy=(0, -15),
xytext=(15, -15),
arrowprops=dict(arrowstyle="<-", color='black', lw=1.5),
fontsize=10,
ha='center',
va='center'
)
ax.annotate(
'in Y',
xy=(75, -15),
xytext=(90, -15),
arrowprops=dict(arrowstyle="<-", color='black', lw=1.5),
fontsize=10,
ha='center',
va='center'
)
ax.annotate(
'out Z',
xy=(145, -15),
xytext=(160, -15),
arrowprops=dict(arrowstyle="<-", color='black', lw=1.5),
fontsize=10,
ha='center',
va='center'
)
ax.set_xlim(start_pos - 1, end_pos + 1)
ax.set_ylim(-40, 40)
ax.set_axis_off()
plt.title("Genetic design of a NOR (split gate)")
plt.tight_layout()