biotite 0.41.1__cp310-cp310-win_amd64.whl → 1.0.0__cp310-cp310-win_amd64.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.
Potentially problematic release.
This version of biotite might be problematic. Click here for more details.
- biotite/__init__.py +2 -3
- biotite/application/__init__.py +36 -10
- biotite/application/application.py +22 -11
- biotite/application/autodock/__init__.py +1 -1
- biotite/application/autodock/app.py +74 -79
- biotite/application/blast/__init__.py +1 -1
- biotite/application/blast/alignment.py +19 -10
- biotite/application/blast/webapp.py +92 -85
- biotite/application/clustalo/__init__.py +1 -1
- biotite/application/clustalo/app.py +46 -61
- biotite/application/dssp/__init__.py +1 -1
- biotite/application/dssp/app.py +8 -11
- biotite/application/localapp.py +62 -60
- biotite/application/mafft/__init__.py +1 -1
- biotite/application/mafft/app.py +16 -22
- biotite/application/msaapp.py +78 -89
- biotite/application/muscle/__init__.py +1 -1
- biotite/application/muscle/app3.py +50 -64
- biotite/application/muscle/app5.py +23 -31
- biotite/application/sra/__init__.py +1 -1
- biotite/application/sra/app.py +64 -68
- biotite/application/tantan/__init__.py +1 -1
- biotite/application/tantan/app.py +22 -45
- biotite/application/util.py +7 -9
- biotite/application/viennarna/rnaalifold.py +34 -28
- biotite/application/viennarna/rnafold.py +24 -39
- biotite/application/viennarna/rnaplot.py +36 -21
- biotite/application/viennarna/util.py +17 -12
- biotite/application/webapp.py +13 -14
- biotite/copyable.py +13 -13
- biotite/database/__init__.py +1 -1
- biotite/database/entrez/__init__.py +1 -1
- biotite/database/entrez/check.py +2 -3
- biotite/database/entrez/dbnames.py +7 -5
- biotite/database/entrez/download.py +55 -49
- biotite/database/entrez/key.py +1 -1
- biotite/database/entrez/query.py +62 -23
- biotite/database/error.py +2 -1
- biotite/database/pubchem/__init__.py +1 -1
- biotite/database/pubchem/download.py +43 -45
- biotite/database/pubchem/error.py +2 -2
- biotite/database/pubchem/query.py +34 -31
- biotite/database/pubchem/throttle.py +3 -4
- biotite/database/rcsb/__init__.py +1 -1
- biotite/database/rcsb/download.py +44 -52
- biotite/database/rcsb/query.py +85 -80
- biotite/database/uniprot/check.py +6 -3
- biotite/database/uniprot/download.py +6 -11
- biotite/database/uniprot/query.py +115 -31
- biotite/file.py +12 -31
- biotite/sequence/__init__.py +16 -5
- biotite/sequence/align/__init__.py +160 -6
- biotite/sequence/align/alignment.py +99 -90
- biotite/sequence/align/banded.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/buckets.py +12 -10
- biotite/sequence/align/cigar.py +43 -52
- biotite/sequence/align/kmeralphabet.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/kmeralphabet.pyx +55 -51
- biotite/sequence/align/kmersimilarity.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.pyx +3 -2
- biotite/sequence/align/localgapped.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/matrix.py +81 -82
- biotite/sequence/align/multiple.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/multiple.pyx +35 -35
- biotite/sequence/align/pairwise.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.pyx +12 -4
- biotite/sequence/align/selector.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.pyx +52 -54
- biotite/sequence/align/statistics.py +32 -33
- biotite/sequence/align/tracetable.cp310-win_amd64.pyd +0 -0
- biotite/sequence/alphabet.py +112 -126
- biotite/sequence/annotation.py +78 -77
- biotite/sequence/codec.cp310-win_amd64.pyd +0 -0
- biotite/sequence/codon.py +90 -79
- biotite/sequence/graphics/__init__.py +1 -1
- biotite/sequence/graphics/alignment.py +184 -103
- biotite/sequence/graphics/colorschemes.py +10 -12
- biotite/sequence/graphics/dendrogram.py +79 -34
- biotite/sequence/graphics/features.py +133 -99
- biotite/sequence/graphics/logo.py +22 -28
- biotite/sequence/graphics/plasmid.py +229 -178
- biotite/sequence/io/fasta/__init__.py +1 -1
- biotite/sequence/io/fasta/convert.py +44 -33
- biotite/sequence/io/fasta/file.py +42 -55
- biotite/sequence/io/fastq/__init__.py +1 -1
- biotite/sequence/io/fastq/convert.py +11 -14
- biotite/sequence/io/fastq/file.py +68 -112
- biotite/sequence/io/genbank/__init__.py +2 -2
- biotite/sequence/io/genbank/annotation.py +12 -20
- biotite/sequence/io/genbank/file.py +74 -76
- biotite/sequence/io/genbank/metadata.py +74 -62
- biotite/sequence/io/genbank/sequence.py +13 -14
- biotite/sequence/io/general.py +39 -30
- biotite/sequence/io/gff/__init__.py +2 -2
- biotite/sequence/io/gff/convert.py +10 -15
- biotite/sequence/io/gff/file.py +81 -65
- biotite/sequence/phylo/__init__.py +1 -1
- biotite/sequence/phylo/nj.cp310-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.cp310-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.cp310-win_amd64.pyd +0 -0
- biotite/sequence/profile.py +57 -28
- biotite/sequence/search.py +17 -15
- biotite/sequence/seqtypes.py +200 -164
- biotite/sequence/sequence.py +64 -64
- biotite/structure/__init__.py +3 -3
- biotite/structure/atoms.py +226 -240
- biotite/structure/basepairs.py +260 -271
- biotite/structure/bonds.cp310-win_amd64.pyd +0 -0
- biotite/structure/bonds.pyx +88 -100
- biotite/structure/box.py +67 -71
- biotite/structure/celllist.cp310-win_amd64.pyd +0 -0
- biotite/structure/chains.py +55 -39
- biotite/structure/charges.cp310-win_amd64.pyd +0 -0
- biotite/structure/compare.py +32 -32
- biotite/structure/density.py +13 -18
- biotite/structure/dotbracket.py +20 -22
- biotite/structure/error.py +10 -2
- biotite/structure/filter.py +82 -77
- biotite/structure/geometry.py +130 -119
- biotite/structure/graphics/atoms.py +60 -43
- biotite/structure/graphics/rna.py +81 -68
- biotite/structure/hbond.py +112 -93
- biotite/structure/info/__init__.py +0 -2
- biotite/structure/info/atoms.py +10 -11
- biotite/structure/info/bonds.py +41 -43
- biotite/structure/info/ccd.py +21 -7
- biotite/structure/info/groups.py +10 -15
- biotite/structure/info/masses.py +5 -10
- biotite/structure/info/misc.py +1 -1
- biotite/structure/info/radii.py +20 -20
- biotite/structure/info/standardize.py +15 -26
- biotite/structure/integrity.py +18 -71
- biotite/structure/io/__init__.py +3 -4
- biotite/structure/io/dcd/__init__.py +1 -1
- biotite/structure/io/dcd/file.py +22 -20
- biotite/structure/io/general.py +47 -61
- biotite/structure/io/gro/__init__.py +1 -1
- biotite/structure/io/gro/file.py +73 -72
- biotite/structure/io/mol/__init__.py +1 -1
- biotite/structure/io/mol/convert.py +8 -11
- biotite/structure/io/mol/ctab.py +37 -36
- biotite/structure/io/mol/header.py +14 -10
- biotite/structure/io/mol/mol.py +9 -53
- biotite/structure/io/mol/sdf.py +47 -50
- biotite/structure/io/netcdf/__init__.py +1 -1
- biotite/structure/io/netcdf/file.py +24 -23
- biotite/structure/io/pdb/__init__.py +1 -1
- biotite/structure/io/pdb/convert.py +32 -20
- biotite/structure/io/pdb/file.py +151 -172
- biotite/structure/io/pdb/hybrid36.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/pdbqt/__init__.py +1 -1
- biotite/structure/io/pdbqt/convert.py +17 -11
- biotite/structure/io/pdbqt/file.py +128 -80
- biotite/structure/io/pdbx/__init__.py +1 -2
- biotite/structure/io/pdbx/bcif.py +36 -52
- biotite/structure/io/pdbx/cif.py +64 -62
- biotite/structure/io/pdbx/component.py +10 -16
- biotite/structure/io/pdbx/convert.py +235 -246
- biotite/structure/io/pdbx/encoding.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/trajfile.py +76 -93
- biotite/structure/io/trr/__init__.py +1 -1
- biotite/structure/io/trr/file.py +12 -15
- biotite/structure/io/xtc/__init__.py +1 -1
- biotite/structure/io/xtc/file.py +11 -14
- biotite/structure/mechanics.py +9 -11
- biotite/structure/molecules.py +3 -4
- biotite/structure/pseudoknots.py +53 -67
- biotite/structure/rdf.py +23 -21
- biotite/structure/repair.py +137 -86
- biotite/structure/residues.py +26 -16
- biotite/structure/sasa.cp310-win_amd64.pyd +0 -0
- biotite/structure/{resutil.py → segments.py} +24 -23
- biotite/structure/sequence.py +10 -11
- biotite/structure/sse.py +100 -119
- biotite/structure/superimpose.py +39 -77
- biotite/structure/transform.py +97 -71
- biotite/structure/util.py +11 -13
- biotite/version.py +2 -2
- biotite/visualize.py +69 -55
- {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/METADATA +6 -6
- biotite-1.0.0.dist-info/RECORD +322 -0
- {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/WHEEL +1 -1
- biotite/structure/io/ctab.py +0 -72
- biotite/structure/io/mmtf/__init__.py +0 -21
- biotite/structure/io/mmtf/assembly.py +0 -214
- biotite/structure/io/mmtf/convertarray.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertarray.pyx +0 -341
- biotite/structure/io/mmtf/convertfile.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertfile.pyx +0 -501
- biotite/structure/io/mmtf/decode.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/decode.pyx +0 -152
- biotite/structure/io/mmtf/encode.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/encode.pyx +0 -183
- biotite/structure/io/mmtf/file.py +0 -233
- biotite/structure/io/npz/__init__.py +0 -20
- biotite/structure/io/npz/file.py +0 -152
- biotite/structure/io/pdbx/legacy.py +0 -267
- biotite/structure/io/tng/__init__.py +0 -13
- biotite/structure/io/tng/file.py +0 -46
- biotite/temp.py +0 -86
- biotite-0.41.1.dist-info/RECORD +0 -340
- {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
# This source code is part of the Biotite package and is distributed
|
|
2
|
-
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
|
3
|
-
# information.
|
|
4
|
-
|
|
5
|
-
__name__ = "biotite.structure.io.pdbx"
|
|
6
|
-
__author__ = "Patrick Kunzmann"
|
|
7
|
-
__all__ = ["PDBxFile"]
|
|
8
|
-
|
|
9
|
-
import copy
|
|
10
|
-
from collections.abc import MutableMapping
|
|
11
|
-
import warnings
|
|
12
|
-
from .cif import CIFFile, CIFBlock, CIFCategory, CIFColumn
|
|
13
|
-
from ....file import File, InvalidFileError
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class PDBxFile(File, MutableMapping):
|
|
17
|
-
"""
|
|
18
|
-
This class represents the legacy interface to CIF files.
|
|
19
|
-
|
|
20
|
-
The categories of the file can be accessed using the
|
|
21
|
-
:meth:`get_category()`/:meth:`set_category()` methods.
|
|
22
|
-
The content of each category is represented by a dictionary.
|
|
23
|
-
The dictionary contains the entry
|
|
24
|
-
(e.g. *label_entity_id* in *atom_site*) as key.
|
|
25
|
-
The corresponding values are either strings in *non-looped*
|
|
26
|
-
categories, or 1-D numpy arrays of string objects in case of
|
|
27
|
-
*looped* categories.
|
|
28
|
-
|
|
29
|
-
A category can be changed or added using :meth:`set_category()`:
|
|
30
|
-
If a string-valued dictionary is provided, a *non-looped* category
|
|
31
|
-
will be created; if an array-valued dictionary is given, a
|
|
32
|
-
*looped* category will be created. In case of arrays, it is
|
|
33
|
-
important that all arrays have the same size.
|
|
34
|
-
|
|
35
|
-
Alternatively, The content of this file can also be read/write
|
|
36
|
-
accessed using dictionary-like indexing:
|
|
37
|
-
You can either provide a data block and a category or only a
|
|
38
|
-
category, in which case the first data block is taken.
|
|
39
|
-
|
|
40
|
-
DEPRECATED: Use :class:`CIFFile` instead.
|
|
41
|
-
|
|
42
|
-
Notes
|
|
43
|
-
-----
|
|
44
|
-
This class is also able to detect and parse multiline entries in the
|
|
45
|
-
file. However, when writing a category no multiline values are used.
|
|
46
|
-
This could lead to long lines.
|
|
47
|
-
|
|
48
|
-
This class uses a lazy category dictionary creation: When reading
|
|
49
|
-
the file only the line positions of all categories are checked. The
|
|
50
|
-
time consuming task of dictionary creation is done when
|
|
51
|
-
:meth:`get_category()` is called.
|
|
52
|
-
|
|
53
|
-
Examples
|
|
54
|
-
--------
|
|
55
|
-
Read the file and get author names:
|
|
56
|
-
|
|
57
|
-
>>> import os.path
|
|
58
|
-
>>> file = PDBxFile.read(os.path.join(path_to_structures, "1l2y.cif"))
|
|
59
|
-
>>> author_dict = file.get_category("citation_author", block="1L2Y")
|
|
60
|
-
>>> print(author_dict["name"])
|
|
61
|
-
['Neidigh, J.W.' 'Fesinmeyer, R.M.' 'Andersen, N.H.']
|
|
62
|
-
|
|
63
|
-
Dictionary style indexing, no specification of data block:
|
|
64
|
-
|
|
65
|
-
>>> print(file["citation_author"]["name"])
|
|
66
|
-
['Neidigh, J.W.' 'Fesinmeyer, R.M.' 'Andersen, N.H.']
|
|
67
|
-
|
|
68
|
-
Get the structure from the file:
|
|
69
|
-
|
|
70
|
-
>>> arr = get_structure(file)
|
|
71
|
-
>>> print(type(arr).__name__)
|
|
72
|
-
AtomArrayStack
|
|
73
|
-
>>> arr = get_structure(file, model=1)
|
|
74
|
-
>>> print(type(arr).__name__)
|
|
75
|
-
AtomArray
|
|
76
|
-
|
|
77
|
-
Modify atom array and write it back into the file:
|
|
78
|
-
|
|
79
|
-
>>> arr_mod = rotate(arr, [1,2,3])
|
|
80
|
-
>>> set_structure(file, arr_mod)
|
|
81
|
-
>>> file.write(os.path.join(path_to_directory, "1l2y_mod.cif"))
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
def __init__(self):
|
|
85
|
-
warnings.warn(
|
|
86
|
-
"'PDBxFile' is deprecated, use 'CIFFile' instead",
|
|
87
|
-
DeprecationWarning
|
|
88
|
-
)
|
|
89
|
-
super().__init__()
|
|
90
|
-
self._cif_file = CIFFile()
|
|
91
|
-
|
|
92
|
-
@property
|
|
93
|
-
def cif_file(self):
|
|
94
|
-
return self._cif_file
|
|
95
|
-
|
|
96
|
-
@property
|
|
97
|
-
def lines(self):
|
|
98
|
-
return self._cif_file.lines
|
|
99
|
-
|
|
100
|
-
@classmethod
|
|
101
|
-
def read(cls, file):
|
|
102
|
-
"""
|
|
103
|
-
Read a PDBx/mmCIF file.
|
|
104
|
-
|
|
105
|
-
Parameters
|
|
106
|
-
----------
|
|
107
|
-
file : file-like object or str
|
|
108
|
-
The file to be read.
|
|
109
|
-
Alternatively a file path can be supplied.
|
|
110
|
-
|
|
111
|
-
Returns
|
|
112
|
-
-------
|
|
113
|
-
file_object : PDBxFile
|
|
114
|
-
The parsed file.
|
|
115
|
-
"""
|
|
116
|
-
pdbx_file = PDBxFile()
|
|
117
|
-
pdbx_file._cif_file = CIFFile.read(file)
|
|
118
|
-
return pdbx_file
|
|
119
|
-
|
|
120
|
-
def write(self, file):
|
|
121
|
-
self._cif_file.write(file)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def get_block_names(self):
|
|
125
|
-
"""
|
|
126
|
-
Get the names of all data blocks in the file.
|
|
127
|
-
|
|
128
|
-
Returns
|
|
129
|
-
-------
|
|
130
|
-
blocks : list
|
|
131
|
-
List of data block names.
|
|
132
|
-
"""
|
|
133
|
-
return sorted(self._cif_file.keys())
|
|
134
|
-
|
|
135
|
-
def get_category(self, category, block=None, expect_looped=False):
|
|
136
|
-
"""
|
|
137
|
-
Get the dictionary for a given category.
|
|
138
|
-
|
|
139
|
-
Parameters
|
|
140
|
-
----------
|
|
141
|
-
category : string
|
|
142
|
-
The name of the category. The leading underscore is omitted.
|
|
143
|
-
block : string, optional
|
|
144
|
-
The name of the data block. Default is the first
|
|
145
|
-
(and most times only) data block of the file.
|
|
146
|
-
expect_looped : bool, optional
|
|
147
|
-
If set to true, the returned dictionary will always contain
|
|
148
|
-
arrays (only if the category exists):
|
|
149
|
-
If the category is *non-looped*, each array will contain
|
|
150
|
-
only one element.
|
|
151
|
-
|
|
152
|
-
Returns
|
|
153
|
-
-------
|
|
154
|
-
category_dict : dict of (str or ndarray, dtype=str) or None
|
|
155
|
-
A entry keyed dictionary. The corresponding values are
|
|
156
|
-
strings or array of strings for *non-looped* and
|
|
157
|
-
*looped* categories, respectively.
|
|
158
|
-
Returns None, if the data block does not contain the given
|
|
159
|
-
category.
|
|
160
|
-
"""
|
|
161
|
-
if block is None:
|
|
162
|
-
try:
|
|
163
|
-
block = self.get_block_names()[0]
|
|
164
|
-
except IndexError:
|
|
165
|
-
raise InvalidFileError("File is empty")
|
|
166
|
-
|
|
167
|
-
if category not in self._cif_file[block]:
|
|
168
|
-
return None
|
|
169
|
-
|
|
170
|
-
category_dict = {}
|
|
171
|
-
for column_name, column in self._cif_file[block][category].items():
|
|
172
|
-
if not expect_looped and len(column) == 1:
|
|
173
|
-
category_dict[column_name] = column.as_item()
|
|
174
|
-
else:
|
|
175
|
-
category_dict[column_name] = column.as_array()
|
|
176
|
-
return category_dict
|
|
177
|
-
|
|
178
|
-
def set_category(self, category, category_dict, block=None):
|
|
179
|
-
"""
|
|
180
|
-
Set the content of a category.
|
|
181
|
-
|
|
182
|
-
If the category is already existing, all lines corresponding
|
|
183
|
-
to the category are replaced. Otherwise a new category is
|
|
184
|
-
created and the lines are appended at the end of the data block.
|
|
185
|
-
|
|
186
|
-
Parameters
|
|
187
|
-
----------
|
|
188
|
-
category : string
|
|
189
|
-
The name of the category. The leading underscore is omitted.
|
|
190
|
-
category_dict : dict
|
|
191
|
-
The category content. The dictionary must have strings
|
|
192
|
-
(subcategories) as keys and strings or :class:`ndarray`
|
|
193
|
-
objects as values.
|
|
194
|
-
block : string, optional
|
|
195
|
-
The name of the data block. Default is the first
|
|
196
|
-
(and most times only) data block of the file. If the
|
|
197
|
-
block is not contained in the file yet, a new block is
|
|
198
|
-
appended at the end of the file.
|
|
199
|
-
"""
|
|
200
|
-
if block is None:
|
|
201
|
-
try:
|
|
202
|
-
block = self.get_block_names()[0]
|
|
203
|
-
except IndexError:
|
|
204
|
-
raise InvalidFileError(
|
|
205
|
-
"File is empty, give an explicit data block"
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
if block not in self._cif_file:
|
|
209
|
-
self._cif_file = CIFBlock()
|
|
210
|
-
self._cif_file[block][category] = CIFCategory({
|
|
211
|
-
column_name: CIFColumn(array)
|
|
212
|
-
for column_name, array in category_dict.items()
|
|
213
|
-
})
|
|
214
|
-
|
|
215
|
-
def __copy_fill__(self, clone):
|
|
216
|
-
super().__copy_fill__(clone)
|
|
217
|
-
clone._cif_file = copy.deepcopy(self._cif_file)
|
|
218
|
-
|
|
219
|
-
def __setitem__(self, index, item):
|
|
220
|
-
block, category_name = self._full_index(index)
|
|
221
|
-
self.set_category(category_name, item, block=block)
|
|
222
|
-
|
|
223
|
-
def __getitem__(self, index):
|
|
224
|
-
block, category_name = self._full_index(index)
|
|
225
|
-
return self.get_category(category_name, block=block)
|
|
226
|
-
|
|
227
|
-
def __delitem__(self, index):
|
|
228
|
-
block, category_name = self._full_index(index)
|
|
229
|
-
del self._cif_file[block][category_name]
|
|
230
|
-
|
|
231
|
-
def __contains__(self, index):
|
|
232
|
-
block, category_name = self._full_index(index)
|
|
233
|
-
return (block, category_name) in self._categories
|
|
234
|
-
|
|
235
|
-
def __iter__(self):
|
|
236
|
-
try:
|
|
237
|
-
block = self.get_block_names()[0]
|
|
238
|
-
except IndexError:
|
|
239
|
-
raise InvalidFileError(
|
|
240
|
-
"File is empty, give an explicit data block"
|
|
241
|
-
)
|
|
242
|
-
|
|
243
|
-
return iter(self._cif_file[block])
|
|
244
|
-
|
|
245
|
-
def __len__(self):
|
|
246
|
-
try:
|
|
247
|
-
block = self.get_block_names()[0]
|
|
248
|
-
except IndexError:
|
|
249
|
-
raise InvalidFileError(
|
|
250
|
-
"File is empty, give an explicit data block"
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
return len(self._cif_file[block])
|
|
254
|
-
|
|
255
|
-
def _full_index(self, index):
|
|
256
|
-
"""
|
|
257
|
-
Converts a an integer or tuple index into a block and a category
|
|
258
|
-
name.
|
|
259
|
-
"""
|
|
260
|
-
if isinstance(index, tuple):
|
|
261
|
-
return index[0], index[1]
|
|
262
|
-
elif isinstance(index, str):
|
|
263
|
-
return self.get_block_names()[0], index
|
|
264
|
-
else:
|
|
265
|
-
raise TypeError(
|
|
266
|
-
f"'{type(index).__name__}' is an invalid index type"
|
|
267
|
-
)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# This source code is part of the Biotite package and is distributed
|
|
2
|
-
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
|
3
|
-
# information.
|
|
4
|
-
|
|
5
|
-
"""
|
|
6
|
-
This subpackage is used for reading and writing trajectories in the
|
|
7
|
-
compressed *Gromacs* TNG format.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
__name__ = "biotite.structure.io.tng"
|
|
11
|
-
__author__ = "Patrick Kunzmann"
|
|
12
|
-
|
|
13
|
-
from .file import *
|
biotite/structure/io/tng/file.py
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# This source code is part of the Biotite package and is distributed
|
|
2
|
-
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
|
3
|
-
# information.
|
|
4
|
-
|
|
5
|
-
__name__ = "biotite.structure.io.tng"
|
|
6
|
-
__author__ = "Patrick Kunzmann"
|
|
7
|
-
__all__ = ["TNGFile"]
|
|
8
|
-
|
|
9
|
-
import numpy as np
|
|
10
|
-
from ..trajfile import TrajectoryFile
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class TNGFile(TrajectoryFile):
|
|
14
|
-
"""
|
|
15
|
-
This file class represents a TNG trajectory file.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
@classmethod
|
|
19
|
-
def traj_type(cls):
|
|
20
|
-
import mdtraj.formats as traj
|
|
21
|
-
return traj.TNGTrajectoryFile
|
|
22
|
-
|
|
23
|
-
@classmethod
|
|
24
|
-
def process_read_values(cls, read_values):
|
|
25
|
-
# nm to Angstrom
|
|
26
|
-
coord = read_values[0] * 10
|
|
27
|
-
box = read_values[2]
|
|
28
|
-
if box is not None:
|
|
29
|
-
box *= 10
|
|
30
|
-
time = read_values[1]
|
|
31
|
-
return coord, box, time
|
|
32
|
-
|
|
33
|
-
@classmethod
|
|
34
|
-
def prepare_write_values(cls, coord, box, time):
|
|
35
|
-
# Angstrom to nm
|
|
36
|
-
xyz = np.divide(coord, 10, dtype=np.float32) \
|
|
37
|
-
if coord is not None else None
|
|
38
|
-
time = time.astype(np.float32, copy=False) \
|
|
39
|
-
if time is not None else None
|
|
40
|
-
box = np.divide(box, 10, dtype=np.float32) \
|
|
41
|
-
if box is not None else None
|
|
42
|
-
return {
|
|
43
|
-
"xyz" : xyz,
|
|
44
|
-
"box" : box,
|
|
45
|
-
"time" : time,
|
|
46
|
-
}
|
biotite/temp.py
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# This source code is part of the Biotite package and is distributed
|
|
2
|
-
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
|
3
|
-
# information.
|
|
4
|
-
|
|
5
|
-
__name__ = "biotite"
|
|
6
|
-
__author__ = "Patrick Kunzmann"
|
|
7
|
-
__all__ = ["temp_file", "temp_dir"]
|
|
8
|
-
|
|
9
|
-
import shutil
|
|
10
|
-
import atexit
|
|
11
|
-
import os
|
|
12
|
-
import tempfile
|
|
13
|
-
import warnings
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_temp_dir = ""
|
|
17
|
-
|
|
18
|
-
def _create_temp_dir():
|
|
19
|
-
global _temp_dir
|
|
20
|
-
if _temp_dir == "":
|
|
21
|
-
cwd = os.getcwd()
|
|
22
|
-
_temp_dir = os.path.join(cwd, ".biotitetemp")
|
|
23
|
-
if not os.path.isdir(_temp_dir):
|
|
24
|
-
os.makedirs(_temp_dir)
|
|
25
|
-
atexit.register(_delete_temp)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def _delete_temp():
|
|
29
|
-
global _temp_dir
|
|
30
|
-
# Condition only for savety reasons
|
|
31
|
-
if ".biotitetemp" in _temp_dir:
|
|
32
|
-
shutil.rmtree(_temp_dir)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def temp_file(suffix=""):
|
|
36
|
-
"""
|
|
37
|
-
Get a file path to a temporary file.
|
|
38
|
-
|
|
39
|
-
All temporary files will be deleted after script execution.
|
|
40
|
-
|
|
41
|
-
DEPRECATED: Please use the :mod:`tempfile` module from the
|
|
42
|
-
standard library.
|
|
43
|
-
|
|
44
|
-
Parameters
|
|
45
|
-
----------
|
|
46
|
-
suffix : str
|
|
47
|
-
Suffix of the file.
|
|
48
|
-
By default no suffix will be appended.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
temp_file_name : str
|
|
53
|
-
a file name in the temporary directory.
|
|
54
|
-
"""
|
|
55
|
-
global _temp_dir
|
|
56
|
-
warnings.warn(
|
|
57
|
-
"Please use the :mod:`tempfile` module from the standard library",
|
|
58
|
-
DeprecationWarning
|
|
59
|
-
)
|
|
60
|
-
_create_temp_dir()
|
|
61
|
-
if suffix != "" and not suffix.startswith("."):
|
|
62
|
-
suffix = "." + suffix
|
|
63
|
-
return tempfile.mktemp(suffix=suffix, dir=_temp_dir)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def temp_dir():
|
|
67
|
-
"""
|
|
68
|
-
Get the temporary directory path.
|
|
69
|
-
|
|
70
|
-
The temporary directory will be deleted after script execution.
|
|
71
|
-
|
|
72
|
-
DEPRECATED: Please use the :mod:`tempfile` module from the
|
|
73
|
-
standard library.
|
|
74
|
-
|
|
75
|
-
Returns
|
|
76
|
-
-------
|
|
77
|
-
temp_dir : str
|
|
78
|
-
Path of the temporary directory.
|
|
79
|
-
"""
|
|
80
|
-
global _temp_dir
|
|
81
|
-
warnings.warn(
|
|
82
|
-
"Please use the :mod:`tempfile` module from the standard library",
|
|
83
|
-
DeprecationWarning
|
|
84
|
-
)
|
|
85
|
-
_create_temp_dir()
|
|
86
|
-
return _temp_dir
|