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.
Files changed (58) hide show
  1. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/METADATA +19 -11
  2. pdb_tools-2.5.1.dist-info/RECORD +55 -0
  3. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/WHEEL +1 -1
  4. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/entry_points.txt +1 -1
  5. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/top_level.txt +0 -1
  6. pdbtools/pdb_selmodel.py +194 -0
  7. pdbtools/pdb_tidy.py +17 -9
  8. pdb_tools-2.4.12.dist-info/RECORD +0 -103
  9. tests/__init__.py +0 -38
  10. tests/config.py +0 -25
  11. tests/test_pdb_b.py +0 -161
  12. tests/test_pdb_chain.py +0 -160
  13. tests/test_pdb_chainbows.py +0 -140
  14. tests/test_pdb_chainxseg.py +0 -156
  15. tests/test_pdb_chkensemble.py +0 -191
  16. tests/test_pdb_delchain.py +0 -165
  17. tests/test_pdb_delelem.py +0 -165
  18. tests/test_pdb_delhetatm.py +0 -115
  19. tests/test_pdb_delinsertion.py +0 -226
  20. tests/test_pdb_delres.py +0 -241
  21. tests/test_pdb_delresname.py +0 -171
  22. tests/test_pdb_element.py +0 -151
  23. tests/test_pdb_fixinsert.py +0 -223
  24. tests/test_pdb_fromcif.py +0 -124
  25. tests/test_pdb_gap.py +0 -125
  26. tests/test_pdb_head.py +0 -142
  27. tests/test_pdb_intersect.py +0 -139
  28. tests/test_pdb_keepcoord.py +0 -115
  29. tests/test_pdb_merge.py +0 -106
  30. tests/test_pdb_mkensemble.py +0 -132
  31. tests/test_pdb_occ.py +0 -161
  32. tests/test_pdb_reatom.py +0 -243
  33. tests/test_pdb_reres.py +0 -281
  34. tests/test_pdb_rplchain.py +0 -172
  35. tests/test_pdb_rplresname.py +0 -172
  36. tests/test_pdb_seg.py +0 -160
  37. tests/test_pdb_segxchain.py +0 -146
  38. tests/test_pdb_selaltloc.py +0 -943
  39. tests/test_pdb_selatom.py +0 -165
  40. tests/test_pdb_selchain.py +0 -210
  41. tests/test_pdb_selelem.py +0 -165
  42. tests/test_pdb_selhetatm.py +0 -116
  43. tests/test_pdb_selres.py +0 -257
  44. tests/test_pdb_selresname.py +0 -171
  45. tests/test_pdb_selseg.py +0 -165
  46. tests/test_pdb_shiftres.py +0 -241
  47. tests/test_pdb_sort.py +0 -254
  48. tests/test_pdb_splitchain.py +0 -242
  49. tests/test_pdb_splitmodel.py +0 -235
  50. tests/test_pdb_splitseg.py +0 -251
  51. tests/test_pdb_tidy.py +0 -312
  52. tests/test_pdb_tocif.py +0 -238
  53. tests/test_pdb_tofasta.py +0 -158
  54. tests/test_pdb_uniqname.py +0 -156
  55. tests/test_pdb_validate.py +0 -142
  56. tests/test_pdb_wc.py +0 -161
  57. tests/utils.py +0 -56
  58. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info/licenses}/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pdb-tools
3
- Version: 2.4.12
3
+ Version: 2.5.1
4
4
  Summary: A swiss army knife for PDB files.
5
5
  Home-page: http://bonvinlab.org/pdb-tools
6
6
  Author: Joao Rodrigues
@@ -9,20 +9,30 @@ License: Apache Software License, version 2
9
9
  Project-URL: Bug Reports, https://github.com/haddocking/pdb-tools/issues
10
10
  Project-URL: Source, https://github.com/haddocking/pdb-tools
11
11
  Keywords: bioinformatics protein structural-biology pdb
12
- Platform: UNKNOWN
13
12
  Classifier: Development Status :: 5 - Production/Stable
14
13
  Classifier: Intended Audience :: Science/Research
15
14
  Classifier: Topic :: Scientific/Engineering
16
15
  Classifier: Topic :: Scientific/Engineering :: Chemistry
17
16
  Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
18
- Classifier: License :: OSI Approved :: Apache Software License
19
- Classifier: Programming Language :: Python :: 2
20
- Classifier: Programming Language :: Python :: 2.7
21
- Classifier: Programming Language :: Python :: 3
22
- Classifier: Programming Language :: Python :: 3.6
23
- Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
24
23
  Description-Content-Type: text/markdown
25
24
  License-File: LICENSE
25
+ Dynamic: author
26
+ Dynamic: author-email
27
+ Dynamic: classifier
28
+ Dynamic: description
29
+ Dynamic: description-content-type
30
+ Dynamic: home-page
31
+ Dynamic: keywords
32
+ Dynamic: license
33
+ Dynamic: license-file
34
+ Dynamic: project-url
35
+ Dynamic: summary
26
36
 
27
37
  # pdb-tools
28
38
 
@@ -176,5 +186,3 @@ or a new tools, read our `CONTRIBUTING` instructions [here](https://github.com/h
176
186
  ## License
177
187
  `pdb-tools` are open-source and licensed under the Apache License, version 2.0.
178
188
  For details, see the LICENSE file.
179
-
180
-
@@ -0,0 +1,55 @@
1
+ pdb_tools-2.5.1.dist-info/licenses/LICENSE,sha256=cT2RbiAZ-YA-Vr_FpRv5cgvS3zh_KjQlBnvoewjElNQ,11350
2
+ pdbtools/__init__.py,sha256=FN83ZHvtgK83OaOvhaKBJXqvn44ikqLt1pXloqS03O8,3320
3
+ pdbtools/pdb_b.py,sha256=stTb1z6uzpUl564wfcU6SqR5f8eLGP5B-l5TuyKQBfs,5026
4
+ pdbtools/pdb_chain.py,sha256=pA4k_Qc25eYEu7Cuq0T9uiKcPckpG-ZisOiKyE16Ako,4955
5
+ pdbtools/pdb_chainbows.py,sha256=L91PjEINGsD5dioND5spVbQ31MzJRFRP8pwfa_mp9Ts,4486
6
+ pdbtools/pdb_chainxseg.py,sha256=tVTNwSdCJ-k3B98UbEMhVXGTO6mjM5IImWfhVBBYfYE,3812
7
+ pdbtools/pdb_chkensemble.py,sha256=w64kSWqWDxLnpCNu-HxZTQq1sNTKtD4xWfS7koyObMA,5282
8
+ pdbtools/pdb_delchain.py,sha256=MFEHI2oRenKPhMZeRnoXLW9dETHN7GTdDR2Rw-mhnzI,5201
9
+ pdbtools/pdb_delelem.py,sha256=9QBYgh7mIBf4Bvj2mVPe6Wr73QUcKz8JH9PcUxBoqJo,5258
10
+ pdbtools/pdb_delhetatm.py,sha256=9R4NLqSvFOX9Na6_HVMhT5hy1rT_2Rj2w4_XrdW1IBY,3740
11
+ pdbtools/pdb_delinsertion.py,sha256=hKTnjwfMPJ2QOPmwd1wMyScfPrGEEz-CcJk45ZB8wX4,2243
12
+ pdbtools/pdb_delres.py,sha256=ZrCQbPkMHye3FpxyvMuc5FYj1KWh5xwrEoMW0OzHehU,7907
13
+ pdbtools/pdb_delresname.py,sha256=aNOyr_LcYO4UakaPuJxC64s6pd1ZnZTx2wJ3up_Mvow,5209
14
+ pdbtools/pdb_element.py,sha256=dnij6pHjzRCrVQ-CerlQBe3QqZ_FRpajV1l-7jYvDQY,5321
15
+ pdbtools/pdb_fetch.py,sha256=QU6hRsyDeY9xZJMk5mv8_QaoMQVJCyIB4Pvp2Hs6tc4,4800
16
+ pdbtools/pdb_fixinsert.py,sha256=vKK7ucVh8Ipx3kHpYN-KetQg7Rr0lC1O_E71FBHZ3jE,7092
17
+ pdbtools/pdb_fromcif.py,sha256=OSMaRdUn6pQmiikVfX4jLztsE68jN_l167tQW1QtvkY,8197
18
+ pdbtools/pdb_gap.py,sha256=SHQp7W_Lc4z7Pr1_xdjy67IYHYMboMgXF1JaQ5pdIn0,4326
19
+ pdbtools/pdb_head.py,sha256=0GPzlYIQZIugMZLLXtHwPGvvY4ukNJIg3gNgSkjocDg,5082
20
+ pdbtools/pdb_intersect.py,sha256=JFo8_7kqJGHSjZjEPsCjeTBj2L3pUxtUB3rH8leK7rg,3890
21
+ pdbtools/pdb_keepcoord.py,sha256=Y-2B-4RLsuCdoGPd7AQ94SDm7Qt4LCjaxEsytEDSRrc,3444
22
+ pdbtools/pdb_merge.py,sha256=ZGfiKOrakzzC_EI5I4IPujCVrmW5tnpDLBWFWxLe7o0,3096
23
+ pdbtools/pdb_mkensemble.py,sha256=MMldN9gWgaLk5HaeKpiE4eNXRaGOsALNbr4NE4MPzCU,4145
24
+ pdbtools/pdb_occ.py,sha256=_lpq2oHXx1h7hTXA276sGxgMlgDQ2eqGQuWtp9Kl4d8,4745
25
+ pdbtools/pdb_reatom.py,sha256=0y9Dt70_3gwnLWmc1PJeWTU1lPF4IRxGGrVxo2JIUR4,6043
26
+ pdbtools/pdb_reres.py,sha256=s0gAIIKz6zFTKxMn5OsgXrOsIfi7gFcLeFIpjRl3k-o,5770
27
+ pdbtools/pdb_rplchain.py,sha256=0fE8wpb1X_aDX-RVhB9VbYcQSqDIqVLCWm_TcoUZB_s,5184
28
+ pdbtools/pdb_rplresname.py,sha256=IR89pvG3kdAa1GrNYCaj1XU67AJRwL3Uy2zOkp5QEJ8,5106
29
+ pdbtools/pdb_seg.py,sha256=SCKZzQKXJxF2W1yYo3-w9SsA3w1C0dFhYqRrN6G9a5U,4958
30
+ pdbtools/pdb_segxchain.py,sha256=2ZakxyOsPxrY3KcwJ1bVKwtHGDWIbVOWSbxGjK2U_3Y,4407
31
+ pdbtools/pdb_selaltloc.py,sha256=GLNgCXO7-TQ3yiclM9VGuzH7Cmv_4IA5rtkCN3ggdng,15351
32
+ pdbtools/pdb_selatom.py,sha256=x60cAFLYU4JOgaQ-uRXvQtVt3W9vEWShMiGxbqkKXx8,5267
33
+ pdbtools/pdb_selchain.py,sha256=EsEz4DNjNsWLPDSgpDdVpw2uEBLIuVowAfcRvrp4Y-k,5136
34
+ pdbtools/pdb_selelem.py,sha256=jQ4zVfHincDyW1jbqJRR4H-gvkmgb9gqo3X3qlD5zMs,5298
35
+ pdbtools/pdb_selhetatm.py,sha256=rTlNaD8lZQwfW0-51KdRsCBn0rnDNMXisAvq9t9EeRg,3711
36
+ pdbtools/pdb_selmodel.py,sha256=s-HzuWrAlBP0qGJpboa5ccZECUQ1t95CqL2NH1D54PM,5538
37
+ pdbtools/pdb_selres.py,sha256=2ru7kmerulQel2qNz3EhgevQ0v2dRe3m6NlDG08sP14,8753
38
+ pdbtools/pdb_selresname.py,sha256=i2wo7EgXPHVy8rlbD-iB8ynw0umYFEop9YCUUQdCsSk,5281
39
+ pdbtools/pdb_selseg.py,sha256=xFRfcVrqbWv_9HhLQbKvPOedhbmdU-s4GoVupAvxWzs,5089
40
+ pdbtools/pdb_shiftres.py,sha256=LrZufworF1xF0u_uY0_QYjIfU7Uk7AftWJAwnN5BXL4,5079
41
+ pdbtools/pdb_sort.py,sha256=szYyd5NhpVjfNSEO07LBuFtHHM3eZXRfZ-T7YNORs60,8280
42
+ pdbtools/pdb_splitchain.py,sha256=TepAD4vlUD7kc3oqJQ49WOM7xr8hdvisP6BgZfkGbNc,3765
43
+ pdbtools/pdb_splitmodel.py,sha256=oXUiZn_TY8q2jl5_KEVI1ydE7P3W5kp7X8cM7nQO-Co,3577
44
+ pdbtools/pdb_splitseg.py,sha256=g5pQ9rye9q3cgY866ZwDaCNEAzevKOr_ePX84L0tdUw,3868
45
+ pdbtools/pdb_tidy.py,sha256=fJWDyU5wdJvxwz3BTi88k75K1Zu2-qmsJW-EJ52xC2Q,8644
46
+ pdbtools/pdb_tocif.py,sha256=8xS8eROua71uzxB8kR9WOKmnaJAdr11XKPVFwhLUZOY,6768
47
+ pdbtools/pdb_tofasta.py,sha256=n9RxmiVcSo1sX-oWMly4-Xi4YwNviLCk0uuGQYt1gFE,6336
48
+ pdbtools/pdb_uniqname.py,sha256=uucIbHShFdHl6nskcrALNf_jzHgFA8zCyx0dXtONRVM,3890
49
+ pdbtools/pdb_validate.py,sha256=yTjlgexYoB52oLr3kFlSBqhPh-WeZWSAEuBPaORiCyY,6286
50
+ pdbtools/pdb_wc.py,sha256=0aOGwNG66A4tUJANt-r1z_Pp3LoCOadHXGpmSoabNGU,8477
51
+ pdb_tools-2.5.1.dist-info/METADATA,sha256=ay9s_BABr4O2KRIFNXQecjZL-nf0fMSvCSTYjA66hj4,6780
52
+ pdb_tools-2.5.1.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
53
+ pdb_tools-2.5.1.dist-info/entry_points.txt,sha256=ZwR1wuBJ03mYzXiYYToZqtHlw1CV4OQxAUgJ2iR_AXk,1986
54
+ pdb_tools-2.5.1.dist-info/top_level.txt,sha256=VJ80Sd0ldoM5Fb0EG_JRbs2GmslbFIKBL8Y0Rok8q-U,9
55
+ pdb_tools-2.5.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.37.1)
2
+ Generator: setuptools (80.10.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -33,6 +33,7 @@ pdb_selatom = pdbtools.pdb_selatom:main
33
33
  pdb_selchain = pdbtools.pdb_selchain:main
34
34
  pdb_selelem = pdbtools.pdb_selelem:main
35
35
  pdb_selhetatm = pdbtools.pdb_selhetatm:main
36
+ pdb_selmodel = pdbtools.pdb_selmodel:main
36
37
  pdb_selres = pdbtools.pdb_selres:main
37
38
  pdb_selresname = pdbtools.pdb_selresname:main
38
39
  pdb_selseg = pdbtools.pdb_selseg:main
@@ -47,4 +48,3 @@ pdb_tofasta = pdbtools.pdb_tofasta:main
47
48
  pdb_uniqname = pdbtools.pdb_uniqname:main
48
49
  pdb_validate = pdbtools.pdb_validate:main
49
50
  pdb_wc = pdbtools.pdb_wc:main
50
-
@@ -0,0 +1,194 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2022 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
+ Extracts one or more models from a PDB file.
20
+
21
+ If the PDB file has no MODEL records, returns the entire file.
22
+
23
+ Usage:
24
+ python pdb_selmodel.py -<model id> <pdb file>
25
+
26
+ Example:
27
+ python pdb_selmodel.py -1 1GGR.pdb # selects model 1
28
+ python pdb_selmodel.py -1,3 1GGR.pdb # selects models 1 and 3
29
+
30
+ This program is part of the `pdb-tools` suite of utilities and should not be
31
+ distributed isolatedly. The `pdb-tools` were created to quickly manipulate PDB
32
+ files using the terminal, and can be used sequentially, with one tool streaming
33
+ data to another. They are based on old FORTRAN77 code that was taking too much
34
+ effort to maintain and compile. RIP.
35
+ """
36
+
37
+ import os
38
+ import sys
39
+
40
+ __author__ = "Joao Rodrigues"
41
+ __email__ = "j.p.g.l.m.rodrigues@gmail.com"
42
+
43
+
44
+ def check_input(args):
45
+ """Checks whether to read from stdin/file and validates user input/options.
46
+ """
47
+
48
+ # Defaults
49
+ option = ''
50
+ fh = sys.stdin # file handle
51
+
52
+ if not len(args):
53
+ # Reading from pipe with default option
54
+ if sys.stdin.isatty():
55
+ sys.stderr.write(__doc__)
56
+ sys.exit(1)
57
+
58
+ elif len(args) == 1:
59
+ # One of two options: option & Pipe OR file & default option
60
+ if args[0].startswith('-'):
61
+ option = args[0][1:]
62
+ if sys.stdin.isatty(): # ensure the PDB data is streamed in
63
+ emsg = 'ERROR!! No data to process!\n'
64
+ sys.stderr.write(emsg)
65
+ sys.stderr.write(__doc__)
66
+ sys.exit(1)
67
+
68
+ else:
69
+ if not os.path.isfile(args[0]):
70
+ emsg = 'ERROR!! File not found or not readable: \'{}\'\n'
71
+ sys.stderr.write(emsg.format(args[0]))
72
+ sys.stderr.write(__doc__)
73
+ sys.exit(1)
74
+
75
+ fh = open(args[0], 'r')
76
+
77
+ elif len(args) == 2:
78
+ # Two options: option & File
79
+ if not args[0].startswith('-'):
80
+ emsg = 'ERROR! First argument is not an option: \'{}\'\n'
81
+ sys.stderr.write(emsg.format(args[0]))
82
+ sys.stderr.write(__doc__)
83
+ sys.exit(1)
84
+
85
+ if not os.path.isfile(args[1]):
86
+ emsg = 'ERROR!! File not found or not readable: \'{}\'\n'
87
+ sys.stderr.write(emsg.format(args[1]))
88
+ sys.stderr.write(__doc__)
89
+ sys.exit(1)
90
+
91
+ option = args[0][1:]
92
+ fh = open(args[1], 'r')
93
+
94
+ else: # Whatever ...
95
+ sys.stderr.write(__doc__)
96
+ sys.exit(1)
97
+
98
+ # Validate option
99
+ option_set = set()
100
+ for opt in option.split(','):
101
+ opt = opt.strip()
102
+ if not opt:
103
+ continue
104
+ try:
105
+ opt = int(opt)
106
+ except ValueError:
107
+ emsg = 'ERROR!! Model identifier is invalid: \'{}\'\n'
108
+ sys.stderr.write(emsg.format(opt))
109
+ sys.stderr.write(__doc__)
110
+ sys.exit(1)
111
+ option_set.add(opt)
112
+
113
+ if not option_set:
114
+ emsg = 'ERROR!! You must provide at least one model identifier\n'
115
+ sys.stderr.write(emsg)
116
+ sys.stderr.write(__doc__)
117
+ sys.exit(1)
118
+
119
+ return (fh, option_set)
120
+
121
+
122
+ def run(fhandle, model_set):
123
+ """
124
+ Filter the PDB file for specific model identifiers.
125
+
126
+ This function is a generator.
127
+
128
+ Parameters
129
+ ----------
130
+ fhandle : a line-by-line iterator of the original PDB file.
131
+
132
+ model_set : set, or list, or tuple
133
+ The group of models to kepp.
134
+ Example: (1, 3), keeps only atoms from models 1 and 3
135
+
136
+ Yields
137
+ ------
138
+ str (line-by-line)
139
+ The PDB lines for those matching the selected chains.
140
+ """
141
+ records = ('ATOM', 'HETATM', 'TER', 'ANISOU')
142
+ ignore_model = False
143
+ for line in fhandle:
144
+ if line.startswith('MODEL'):
145
+ model_id = int(line[10:14])
146
+ if model_id not in model_set:
147
+ ignore_model = True
148
+ continue
149
+
150
+ elif line.startswith('ENDMDL'):
151
+ if ignore_model:
152
+ ignore_model = False
153
+ continue
154
+
155
+ elif ignore_model and line.startswith(records):
156
+ continue
157
+ yield line
158
+
159
+
160
+ select_model = run
161
+
162
+
163
+ def main():
164
+ # Check Input
165
+ pdbfh, models = check_input(sys.argv[1:])
166
+
167
+ # Do the job
168
+ new_pdb = run(pdbfh, models)
169
+
170
+ try:
171
+ _buffer = []
172
+ _buffer_size = 5000 # write N lines at a time
173
+ for lineno, line in enumerate(new_pdb):
174
+ if not (lineno % _buffer_size):
175
+ sys.stdout.write(''.join(_buffer))
176
+ _buffer = []
177
+ _buffer.append(line)
178
+
179
+ sys.stdout.write(''.join(_buffer))
180
+ sys.stdout.flush()
181
+ except IOError:
182
+ # This is here to catch Broken Pipes
183
+ # for example to use 'head' or 'tail' without
184
+ # the error message showing up
185
+ pass
186
+
187
+ # last line of the script
188
+ # We can close it even if it is sys.stdin
189
+ pdbfh.close()
190
+ sys.exit(0)
191
+
192
+
193
+ if __name__ == '__main__':
194
+ main()
pdbtools/pdb_tidy.py CHANGED
@@ -44,6 +44,8 @@ effort to maintain and compile. RIP.
44
44
 
45
45
  import os
46
46
  import sys
47
+ import re
48
+ import textwrap
47
49
 
48
50
  __author__ = "Joao Rodrigues"
49
51
  __email__ = "j.p.g.l.m.rodrigues@gmail.com"
@@ -108,7 +110,7 @@ def check_input(args):
108
110
 
109
111
  def run(fhandle, strict=False):
110
112
  """
111
- Add TER/END statements and pads all lines to 80 characters.
113
+ Add TER/END statements and truncates/pads all lines to 80 characters.
112
114
 
113
115
  This function is a generator.
114
116
 
@@ -161,8 +163,14 @@ def run(fhandle, strict=False):
161
163
  if line.startswith(ignored): # to avoid matching END _and_ ENDMDL
162
164
  continue
163
165
 
164
- # Check line length
165
- line = "{:<80}\n".format(line)
166
+ # Check line length, wrapping and padding as necessary
167
+ # preserve the line prefix for wrapping
168
+ prefix = re.match(r"\S+\s*", line).group(0)
169
+ content = line[len(prefix):].lstrip()
170
+
171
+ line = "".join(
172
+ f"{prefix}{part:<{80 - len(prefix)}}\n"
173
+ for part in textwrap.wrap(content, width=80 - len(prefix)))
166
174
 
167
175
  yield line
168
176
 
@@ -214,9 +222,9 @@ def run(fhandle, strict=False):
214
222
  if atom_section:
215
223
  atom_section = False
216
224
  yield make_TER(prev_line)
217
- if in_model:
218
- yield "{:<80}\n".format("ENDMDL")
219
- in_model = False
225
+ if in_model:
226
+ yield "{:<80}\n".format("ENDMDL")
227
+ in_model = False
220
228
 
221
229
  if line.startswith('MODEL'):
222
230
  line = "MODEL " + " " + str(num_models).rjust(4)
@@ -240,9 +248,9 @@ def run(fhandle, strict=False):
240
248
  # Add last TER statement
241
249
  atom_section = False
242
250
  yield make_TER(prev_line)
243
- if in_model:
244
- yield "{:<80}\n".format("ENDMDL")
245
- in_model = False
251
+ if in_model:
252
+ yield "{:<80}\n".format("ENDMDL")
253
+ in_model = False
246
254
 
247
255
  # Add END statement
248
256
  yield "{:<80}\n".format("END")
@@ -1,103 +0,0 @@
1
- pdbtools/__init__.py,sha256=FN83ZHvtgK83OaOvhaKBJXqvn44ikqLt1pXloqS03O8,3320
2
- pdbtools/pdb_b.py,sha256=stTb1z6uzpUl564wfcU6SqR5f8eLGP5B-l5TuyKQBfs,5026
3
- pdbtools/pdb_chain.py,sha256=pA4k_Qc25eYEu7Cuq0T9uiKcPckpG-ZisOiKyE16Ako,4955
4
- pdbtools/pdb_chainbows.py,sha256=L91PjEINGsD5dioND5spVbQ31MzJRFRP8pwfa_mp9Ts,4486
5
- pdbtools/pdb_chainxseg.py,sha256=tVTNwSdCJ-k3B98UbEMhVXGTO6mjM5IImWfhVBBYfYE,3812
6
- pdbtools/pdb_chkensemble.py,sha256=w64kSWqWDxLnpCNu-HxZTQq1sNTKtD4xWfS7koyObMA,5282
7
- pdbtools/pdb_delchain.py,sha256=MFEHI2oRenKPhMZeRnoXLW9dETHN7GTdDR2Rw-mhnzI,5201
8
- pdbtools/pdb_delelem.py,sha256=9QBYgh7mIBf4Bvj2mVPe6Wr73QUcKz8JH9PcUxBoqJo,5258
9
- pdbtools/pdb_delhetatm.py,sha256=9R4NLqSvFOX9Na6_HVMhT5hy1rT_2Rj2w4_XrdW1IBY,3740
10
- pdbtools/pdb_delinsertion.py,sha256=hKTnjwfMPJ2QOPmwd1wMyScfPrGEEz-CcJk45ZB8wX4,2243
11
- pdbtools/pdb_delres.py,sha256=ZrCQbPkMHye3FpxyvMuc5FYj1KWh5xwrEoMW0OzHehU,7907
12
- pdbtools/pdb_delresname.py,sha256=aNOyr_LcYO4UakaPuJxC64s6pd1ZnZTx2wJ3up_Mvow,5209
13
- pdbtools/pdb_element.py,sha256=dnij6pHjzRCrVQ-CerlQBe3QqZ_FRpajV1l-7jYvDQY,5321
14
- pdbtools/pdb_fetch.py,sha256=QU6hRsyDeY9xZJMk5mv8_QaoMQVJCyIB4Pvp2Hs6tc4,4800
15
- pdbtools/pdb_fixinsert.py,sha256=vKK7ucVh8Ipx3kHpYN-KetQg7Rr0lC1O_E71FBHZ3jE,7092
16
- pdbtools/pdb_fromcif.py,sha256=OSMaRdUn6pQmiikVfX4jLztsE68jN_l167tQW1QtvkY,8197
17
- pdbtools/pdb_gap.py,sha256=SHQp7W_Lc4z7Pr1_xdjy67IYHYMboMgXF1JaQ5pdIn0,4326
18
- pdbtools/pdb_head.py,sha256=0GPzlYIQZIugMZLLXtHwPGvvY4ukNJIg3gNgSkjocDg,5082
19
- pdbtools/pdb_intersect.py,sha256=JFo8_7kqJGHSjZjEPsCjeTBj2L3pUxtUB3rH8leK7rg,3890
20
- pdbtools/pdb_keepcoord.py,sha256=Y-2B-4RLsuCdoGPd7AQ94SDm7Qt4LCjaxEsytEDSRrc,3444
21
- pdbtools/pdb_merge.py,sha256=ZGfiKOrakzzC_EI5I4IPujCVrmW5tnpDLBWFWxLe7o0,3096
22
- pdbtools/pdb_mkensemble.py,sha256=MMldN9gWgaLk5HaeKpiE4eNXRaGOsALNbr4NE4MPzCU,4145
23
- pdbtools/pdb_occ.py,sha256=_lpq2oHXx1h7hTXA276sGxgMlgDQ2eqGQuWtp9Kl4d8,4745
24
- pdbtools/pdb_reatom.py,sha256=0y9Dt70_3gwnLWmc1PJeWTU1lPF4IRxGGrVxo2JIUR4,6043
25
- pdbtools/pdb_reres.py,sha256=s0gAIIKz6zFTKxMn5OsgXrOsIfi7gFcLeFIpjRl3k-o,5770
26
- pdbtools/pdb_rplchain.py,sha256=0fE8wpb1X_aDX-RVhB9VbYcQSqDIqVLCWm_TcoUZB_s,5184
27
- pdbtools/pdb_rplresname.py,sha256=IR89pvG3kdAa1GrNYCaj1XU67AJRwL3Uy2zOkp5QEJ8,5106
28
- pdbtools/pdb_seg.py,sha256=SCKZzQKXJxF2W1yYo3-w9SsA3w1C0dFhYqRrN6G9a5U,4958
29
- pdbtools/pdb_segxchain.py,sha256=2ZakxyOsPxrY3KcwJ1bVKwtHGDWIbVOWSbxGjK2U_3Y,4407
30
- pdbtools/pdb_selaltloc.py,sha256=GLNgCXO7-TQ3yiclM9VGuzH7Cmv_4IA5rtkCN3ggdng,15351
31
- pdbtools/pdb_selatom.py,sha256=x60cAFLYU4JOgaQ-uRXvQtVt3W9vEWShMiGxbqkKXx8,5267
32
- pdbtools/pdb_selchain.py,sha256=EsEz4DNjNsWLPDSgpDdVpw2uEBLIuVowAfcRvrp4Y-k,5136
33
- pdbtools/pdb_selelem.py,sha256=jQ4zVfHincDyW1jbqJRR4H-gvkmgb9gqo3X3qlD5zMs,5298
34
- pdbtools/pdb_selhetatm.py,sha256=rTlNaD8lZQwfW0-51KdRsCBn0rnDNMXisAvq9t9EeRg,3711
35
- pdbtools/pdb_selres.py,sha256=2ru7kmerulQel2qNz3EhgevQ0v2dRe3m6NlDG08sP14,8753
36
- pdbtools/pdb_selresname.py,sha256=i2wo7EgXPHVy8rlbD-iB8ynw0umYFEop9YCUUQdCsSk,5281
37
- pdbtools/pdb_selseg.py,sha256=xFRfcVrqbWv_9HhLQbKvPOedhbmdU-s4GoVupAvxWzs,5089
38
- pdbtools/pdb_shiftres.py,sha256=LrZufworF1xF0u_uY0_QYjIfU7Uk7AftWJAwnN5BXL4,5079
39
- pdbtools/pdb_sort.py,sha256=szYyd5NhpVjfNSEO07LBuFtHHM3eZXRfZ-T7YNORs60,8280
40
- pdbtools/pdb_splitchain.py,sha256=TepAD4vlUD7kc3oqJQ49WOM7xr8hdvisP6BgZfkGbNc,3765
41
- pdbtools/pdb_splitmodel.py,sha256=oXUiZn_TY8q2jl5_KEVI1ydE7P3W5kp7X8cM7nQO-Co,3577
42
- pdbtools/pdb_splitseg.py,sha256=g5pQ9rye9q3cgY866ZwDaCNEAzevKOr_ePX84L0tdUw,3868
43
- pdbtools/pdb_tidy.py,sha256=BcZupUIej9rT3f8ViL7OT4hk0TOTxT2uJmMItUVTL84,8341
44
- pdbtools/pdb_tocif.py,sha256=8xS8eROua71uzxB8kR9WOKmnaJAdr11XKPVFwhLUZOY,6768
45
- pdbtools/pdb_tofasta.py,sha256=n9RxmiVcSo1sX-oWMly4-Xi4YwNviLCk0uuGQYt1gFE,6336
46
- pdbtools/pdb_uniqname.py,sha256=uucIbHShFdHl6nskcrALNf_jzHgFA8zCyx0dXtONRVM,3890
47
- pdbtools/pdb_validate.py,sha256=yTjlgexYoB52oLr3kFlSBqhPh-WeZWSAEuBPaORiCyY,6286
48
- pdbtools/pdb_wc.py,sha256=0aOGwNG66A4tUJANt-r1z_Pp3LoCOadHXGpmSoabNGU,8477
49
- tests/__init__.py,sha256=tX1BX4HhGdTL_quFu6wMoLMUWqo-yrPSE987UqsmOjs,1037
50
- tests/config.py,sha256=g0bQxEEnAjeiI9N7CFVXrZJdEZHYn-LSYAwPTMpCjpw,787
51
- tests/test_pdb_b.py,sha256=Ofyqxfqpue0pjAyuCbN80hcZ3vMzbzKuaY2lOlysJP0,4808
52
- tests/test_pdb_chain.py,sha256=cXd7LZ5pZ4Edot4DjSAiL9hGYqgmcN5TVKRui4JpItQ,4771
53
- tests/test_pdb_chainbows.py,sha256=Jim35bTRFdYvwqoPoh0GCz0OlT0pj7zi4H_LayjtFuA,4005
54
- tests/test_pdb_chainxseg.py,sha256=-tinx2JdZQTMN8Ccm3-QcXuFb0xU_l9h9jbNSfxYdyI,5806
55
- tests/test_pdb_chkensemble.py,sha256=U7fwsaDMu5QXIZiGFc19cONQpFIaaMF9RBILPowXykY,5562
56
- tests/test_pdb_delchain.py,sha256=wLxBTnwdAd5pb3iqzcKFRX5uWYAKofTBHyhmT8Uj2Kk,4894
57
- tests/test_pdb_delelem.py,sha256=UG_zoVuBGyn6bknmHhT1JXhdq3u6VqXWrFa5tkE0U84,4869
58
- tests/test_pdb_delhetatm.py,sha256=g0ivYCBUQFCmp-lwNz8xwIM94byRMyv4UXPGKoLG9EU,3314
59
- tests/test_pdb_delinsertion.py,sha256=KZt9Y4ZmEp8yxb033DAYK13QIwrPv97ECofx96OflHM,8244
60
- tests/test_pdb_delres.py,sha256=6JHoOxFVvMfTSCLDuV9UaykMdlGdST0UBydZHB78ZB8,6972
61
- tests/test_pdb_delresname.py,sha256=21K_MPGaWEMH6TDDhyHMGhiOLpTeix3ydMWj7VeWzYU,4934
62
- tests/test_pdb_element.py,sha256=ytCJpJAJP6UrZJBR374TMXYfYzESNUMJj-_cBGa1noY,5420
63
- tests/test_pdb_fixinsert.py,sha256=kg0P7geMe-6lt8v5Zt1fsPfZpdW4PghPlwxNpeqgkjE,8105
64
- tests/test_pdb_fromcif.py,sha256=Sa5nN_sTn-hkl4lXkUgORTTXoDY_T1RhunUR6bBBw1Q,3443
65
- tests/test_pdb_gap.py,sha256=k-cuHV_YFOJwcNVnX4Se1Z8lavmDLs-YZoog7pbzc74,3677
66
- tests/test_pdb_head.py,sha256=BMQBWmqBTh5D58WxL3D8IcmeA1cBtzvGmhWZSZalAns,4032
67
- tests/test_pdb_intersect.py,sha256=VVXh21L-vphqkPz4ntpmkVQwdgeLlvITIkWD9M0C7HA,5290
68
- tests/test_pdb_keepcoord.py,sha256=ZeI13lB3XV9wNfstp3aNkYYd-stq84sYm0DnmteOn5A,3304
69
- tests/test_pdb_merge.py,sha256=C7z8edrkuk0SIfyGVzgJ43edSNFluCDXLP3KM73c-ls,2976
70
- tests/test_pdb_mkensemble.py,sha256=f6j6-y9tW5s_lsPxhJ6bgYrNFMTP6IYuOdy5S1-8dVk,3710
71
- tests/test_pdb_occ.py,sha256=-r2GyyBahDNR-KJo6ONosC1bHAAJH6hoKQDBeva06ks,4817
72
- tests/test_pdb_reatom.py,sha256=Gd7RHtDb4r_oeV_sAR9HpeNpeuN5pWNyvLHSgoYmJ-U,9227
73
- tests/test_pdb_reres.py,sha256=x385SrxVrwshmVQXot2ga-6IiUKRBuNzhZgANLA8U7M,10218
74
- tests/test_pdb_rplchain.py,sha256=rvxA-CG2UIRXrRYFOJxkSaUPiQgWTQ7VnT2wxL4nRnE,5186
75
- tests/test_pdb_rplresname.py,sha256=JxvclM4XyuU-nHHSQC-nzRqa-G1AMUMQobmC0pRAqTM,5254
76
- tests/test_pdb_seg.py,sha256=_8bDwg3exa7prKL5Hr1A-ZnNjeaceSkTYdOsyauPQM8,4755
77
- tests/test_pdb_segxchain.py,sha256=h6V9opAnelMjHnfDpOsiLdRibelMjfSIxSVKJJ0qL6g,5007
78
- tests/test_pdb_selaltloc.py,sha256=q-CwaCjIKmsL5Hag8ghvzqUq1qQJLr_uJaj0Hps_6mo,42644
79
- tests/test_pdb_selatom.py,sha256=WR0D9rA6UZbCInnNYzBE9zwekh3pBrIM8Uh7Nvll47I,4802
80
- tests/test_pdb_selchain.py,sha256=XRd4034GJtmotTN_mFUr9q0ysmGffnEBpxuU8PYlYCQ,6355
81
- tests/test_pdb_selelem.py,sha256=eJX1pUINl4NB7zLGFwc9Jg6QOBE0Frfzs4Q87LSbXME,4777
82
- tests/test_pdb_selhetatm.py,sha256=ZOQBZ-Ca7TXM0luTfdzH-8x02YGsbHLDh-pT3LmDNDc,3314
83
- tests/test_pdb_selres.py,sha256=Eri1qaYqEZKji9f3DXqiXMqWChShy-7Cc_TQGv_oIcY,7357
84
- tests/test_pdb_selresname.py,sha256=tciwLpTeWm_FkaFv5XOj23GU2Y5p-I9E74c5BG9jTRw,4932
85
- tests/test_pdb_selseg.py,sha256=ixLjfhKvp9Qu8q6qqlCCvghRyyrONXBcE0_XsudMb4A,4817
86
- tests/test_pdb_shiftres.py,sha256=NWGo9Yxc53M3GAJafCVMEkzQ_byphZx2MWSHYq5EpLA,8914
87
- tests/test_pdb_sort.py,sha256=W8SrZPMF-3Ag14J9Ya0zfeJnbo-Rc1h1wfwPjhXb3yE,11213
88
- tests/test_pdb_splitchain.py,sha256=-PvCmvTgjTPIEpQuFh3LcyAvDDMJRW1Y9S6kzTOye0o,7885
89
- tests/test_pdb_splitmodel.py,sha256=d0O0YlKy_CMeoa8Xv6M-5lCTGtd9d5tyhM-BOw3kO7g,7200
90
- tests/test_pdb_splitseg.py,sha256=P5gGE1Xg1koCG5jg87mu3hWchTj5IeUjnXgCllkiw8c,8171
91
- tests/test_pdb_tidy.py,sha256=7Q4vL68TfgAs7JIciVON6AyzI8tnNwSzaRE7l_R1nLo,10143
92
- tests/test_pdb_tocif.py,sha256=m-AO2QfhOq746WtorqZiUn5EQhhSd0iZGlAxvbu69c8,7392
93
- tests/test_pdb_tofasta.py,sha256=ppqQ_F9MoVoq20BtMMmRNnskLQ6Csr-eFLiSaMaGz3w,4648
94
- tests/test_pdb_uniqname.py,sha256=Z5hrdpk7vaZ8q_bGk5hm53Ba4Ud0DRvG7SCmLaV5-3E,4530
95
- tests/test_pdb_validate.py,sha256=clS1l45-hmY52xNb2GGFMxzMYM7fRDojdmew71T_ax0,3962
96
- tests/test_pdb_wc.py,sha256=4o-sL4ZwtiJomteSDzoyhl-LwEZIgJ_n1dC_PMbY99U,4647
97
- tests/utils.py,sha256=D-raZvngkZqof2kMtK3gaX_GMIbhADudMUN4Xw2MKgs,1630
98
- pdb_tools-2.4.12.dist-info/LICENSE,sha256=cT2RbiAZ-YA-Vr_FpRv5cgvS3zh_KjQlBnvoewjElNQ,11350
99
- pdb_tools-2.4.12.dist-info/METADATA,sha256=zIkkeIyMk38kFhLdJoi8sY7cootR6t2ok3V4PPi8WuQ,6578
100
- pdb_tools-2.4.12.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
101
- pdb_tools-2.4.12.dist-info/entry_points.txt,sha256=a42rAFW_nA4QxnNd-4VUznsibaBlEgCtGdp63pddvU4,1945
102
- pdb_tools-2.4.12.dist-info/top_level.txt,sha256=e3EvPU8V_2ksmkPdq4YIuGWVUuEMvyuWUzgdhxefGqI,15
103
- pdb_tools-2.4.12.dist-info/RECORD,,
tests/__init__.py DELETED
@@ -1,38 +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 all pdb-tools scripts
20
- """
21
-
22
- import os
23
- import sys
24
- import unittest
25
-
26
- from .config import test_dir
27
-
28
-
29
- def test_all():
30
- mpath = os.path.abspath(os.path.join(test_dir, '..'))
31
- sys.path.insert(0, mpath) # so we load dev files before any installation
32
-
33
- loader = unittest.defaultTestLoader
34
-
35
- tpath = os.path.join(mpath, 'tests')
36
- suite = loader.discover(tpath)
37
-
38
- return suite
tests/config.py DELETED
@@ -1,25 +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
- Configuration settings for the Tests.
20
- """
21
-
22
- import os
23
-
24
- test_dir = os.path.dirname(os.path.abspath(__file__))
25
- data_dir = os.path.join(test_dir, 'data')