pdb-tools 2.4.12__tar.gz → 2.5.1__tar.gz
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.
Potentially problematic release.
This version of pdb-tools might be problematic. Click here for more details.
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/PKG-INFO +19 -11
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdb_tools.egg-info/PKG-INFO +19 -11
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdb_tools.egg-info/SOURCES.txt +1 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdb_tools.egg-info/entry_points.txt +1 -1
- pdb_tools-2.5.1/pdbtools/pdb_selmodel.py +194 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_tidy.py +17 -9
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/setup.py +31 -48
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/LICENSE +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/README.md +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/citation.tex +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdb_tools.egg-info/dependency_links.txt +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdb_tools.egg-info/top_level.txt +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/__init__.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_b.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_chain.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_chainbows.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_chainxseg.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_chkensemble.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_delchain.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_delelem.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_delhetatm.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_delinsertion.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_delres.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_delresname.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_element.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_fetch.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_fixinsert.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_fromcif.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_gap.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_head.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_intersect.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_keepcoord.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_merge.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_mkensemble.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_occ.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_reatom.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_reres.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_rplchain.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_rplresname.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_seg.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_segxchain.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selaltloc.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selatom.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selchain.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selelem.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selhetatm.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selres.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selresname.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_selseg.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_shiftres.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_sort.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_splitchain.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_splitmodel.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_splitseg.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_tocif.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_tofasta.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_uniqname.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_validate.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/pdbtools/pdb_wc.py +0 -0
- {pdb-tools-2.4.12 → pdb_tools-2.5.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pdb-tools
|
|
3
|
-
Version: 2.
|
|
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:
|
|
19
|
-
Classifier: Programming Language :: Python ::
|
|
20
|
-
Classifier: Programming Language :: Python ::
|
|
21
|
-
Classifier: Programming Language :: Python :: 3
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.
|
|
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
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pdb-tools
|
|
3
|
-
Version: 2.
|
|
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:
|
|
19
|
-
Classifier: Programming Language :: Python ::
|
|
20
|
-
Classifier: Programming Language :: Python ::
|
|
21
|
-
Classifier: Programming Language :: Python :: 3
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.
|
|
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
|
-
|
|
@@ -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()
|
|
@@ -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
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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")
|
|
@@ -8,6 +8,7 @@ https://github.com/pypa/sampleproject
|
|
|
8
8
|
# Always prefer setuptools over distutils
|
|
9
9
|
from setuptools import setup, find_packages
|
|
10
10
|
from os import listdir, path
|
|
11
|
+
|
|
11
12
|
# io.open is needed for projects that support Python 2.7
|
|
12
13
|
# It ensures open() defaults to text mode with universal newlines,
|
|
13
14
|
# and accepts an argument to specify the text encoding
|
|
@@ -17,54 +18,40 @@ from io import open
|
|
|
17
18
|
here = path.abspath(path.dirname(__file__))
|
|
18
19
|
|
|
19
20
|
# Get the long description from the README file
|
|
20
|
-
with open(path.join(here,
|
|
21
|
+
with open(path.join(here, "README.md"), encoding="utf-8") as f:
|
|
21
22
|
long_description = f.read()
|
|
22
23
|
|
|
23
24
|
# Collect names of bin/*py scripts
|
|
24
25
|
# e.g. 'pdb_intersect=bin.pdb_intersect:main',
|
|
25
|
-
binfiles = listdir(path.join(here,
|
|
26
|
-
bin_py = [
|
|
27
|
-
|
|
26
|
+
binfiles = listdir(path.join(here, "pdbtools"))
|
|
27
|
+
bin_py = [
|
|
28
|
+
f[:-3] + "=pdbtools." + f[:-3] + ":main" for f in binfiles if f.endswith(".py")
|
|
29
|
+
]
|
|
28
30
|
|
|
29
31
|
setup(
|
|
30
|
-
name=
|
|
31
|
-
version=
|
|
32
|
-
description=
|
|
32
|
+
name="pdb-tools", # Required
|
|
33
|
+
version="2.5.1", # Required
|
|
34
|
+
description="A swiss army knife for PDB files.", # Optional
|
|
33
35
|
long_description=long_description, # Optional
|
|
34
|
-
long_description_content_type=
|
|
35
|
-
url=
|
|
36
|
-
author=
|
|
37
|
-
author_email=
|
|
38
|
-
license=
|
|
39
|
-
classifiers=[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
'Topic :: Scientific/Engineering :: Bio-Informatics',
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# Pick your license as you wish
|
|
55
|
-
'License :: OSI Approved :: Apache Software License',
|
|
56
|
-
|
|
57
|
-
# Specify the Python versions you support here. In particular, ensure
|
|
58
|
-
# that you indicate whether you support Python 2, Python 3 or both.
|
|
59
|
-
'Programming Language :: Python :: 2',
|
|
60
|
-
'Programming Language :: Python :: 2.7',
|
|
61
|
-
'Programming Language :: Python :: 3',
|
|
62
|
-
'Programming Language :: Python :: 3.6',
|
|
63
|
-
'Programming Language :: Python :: 3.7',
|
|
36
|
+
long_description_content_type="text/markdown", # Optional (see note above)
|
|
37
|
+
url="http://bonvinlab.org/pdb-tools", # Optional
|
|
38
|
+
author="Joao Rodrigues", # Optional
|
|
39
|
+
author_email="j.p.g.l.m.rodrigues@gmail.com", # Optional
|
|
40
|
+
license="Apache Software License, version 2",
|
|
41
|
+
classifiers=[
|
|
42
|
+
"Development Status :: 5 - Production/Stable",
|
|
43
|
+
"Intended Audience :: Science/Research",
|
|
44
|
+
"Topic :: Scientific/Engineering",
|
|
45
|
+
"Topic :: Scientific/Engineering :: Chemistry",
|
|
46
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
47
|
+
"Programming Language :: Python :: 3.9",
|
|
48
|
+
"Programming Language :: Python :: 3.10",
|
|
49
|
+
"Programming Language :: Python :: 3.11",
|
|
50
|
+
"Programming Language :: Python :: 3.12",
|
|
51
|
+
"Programming Language :: Python :: 3.13",
|
|
52
|
+
"Programming Language :: Python :: 3.14",
|
|
64
53
|
],
|
|
65
|
-
|
|
66
|
-
keywords='bioinformatics protein structural-biology pdb', # Optional
|
|
67
|
-
|
|
54
|
+
keywords="bioinformatics protein structural-biology pdb", # Optional
|
|
68
55
|
# You can just specify package directories manually here if your project is
|
|
69
56
|
# simple. Or you can use find_packages().
|
|
70
57
|
#
|
|
@@ -75,7 +62,6 @@ setup(
|
|
|
75
62
|
# py_modules=["my_module"],
|
|
76
63
|
#
|
|
77
64
|
packages=find_packages(), # Required
|
|
78
|
-
|
|
79
65
|
# To provide executable scripts, use entry points in preference to the
|
|
80
66
|
# "scripts" keyword. Entry points provide cross-platform support and allow
|
|
81
67
|
# `pip` to create the appropriate form of executable for the target
|
|
@@ -84,11 +70,9 @@ setup(
|
|
|
84
70
|
# For example, the following would provide a command called `sample` which
|
|
85
71
|
# executes the function `main` from this package when invoked:
|
|
86
72
|
entry_points={ # Optional
|
|
87
|
-
|
|
73
|
+
"console_scripts": bin_py,
|
|
88
74
|
},
|
|
89
|
-
|
|
90
75
|
# scripts=[path.join('bin', f) for f in listdir(path.join(here, 'bin'))],
|
|
91
|
-
|
|
92
76
|
# List additional URLs that are relevant to your project as a dict.
|
|
93
77
|
#
|
|
94
78
|
# This field corresponds to the "Project-URL" metadata fields:
|
|
@@ -99,10 +83,9 @@ setup(
|
|
|
99
83
|
# maintainers, and where to support the project financially. The key is
|
|
100
84
|
# what's used to render the link text on PyPI.
|
|
101
85
|
project_urls={ # Optional
|
|
102
|
-
|
|
103
|
-
|
|
86
|
+
"Bug Reports": "https://github.com/haddocking/pdb-tools/issues",
|
|
87
|
+
"Source": "https://github.com/haddocking/pdb-tools",
|
|
104
88
|
},
|
|
105
|
-
|
|
106
89
|
# Test Suite
|
|
107
|
-
test_suite=
|
|
90
|
+
test_suite="tests.test_all",
|
|
108
91
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|