-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_profile.t
executable file
·93 lines (60 loc) · 2.79 KB
/
test_profile.t
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import re
from simpletap.motus import MotusTestCase
class TestProfile(MotusTestCase):
def test_normal_fw_rev(self):
"motus profile with a forward and reverse file"
cmd = ("profile",
"-f", "sample_data/ERR878216_sample_1.fastq.gz",
"-r", "sample_data/ERR878216_sample_2.fastq.gz")
stdout, stderr, exit = self.run_motus(cmd)
self.validate_result(stdout, "sample_data/ERR878216_both.profile")
def test_normal_fw_rev_counts(self):
"motus profile with a forward and reverse file to produce raw counts"
cmd = ("profile",
"-c",
"-f", "sample_data/ERR878216_sample_1.fastq.gz",
"-r", "sample_data/ERR878216_sample_2.fastq.gz")
stdout, stderr, exit = self.run_motus(cmd)
self.validate_result(stdout, "sample_data/ERR878216_both_counts.profile")
def test_single(self):
"motus profile with a single file"
cmd = ("profile",
"-s", "sample_data/ERR878216_sample_1.fastq.gz")
stdout, stderr, exit = self.run_motus(cmd)
self.validate_result(stdout, "sample_data/ERR878216_single_1.profile")
def test_normal_multithread(self):
"motus profile with multiple threads"
cmd = ("profile",
"-f", "sample_data/ERR878216_sample_1.fastq.gz",
"-r", "sample_data/ERR878216_sample_2.fastq.gz",
"-t", "8")
stdout, stderr, exit = self.run_motus(cmd)
self.validate_result(stdout, "sample_data/ERR878216_both.profile")
def test_input_bam(self):
"motus profile by providing a bam file"
cmd = ("profile",
"-i", "sample_data/ERR878216_both.bam")
stdout, stderr, exit = self.run_motus(cmd, allow_error=True)
self.validate_result(stdout, "sample_data/ERR878216_both.profile")
def test_input_mgc(self):
"motus profile by providing a mgc file"
cmd = ("profile",
"-m", "sample_data/ERR878216_both.mgc")
stdout, stderr, exit = self.run_motus(cmd, allow_error=True)
self.validate_result(stdout, "sample_data/ERR878216_both.profile")
def test_input_sample_name(self):
"motus and providing a sample name"
SAMPLE = "MySuperLongSampleName"
cmd = ("profile",
"-n", SAMPLE,
"-s", "sample_data/ERR878216_sample_1.fastq.gz")
stdout, stderr, exit = self.run_motus(cmd, allow_error=True)
self.assertRegexpMatches(stdout,
re.compile("^#consensus_taxonomy\t{0}".format(SAMPLE), re.MULTILINE))
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
# vim: ai sts=4 et sw=4