-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathinput_gff.py
executable file
·42 lines (32 loc) · 1.02 KB
/
input_gff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
"""
File input
"""
import dnaplotlib as dpl
import matplotlib.pyplot as plt
from matplotlib import gridspec
__author__ = 'Thomas Gorochowski <[email protected]>, Voigt Lab, MIT'
__license__ = 'MIT'
__version__ = '1.0'
# Load the design from a GFF file
design = dpl.load_design_from_gff('plasmid.gff', 'chrom1', region=[1700, 15880])
# Create the DNAplotlib renderer
dr = dpl.DNARenderer()
part_renderers = dr.SBOL_part_renderers()
# Create the figure
fig = plt.figure(figsize=(5.0,0.6))
gs = gridspec.GridSpec(1, 1)
ax_dna = plt.subplot(gs[0])
# Redender the DNA to axis
start, end = dr.renderDNA(ax_dna, design, part_renderers)
ax_dna.set_xlim([start, end])
ax_dna.set_ylim([-15,15])
ax_dna.set_aspect('equal')
ax_dna.axis('off')
# Update subplot spacing
plt.subplots_adjust(left=0.01, right=0.99, top=0.99, bottom=0.01)
# Save the figure
fig.savefig('input_gff.pdf', transparent=True)
fig.savefig('input_gff.png', dpi=300)
# Clear the plotting cache
plt.close('all')