Mercurial > repos > davidvanzessen > shm_csr
annotate tests/test_shm_csr.py @ 90:6809c63d9161 draft
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
author | rhpvorderman |
---|---|
date | Tue, 25 Jan 2022 11:28:29 +0000 |
parents | 729738462297 |
children | cf8ad181628f |
rev | line source |
---|---|
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
1 # Copyright (c) 2021 Leiden University Medical Center |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
2 # |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
3 # Permission is hereby granted, free of charge, to any person obtaining a copy |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
4 # of this software and associated documentation files (the "Software"), to deal |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
5 # in the Software without restriction, including without limitation the rights |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
7 # copies of the Software, and to permit persons to whom the Software is |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
8 # furnished to do so, subject to the following conditions: |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
9 # |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
10 # The above copyright notice and this permission notice shall be included in |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
11 # all copies or substantial portions of the Software. |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
12 # |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
19 # SOFTWARE. |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
20 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
21 import os |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
22 import shutil |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
23 import subprocess |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
24 import sys |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
25 import tempfile |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
26 from pathlib import Path |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
27 from xml.etree import ElementTree |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
28 from xml.etree.ElementTree import Element |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
29 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
30 import pytest |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
31 |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
32 GIT_ROOT = Path(__file__).parent.parent.absolute() |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
33 TEST_DIR = Path(__file__).parent |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
34 TEST_DATA_DIR = TEST_DIR / "data" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
35 VALIDATION_DATA_DIR = TEST_DIR / "validation_data" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
36 CONTROL_NWK377_PB_IGHC_MID1_40nt_2 = TEST_DATA_DIR / "CONTROL_NWK377_PB_IGHC_MID1_40nt_2.txz" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
37 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
38 |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
39 def get_container(): |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
40 tool = ElementTree.parse(GIT_ROOT / "shm_csr.xml").getroot() |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
41 requirements: Element = tool.find("requirements") |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
42 container = requirements.find("container") |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
43 return container.text |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
44 |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
45 |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
46 @pytest.fixture(scope="module") |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
47 def shm_csr_result(): |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
48 temp_dir = Path(tempfile.mkdtemp()) |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
49 tool_dir = temp_dir / "shm_csr" |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
50 shutil.copytree(GIT_ROOT, tool_dir) |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
51 working_dir = temp_dir / "working" |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
52 working_dir.mkdir(parents=True) |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
53 output_dir = temp_dir / "outputs" |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
54 output_dir.mkdir(parents=True) |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
55 wrapper = str(tool_dir / "wrapper.sh") |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
56 input = str(CONTROL_NWK377_PB_IGHC_MID1_40nt_2) |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
57 out_files_path = output_dir / "results" |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
58 out_file = out_files_path / "result.html" |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
59 infile_name = "input_data" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
60 functionality = "productive" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
61 unique = "Sequence.ID" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
62 naive_output = "no" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
63 naive_output_ca = "None" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
64 naive_output_cg = "None" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
65 naive_output_cm = "None" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
66 naive_output_ce = "None" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
67 naive_output_all = "None" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
68 filter_unique = "remove" |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
69 filter_unique_count = '2' |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
70 class_filter = '70_70' |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
71 empty_region_filter = 'FR1' |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
72 fast = 'no' |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
73 cmd = [ |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
74 "bash", |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
75 wrapper, |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
76 input, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
77 "custom", |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
78 str(out_file), |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
79 str(out_files_path), |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
80 infile_name, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
81 "-", |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
82 functionality, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
83 unique, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
84 naive_output, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
85 naive_output_ca, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
86 naive_output_cg, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
87 naive_output_cm, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
88 naive_output_ce, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
89 naive_output_all, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
90 filter_unique, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
91 filter_unique_count, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
92 class_filter, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
93 empty_region_filter, |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
94 fast |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
95 ] |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
96 docker_cmd = ["docker", "run", "-v", f"{temp_dir}:{temp_dir}", |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
97 "--rm", # Remove container after running |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
98 "-v", f"{input}:{input}", |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
99 "-w", str(working_dir), |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
100 # Run as current user which allows deletion of files. |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
101 # It also mitigates some security considerations |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
102 "-u", f"{os.getuid()}:{os.getgid()}", |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
103 # Run with default seccomp profile to mitigate mitigation slowdown |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
104 # http://mamememo.blogspot.com/2020/05/cpu-intensive-rubypython-code-runs.html |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
105 # This knocks down test runtime from 8 to 6 minutes. |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
106 "--security-opt", "seccomp=unconfined", |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
107 # Use a mulled container generated with `planemo mull` |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
108 "quay.io/biocontainers/mulled-v2-f7d31c9d7424063a492fc0e5ecbf89bc757c0107:2b50bdd4d8c1fefc6ec24b0753fad0dcecec843b-0" |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
109 ] + cmd |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
110 with open(temp_dir / "stderr", "wt") as stderr_file: |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
111 with open(temp_dir / "stdout", "wt") as stdout_file: |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
112 subprocess.run(docker_cmd, cwd=working_dir, stdout=stdout_file, |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
113 stderr=stderr_file, check=True) |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
114 yield Path(out_files_path) |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
115 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
116 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
117 def test_check_output(shm_csr_result): |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
118 assert shm_csr_result.exists() |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
119 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
120 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
121 @pytest.mark.parametrize("filename", os.listdir(VALIDATION_DATA_DIR)) |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
122 def test_results_match_validation(shm_csr_result, filename): |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
123 with open(Path(shm_csr_result, filename)) as result_h: |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
124 with open(Path(VALIDATION_DATA_DIR, filename)) as validate_h: |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
125 for line in result_h: |
90
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
126 # Skip two faulty lines in shm_overview. |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
127 # TODO: Fix the issue. |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
128 validation_line = validate_h.readline() |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
129 if filename == "shm_overview.txt": |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
130 if (line.startswith("RGYW (%)") or |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
131 line.startswith("WRCY (%)")): |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
132 continue |
6809c63d9161
"planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents:
83
diff
changeset
|
133 assert line == validation_line |
83
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
134 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
135 |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
136 def test_nt_overview(shm_csr_result): |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
137 with open(Path(shm_csr_result, "sequence_overview", "ntoverview.txt") |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
138 ) as result_h: |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
139 with open(Path(TEST_DIR, "sequence_overview", "ntoverview.txt") |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
140 ) as validate_h: |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
141 for line in result_h: |
729738462297
"planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff
changeset
|
142 assert line == validate_h.readline() |