pdb-tools 2.4.12__py3-none-any.whl → 2.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/METADATA +19 -11
- pdb_tools-2.5.1.dist-info/RECORD +55 -0
- {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/WHEEL +1 -1
- {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/entry_points.txt +1 -1
- {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/top_level.txt +0 -1
- pdbtools/pdb_selmodel.py +194 -0
- pdbtools/pdb_tidy.py +17 -9
- pdb_tools-2.4.12.dist-info/RECORD +0 -103
- tests/__init__.py +0 -38
- tests/config.py +0 -25
- tests/test_pdb_b.py +0 -161
- tests/test_pdb_chain.py +0 -160
- tests/test_pdb_chainbows.py +0 -140
- tests/test_pdb_chainxseg.py +0 -156
- tests/test_pdb_chkensemble.py +0 -191
- tests/test_pdb_delchain.py +0 -165
- tests/test_pdb_delelem.py +0 -165
- tests/test_pdb_delhetatm.py +0 -115
- tests/test_pdb_delinsertion.py +0 -226
- tests/test_pdb_delres.py +0 -241
- tests/test_pdb_delresname.py +0 -171
- tests/test_pdb_element.py +0 -151
- tests/test_pdb_fixinsert.py +0 -223
- tests/test_pdb_fromcif.py +0 -124
- tests/test_pdb_gap.py +0 -125
- tests/test_pdb_head.py +0 -142
- tests/test_pdb_intersect.py +0 -139
- tests/test_pdb_keepcoord.py +0 -115
- tests/test_pdb_merge.py +0 -106
- tests/test_pdb_mkensemble.py +0 -132
- tests/test_pdb_occ.py +0 -161
- tests/test_pdb_reatom.py +0 -243
- tests/test_pdb_reres.py +0 -281
- tests/test_pdb_rplchain.py +0 -172
- tests/test_pdb_rplresname.py +0 -172
- tests/test_pdb_seg.py +0 -160
- tests/test_pdb_segxchain.py +0 -146
- tests/test_pdb_selaltloc.py +0 -943
- tests/test_pdb_selatom.py +0 -165
- tests/test_pdb_selchain.py +0 -210
- tests/test_pdb_selelem.py +0 -165
- tests/test_pdb_selhetatm.py +0 -116
- tests/test_pdb_selres.py +0 -257
- tests/test_pdb_selresname.py +0 -171
- tests/test_pdb_selseg.py +0 -165
- tests/test_pdb_shiftres.py +0 -241
- tests/test_pdb_sort.py +0 -254
- tests/test_pdb_splitchain.py +0 -242
- tests/test_pdb_splitmodel.py +0 -235
- tests/test_pdb_splitseg.py +0 -251
- tests/test_pdb_tidy.py +0 -312
- tests/test_pdb_tocif.py +0 -238
- tests/test_pdb_tofasta.py +0 -158
- tests/test_pdb_uniqname.py +0 -156
- tests/test_pdb_validate.py +0 -142
- tests/test_pdb_wc.py +0 -161
- tests/utils.py +0 -56
- {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info/licenses}/LICENSE +0 -0
tests/test_pdb_wc.py
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2018 João Pedro Rodrigues
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
|
|
18
|
-
"""
|
|
19
|
-
Unit Tests for `pdb_wc`.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
import os
|
|
23
|
-
import sys
|
|
24
|
-
import unittest
|
|
25
|
-
|
|
26
|
-
from config import data_dir
|
|
27
|
-
from utils import OutputCapture
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class TestTool(unittest.TestCase):
|
|
31
|
-
"""
|
|
32
|
-
Generic class for testing tools.
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
def setUp(self):
|
|
36
|
-
# Dynamically import the module
|
|
37
|
-
name = 'pdbtools.pdb_wc'
|
|
38
|
-
self.module = __import__(name, fromlist=[''])
|
|
39
|
-
|
|
40
|
-
def exec_module(self):
|
|
41
|
-
"""
|
|
42
|
-
Execs module.
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
with OutputCapture() as output:
|
|
46
|
-
try:
|
|
47
|
-
self.module.main()
|
|
48
|
-
except SystemExit as e:
|
|
49
|
-
self.retcode = e.code
|
|
50
|
-
|
|
51
|
-
self.stdout = output.stdout
|
|
52
|
-
self.stderr = output.stderr
|
|
53
|
-
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
def test_default(self):
|
|
57
|
-
"""$ pdb_wc data/dummy.pdb"""
|
|
58
|
-
|
|
59
|
-
fpath = os.path.join(data_dir, 'dummy.pdb')
|
|
60
|
-
sys.argv = ['', fpath]
|
|
61
|
-
|
|
62
|
-
# Execute the script
|
|
63
|
-
self.exec_module()
|
|
64
|
-
|
|
65
|
-
# Validate results
|
|
66
|
-
self.assertEqual(self.retcode, 0)
|
|
67
|
-
self.assertEqual(len(self.stdout), 7)
|
|
68
|
-
self.assertEqual(len(self.stderr), 0)
|
|
69
|
-
|
|
70
|
-
self.assertEqual(self.stdout,
|
|
71
|
-
["No. models:\t1",
|
|
72
|
-
"No. chains:\t4\t( 4.0/model)",
|
|
73
|
-
"No. residues:\t10\t( 10.0/model)",
|
|
74
|
-
"No. atoms:\t176\t( 176.0/model)",
|
|
75
|
-
"No. HETATM:\t9",
|
|
76
|
-
"Multiple Occ.:\tTrue",
|
|
77
|
-
"Res. Inserts:\tFalse"])
|
|
78
|
-
|
|
79
|
-
def test_single_option_1(self):
|
|
80
|
-
"""$ pdb_wc -m data/ensemble_OK.pdb"""
|
|
81
|
-
|
|
82
|
-
fpath = os.path.join(data_dir, 'ensemble_OK.pdb')
|
|
83
|
-
sys.argv = ['', '-m', fpath]
|
|
84
|
-
|
|
85
|
-
# Execute the script
|
|
86
|
-
self.exec_module()
|
|
87
|
-
|
|
88
|
-
# Validate results
|
|
89
|
-
self.assertEqual(self.retcode, 0) # ensure the program exited OK.
|
|
90
|
-
self.assertEqual(len(self.stdout), 2)
|
|
91
|
-
self.assertEqual(len(self.stderr), 0) # no errors
|
|
92
|
-
|
|
93
|
-
self.assertEqual(self.stdout,
|
|
94
|
-
["No. models:\t2", "\t->\t1,2"])
|
|
95
|
-
|
|
96
|
-
def test_single_option_2(self):
|
|
97
|
-
"""$ pdb_wc -c data/dummy.pdb"""
|
|
98
|
-
|
|
99
|
-
fpath = os.path.join(data_dir, 'dummy.pdb')
|
|
100
|
-
sys.argv = ['', '-c', fpath]
|
|
101
|
-
|
|
102
|
-
# Execute the script
|
|
103
|
-
self.exec_module()
|
|
104
|
-
|
|
105
|
-
# Validate results
|
|
106
|
-
self.assertEqual(self.retcode, 0) # ensure the program exited OK.
|
|
107
|
-
self.assertEqual(len(self.stdout), 2)
|
|
108
|
-
self.assertEqual(len(self.stderr), 0) # no errors
|
|
109
|
-
|
|
110
|
-
self.assertEqual(self.stdout,
|
|
111
|
-
['No. chains:\t4\t( 4.0/model)', '\t->\tA,B,C,D'])
|
|
112
|
-
|
|
113
|
-
def test_file_not_found(self):
|
|
114
|
-
"""$ pdb_wc not_existing.pdb"""
|
|
115
|
-
|
|
116
|
-
# Error (file not found)
|
|
117
|
-
afile = os.path.join(data_dir, 'not_existing.pdb')
|
|
118
|
-
sys.argv = ['', afile]
|
|
119
|
-
|
|
120
|
-
# Execute the script
|
|
121
|
-
self.exec_module()
|
|
122
|
-
|
|
123
|
-
self.assertEqual(self.retcode, 1)
|
|
124
|
-
self.assertEqual(len(self.stdout), 0)
|
|
125
|
-
self.assertEqual(self.stderr[0][:22],
|
|
126
|
-
"ERROR!! File not found")
|
|
127
|
-
|
|
128
|
-
@unittest.skipIf(os.getenv('SKIP_TTY_TESTS'), 'skip on GHA - no TTY')
|
|
129
|
-
def test_helptext(self):
|
|
130
|
-
"""$ pdb_wc"""
|
|
131
|
-
|
|
132
|
-
sys.argv = ['']
|
|
133
|
-
|
|
134
|
-
# Execute the script
|
|
135
|
-
self.exec_module()
|
|
136
|
-
|
|
137
|
-
self.assertEqual(self.retcode, 1)
|
|
138
|
-
self.assertEqual(len(self.stdout), 0)
|
|
139
|
-
self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
|
|
140
|
-
|
|
141
|
-
def test_invalid_option(self):
|
|
142
|
-
"""$ pdb_wc -X data/dummy.pdb"""
|
|
143
|
-
|
|
144
|
-
sys.argv = ['', '-X', os.path.join(data_dir, 'dummy.pdb')]
|
|
145
|
-
|
|
146
|
-
# Execute the script
|
|
147
|
-
self.exec_module()
|
|
148
|
-
|
|
149
|
-
self.assertEqual(self.retcode, 1)
|
|
150
|
-
self.assertEqual(len(self.stdout), 0)
|
|
151
|
-
self.assertEqual(self.stderr[0][:36],
|
|
152
|
-
"ERROR!! The following options are no")
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if __name__ == '__main__':
|
|
156
|
-
from config import test_dir
|
|
157
|
-
|
|
158
|
-
mpath = os.path.abspath(os.path.join(test_dir, '..'))
|
|
159
|
-
sys.path.insert(0, mpath) # so we load dev files before any installation
|
|
160
|
-
|
|
161
|
-
unittest.main()
|
tests/utils.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2018 João Pedro Rodrigues
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
|
|
18
|
-
"""
|
|
19
|
-
Utility classes/functions for the Tests.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
try:
|
|
23
|
-
from cStringIO import StringIO
|
|
24
|
-
except ImportError: # Py 3.x?
|
|
25
|
-
from io import StringIO
|
|
26
|
-
|
|
27
|
-
import sys
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class OutputCapture(object):
|
|
31
|
-
"""Context manager to capture output usually redirected to stdout.
|
|
32
|
-
|
|
33
|
-
Use as:
|
|
34
|
-
>>> with OutputCapture() as output:
|
|
35
|
-
>>> ....run_stuff()
|
|
36
|
-
>>> print(output) # list with lines
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
def __enter__(self):
|
|
40
|
-
self.stdout = []
|
|
41
|
-
self.stderr = []
|
|
42
|
-
|
|
43
|
-
self._stdout = sys.stdout
|
|
44
|
-
self._stderr = sys.stderr
|
|
45
|
-
sys.stdout = self._stringout = StringIO()
|
|
46
|
-
sys.stderr = self._stringerr = StringIO()
|
|
47
|
-
return self
|
|
48
|
-
|
|
49
|
-
def __exit__(self, *args):
|
|
50
|
-
|
|
51
|
-
self.stdout.extend(self._stringout.getvalue().splitlines())
|
|
52
|
-
self.stderr.extend(self._stringerr.getvalue().splitlines())
|
|
53
|
-
del self._stringout # free up some memory
|
|
54
|
-
del self._stringerr # free up some memory
|
|
55
|
-
sys.stdout = self._stdout
|
|
56
|
-
sys.stderr = self._stderr
|
|
File without changes
|