Spaces:
Sleeping
Sleeping
Kevin Louis
commited on
Commit
•
7ef4de5
1
Parent(s):
da25fb0
Upload grapher.py
Browse files- grapher.py +17 -0
grapher.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from DNAseq import DNAseq
|
2 |
+
import plotly.graph_objects as go
|
3 |
+
|
4 |
+
|
5 |
+
# Derived class (subclass)
|
6 |
+
class DNAgrapher(DNAseq):
|
7 |
+
def pie_chart(self):
|
8 |
+
labels = ['Guanine', 'Cytosine', 'Thymine', 'Adenine']
|
9 |
+
values = [self.get_unit_count('g'),
|
10 |
+
self.get_unit_count('c'),
|
11 |
+
self.get_unit_count('t'),
|
12 |
+
self.get_unit_count('a'),
|
13 |
+
]
|
14 |
+
|
15 |
+
fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
|
16 |
+
return fig
|
17 |
+
|