-
Notifications
You must be signed in to change notification settings - Fork 90
/
plasmid_map_custom.py
137 lines (119 loc) · 3.14 KB
/
plasmid_map_custom.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
"""
Visualization of a custom plasmid
=================================
.. currentmodule:: biotite.sequence
This script shows how :class:`Feature` objects are displayed in a
plasmid map by using a custom 'toy' :class:`Annotation`.
"""
# Code source: Patrick Kunzmann
# License: BSD 3 clause
import matplotlib.pyplot as plt
import numpy as np
import biotite.sequence as seq
import biotite.sequence.io.genbank as gb
import biotite.sequence.graphics as graphics
import biotite.database.entrez as entrez
annotation = seq.Annotation([
seq.Feature(
"source",
[seq.Location(0, 1500)],
{"organism": "Escherichia coli"}
),
# Ori
seq.Feature(
"rep_origin",
[seq.Location(600, 700, seq.Location.Strand.REVERSE)],
{"regulatory_class": "promoter", "note": "MyProm"}
),
# Promoter
seq.Feature(
"regulatory",
[seq.Location(1000, 1060)],
{"regulatory_class": "promoter", "note": "MyProm"}
),
seq.Feature(
"protein_bind",
[seq.Location(1025, 1045)],
{"note": "repr"}
),
# Gene A
seq.Feature(
"regulatory",
[seq.Location(1070, 1080)],
{"regulatory_class": "ribosome_binding_site"}
),
seq.Feature(
"CDS",
[seq.Location(1091, 1150)],
{"product": "geneA"}
),
# Gene B
seq.Feature(
"regulatory",
[seq.Location(1180, 1190)],
{"regulatory_class": "ribosome_binding_site"}
),
seq.Feature(
"CDS",
[seq.Location(1201, 1350)],
{"product": "geneB"}
),
seq.Feature(
"regulatory",
[seq.Location(1220, 1230)],
{"regulatory_class": "ribosome_binding_site"}
),
seq.Feature(
"CDS",
[seq.Location(1240, 1350)],
{"product": "geneB2"}
),
# Gene C
seq.Feature(
"regulatory",
[seq.Location(1380, 1390)],
{"regulatory_class": "ribosome_binding_site"}
),
seq.Feature(
"CDS",
# CDS extends over periodic boundary -> two locations
[seq.Location(1, 300), seq.Location(1402, 1500)],
{"product": "geneC"}
),
# Terminator
seq.Feature(
"regulatory",
[seq.Location(310, 350)],
{"regulatory_class": "terminator", "note": "MyTerm"}
),
# Primers
# The labels will be too long to be displayed on the map
# If you want to display them nevertheless, set the
# 'omit_oversized_labels' to False
seq.Feature(
"primer_bind",
[seq.Location(1385, 1405)],
{"note": "geneC"}
),
seq.Feature(
"primer_bind",
[seq.Location(345, 365, seq.Location.Strand.REVERSE)],
{"note": "geneC_R"}
),
# Terminator
seq.Feature(
"regulatory",
[seq.Location(310, 350)],
{"regulatory_class": "terminator", "note": "MyTerm"}
),
])
fig = plt.figure(figsize=(8.0, 8.0))
ax = fig.add_subplot(111, projection="polar")
graphics.plot_plasmid_map(
ax, annotation, plasmid_size=1500, label="My plasmid",
label_properties={"fontsize": 8}
)
ticks = ax.get_xticks()
labels = ax.get_xticklabels()
fig.tight_layout()
plt.show()