コード例 #1
0
def plot_construct(ax, t, ymtet, ymlac, ymgamma, ytet, ylac, ygamma):
	tind = int(t*10)
	exp_lims = (1.0, 4.0)
	ax.set_title('t = {}'.format(t), fontsize=8)
	# Set color for each of the CDSs
	tetr['opts']['color'] = [rescale(1 - expression(ymtet[tind], exp_lims), (1.0, 1.0)),
								rescale(1 - expression(ymtet[tind], exp_lims), (0.75, 1.0)),
								rescale(1 - expression(ymtet[tind], exp_lims), (0.17, 1.0))]
	laci['opts']['color'] = [rescale(1 - expression(ymlac[tind], exp_lims), (0.38, 1.0)),
								rescale(1 - expression(ymlac[tind], exp_lims), (0.82, 1.0)),
								rescale(1 - expression(ymlac[tind], exp_lims), (0.32, 1.0))]
	gamma['opts']['color'] = [rescale(1 - expression(ymgamma[tind], exp_lims), (0.38, 1.0)),
								rescale(1 - expression(ymgamma[tind], exp_lims), (0.65, 1.0)),
								rescale(1 - expression(ymgamma[tind], exp_lims), (0.87, 1.0))]
	# Set transparency for each of the regulatory lines
	lac_repress['opts']['color'] = [0.38, 0.82, 0.32,
								rescale(repression(ylac[tind], 2.0, 8), (0.2, 1.0))]
	gamma_repress['opts']['color'] = [0.38, 0.65, 0.87,
								rescale(repression(ygamma[tind], 2.0, 8), (0.2, 1.0))]
	tet_repress['opts']['color'] = [1.00, 0.75, 0.17,
								rescale(repression(ytet[tind], 2.0, 8), (0.2, 1.0))]
	# Set width for each of the regulatory lines
	lac_repress['opts']['linewidth'] = rescale(repression(ylac[tind], 2.0, 8), (0.5, 2.0))						
	gamma_repress['opts']['linewidth'] = rescale(repression(ygamma[tind], 2.0, 8), (0.5, 2.0))							
	tet_repress['opts']['linewidth'] = rescale(repression(ytet[tind], 2.0, 8), (0.5, 2.0))
	dnaplotlib.plot_sbol_designs([ax], [[plac, rbs1, tetr, term1, pgamma, rbs2, laci, term2, ptet, rbs3, gamma, term3]],
				[[lac_repress, gamma_repress, tet_repress]])
	ax.set_ylim([-10, 31])
コード例 #2
0
def plot_construct(ax, t, ymtet, ymlac, ymgamma, ytet, ylac, ygamma):
	tind = int(t*10)
	exp_lims = (1.0, 4.0)
	ax.set_title('t = {}'.format(t), fontsize=8)
	# Set color for each of the CDSs
	tetr['opts']['color'] = [rescale(1 - expression(ymtet[tind], exp_lims), (1.0, 1.0)),
								rescale(1 - expression(ymtet[tind], exp_lims), (0.75, 1.0)),
								rescale(1 - expression(ymtet[tind], exp_lims), (0.17, 1.0))]
	laci['opts']['color'] = [rescale(1 - expression(ymlac[tind], exp_lims), (0.38, 1.0)),
								rescale(1 - expression(ymlac[tind], exp_lims), (0.82, 1.0)),
								rescale(1 - expression(ymlac[tind], exp_lims), (0.32, 1.0))]
	gamma['opts']['color'] = [rescale(1 - expression(ymgamma[tind], exp_lims), (0.38, 1.0)),
								rescale(1 - expression(ymgamma[tind], exp_lims), (0.65, 1.0)),
								rescale(1 - expression(ymgamma[tind], exp_lims), (0.87, 1.0))]
	# Set transparency for each of the regulatory lines
	lac_repress['opts']['color'] = [0.38, 0.82, 0.32,
								rescale(repression(ylac[tind], 2.0, 8), (0.2, 1.0))]
	gamma_repress['opts']['color'] = [0.38, 0.65, 0.87,
								rescale(repression(ygamma[tind], 2.0, 8), (0.2, 1.0))]
	tet_repress['opts']['color'] = [1.00, 0.75, 0.17,
								rescale(repression(ytet[tind], 2.0, 8), (0.2, 1.0))]
	# Set width for each of the regulatory lines
	lac_repress['opts']['linewidth'] = rescale(repression(ylac[tind], 2.0, 8), (0.5, 2.0))
	gamma_repress['opts']['linewidth'] = rescale(repression(ygamma[tind], 2.0, 8), (0.5, 2.0))
	tet_repress['opts']['linewidth'] = rescale(repression(ytet[tind], 2.0, 8), (0.5, 2.0))
	dnaplotlib.plot_sbol_designs([ax], [[plac, rbs1, tetr, term1, pgamma, rbs2, laci, term2, ptet, rbs3, gamma, term3]],
				[[lac_repress, gamma_repress, tet_repress]])
	ax.set_ylim([-10, 31])
コード例 #3
0
def main():
	t = np.arange(0, 30.1, 0.1)
	ymtet, ymlac, ymgamma, ytet, ylac, ygamma = zip(*odeint(repressilator, initial, t))
	plt.close()
	plt.figure(figsize=(3.5, 6.5))
	gs = gridspec.GridSpec(8, 1, height_ratios=[1, 2.5, 0.1, 1, 1, 1, 1, 1])

	# Plot of repressilator circuit
	ax = plt.subplot(gs[0])
	dnaplotlib.plot_sbol_designs([ax], [[plac, rbs1, tetr, term1, pgamma, rbs2, laci, term2, ptet, rbs3, gamma, term3]],
				[[lac_repress, gamma_repress, tet_repress]])
	ax.set_ylim([-10, 31])

	# Plot of repressilator dynamics
	ax = plt.subplot(gs[1])
	plt.plot(t, ytet, color=[1.00, 0.75, 0.17])
	plt.plot(t, ylac, color=[0.38, 0.82, 0.32])
	plt.plot(t, ygamma, color=[0.38, 0.65, 0.87])
	plt.axvline(x=1, color='k', linewidth=0.7)
	plt.axvline(x=12, color='k', linewidth=0.7)
	plt.axvline(x=25.3, color='k', linewidth=0.7)
	plt.axvline(x=27.3, color='k', linewidth=0.7)
	plt.axvline(x=29.4, color='k', linewidth=0.7)
	plt.ylim([1,4])
	ax.tick_params(axis='both', labelsize=8, width=0.8, length=3)
	ax.yaxis.tick_left()
	ax.xaxis.tick_bottom()
	ax.set_xlabel('Time', fontsize=8, labelpad=1)
	ax.set_ylabel('Protein Concentration', fontsize=8, labelpad=2)
	plt.legend(['tetR', 'lacI', 'gamma'], frameon=False, fontsize=8, labelspacing=0.15, loc=(0.06,0.65))

	# Plot of each timepoint
	ax = plt.subplot(gs[3])
	plot_construct(ax, 1, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)

	ax = plt.subplot(gs[4])
	plot_construct(ax, 12, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)

	ax = plt.subplot(gs[5])
	plot_construct(ax, 25.3, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)

	ax = plt.subplot(gs[6])
	plot_construct(ax, 27.3, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)

	ax = plt.subplot(gs[7])
	plot_construct(ax, 29.4, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)

	plt.subplots_adjust(hspace=0.4, left=0.12, right=0.95, top=0.99, bottom=0.01)
	
	plt.savefig('repressilator_animate.pdf', transparent=True)
	plt.savefig('repressilator_animate.png', dpi=300)
	
	movie(t, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)
コード例 #4
0
def main():
	plt.close()
	plt.figure(figsize=(3.5, 1.5))
	gs = gridspec.GridSpec(1, 1, height_ratios=[1])

	# Plot of repressilator circuit
	ax = plt.subplot(gs[0])
	dnaplotlib.plot_sbol_designs([ax], [[plac, rbs1, tetr, term1, pgamma, rbs2, laci, term2, ptet, rbs3, gamma, term3]],
				[[lac_repress, gamma_repress, tet_repress]])
	ax.set_ylim([-10, 31])

	# Update subplot spacing
	plt.subplots_adjust(hspace=0.4, left=0.12, right=0.95, top=0.99, bottom=0.01)

	# Save the figure
	plt.savefig('repressilator_animate.pdf', transparent=True)
	plt.savefig('repressilator_animate.png', dpi=300)
コード例 #5
0
def main():
    t = np.arange(0, 30.1, 0.1)
    ymtet, ymlac, ymgamma, ytet, ylac, ygamma = zip(
        *odeint(repressilator, initial, t))
    plt.close()
    plt.figure(figsize=(3.5, 6.5))
    gs = gridspec.GridSpec(8, 1, height_ratios=[1, 2.5, 0.1, 1, 1, 1, 1, 1])

    # Plot of repressilator circuit
    ax = plt.subplot(gs[0])
    dnaplotlib.plot_sbol_designs([ax], [[
        plac, rbs1, tetr, term1, pgamma, rbs2, laci, term2, ptet, rbs3, gamma,
        term3
    ]], [[lac_repress, gamma_repress, tet_repress]])
    ax.set_ylim([-10, 31])

    # Plot of repressilator dynamics
    ax = plt.subplot(gs[1])
    plt.plot(t, ytet, color=[1.00, 0.75, 0.17])
    plt.plot(t, ylac, color=[0.38, 0.82, 0.32])
    plt.plot(t, ygamma, color=[0.38, 0.65, 0.87])
    plt.axvline(x=1, color='k', linewidth=0.7)
    plt.axvline(x=12, color='k', linewidth=0.7)
    plt.axvline(x=25.3, color='k', linewidth=0.7)
    plt.axvline(x=27.3, color='k', linewidth=0.7)
    plt.axvline(x=29.4, color='k', linewidth=0.7)
    plt.ylim([1, 4])
    ax.tick_params(axis='both', labelsize=8, width=0.8, length=3)
    ax.yaxis.tick_left()
    ax.xaxis.tick_bottom()
    ax.set_xlabel('Time', fontsize=8, labelpad=1)
    ax.set_ylabel('Protein Concentration', fontsize=8, labelpad=2)
    plt.legend(['tetR', 'lacI', 'gamma'],
               frameon=False,
               fontsize=8,
               labelspacing=0.15,
               loc=(0.06, 0.65))

    # Plot of each timepoint
    ax = plt.subplot(gs[3])
    plot_construct(ax, 1, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)
    ax = plt.subplot(gs[4])
    plot_construct(ax, 12, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)
    ax = plt.subplot(gs[5])
    plot_construct(ax, 25.3, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)
    ax = plt.subplot(gs[6])
    plot_construct(ax, 27.3, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)
    ax = plt.subplot(gs[7])
    plot_construct(ax, 29.4, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)

    # Update subplot spacing
    plt.subplots_adjust(hspace=0.4,
                        left=0.12,
                        right=0.95,
                        top=0.99,
                        bottom=0.01)

    # Save the figure
    plt.savefig('repressilator_animate.pdf', transparent=True)
    plt.savefig('repressilator_animate.png', dpi=300)

    # Generate the movie frames
    movie(t, ymtet, ymlac, ymgamma, ytet, ylac, ygamma)