This repository has been archived by the owner on Jul 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest_script.py
59 lines (45 loc) · 1.97 KB
/
Test_script.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
import BiomTable_class
import Data_chart
import Box_plot
import Diversity_class
import PathwayTable_class
def BiomTable_class_tester():
BT_test = BiomTable_class.BiomTable("example1_metaphlan.txt")
print(BT_test)
# print(BT_test.get_table())
print(BT_test.tax_abundance('phylum'))
# print(BT_test.tax_abundance('asdf'))
print(BT_test.tax_abundance('k'))
print(BT_test.tax_richness('phylum'))
print(BT_test.tax_richness('g'))
def BiomTable_data_chart_tester():
PC_test = BiomTable_class.BiomTable("example1_metaphlan.txt")
Data_chart.data_chart_drawer(PC_test, 'Abundance', graph_type= 'pie')
#Data_chart.data_chart_drawer(PC_test, 'Abundance', taxonomy='g')
def BiomTable_box_plot_tester():
BP_test = Box_plot.box_plot_drawer('database', 5, 'Richness')
def Diversity_class_tester():
DC_test = Diversity_class.Diversity("example1_metaphlan.txt")
print(DC_test)
print('Richness: ', DC_test.richness(), '\nShannon_index: ', DC_test.shannon_index(),
"\nSimpson_index: ", DC_test.simpson_index())
example_sample2 = BiomTable_class.BiomTable("example2_metaphlan.txt")
print("Jaccard_index: ", DC_test.jaccard_index(example_sample2.tax_abundance('species')))
list_lenght = 5
print("Top {} taxonomy groups".format(list_lenght), DC_test.top_x_abundance(list_lenght))
print(DC_test.tax_richness())
def PathwayTable_class_tester():
PT_test = PathwayTable_class.PathwayTable("example1_pathabundance.tsv")
print('String Representation', PT_test)
print('Pathway table (list representation)', PT_test.get_rows())
print('Total abundance: ', PT_test.get_total_abundance())
print('Top pathways: ', PT_test.get_top_pathways(6))
for row1 in PT_test.get_table():
print(row1[1], row1[0][0:10])
for row2 in PT_test.get_top_pathways(10):
print(row2)
BiomTable_data_chart_tester()
#BiomTable_class_tester()
# BiomTable_box_plot_tester()
#Diversity_class_tester()
#PathwayTable_class_tester()