forked from Majid-Soheili/BMDSRA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBMDSRA.py
50 lines (39 loc) · 1.62 KB
/
BMDSRA.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
import os
import unittest
from Codes.BMDSRA import BMDSRA
class MyTestCase(unittest.TestCase):
model_path = "..\\..\\resource\\4-model\\model.json"
scaler_path = "..\\..\\resource\\4-model\\scaler.gz"
model = BMDSRA(model_path, scaler_path)
def test_model_Isolated(self):
seq_path = "..\\..\\resource\\2-subsra\\SRR1588386.fastq"
res = self.model.predict(seq_path)
self.assertEqual(res, "Isolated") # add assertion here
def test_model_Amplicon(self):
#
seq_path = "..\\..\\resource\\2-subsra\\SRR5923239.fastq"
res = self.model.predict(seq_path)
self.assertEqual(res, "Amplicon")
seq_path = "..\\..\\resource\\2-subsra\\SRR1196387.fastq"
res = self.model.predict(seq_path)
self.assertEqual(res, "Amplicon")
def test_model_Metagenome(self):
seq_path = "..\\..\\resource\\2-subsra\\SRR5215510.fastq"
res = self.model.predict(seq_path)
self.assertEqual(res, "Metagenome")
seq_path = "..\\..\\resource\\2-subsra\\DRR171797.fastq"
res = self.model.predict(seq_path)
self.assertEqual(res, "Metagenome")
def test_model_directorz(self):
# read files in folder
# iterate through all file
seq_path = "C:/My Research/08- BioSeC/06-BethaTest/"
os.chdir(seq_path)
for file in os.listdir():
# Check whether file is in text format or not
if file.endswith(".fastq"):
file_path = f"{seq_path}/{file}"
res = self.model.predict(file_path)
print(res)
if __name__ == '__main__':
unittest.main()