biotite 1.6.0__cp314-cp314-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.
- biotite/__init__.py +18 -0
- biotite/application/__init__.py +69 -0
- biotite/application/application.py +276 -0
- biotite/application/autodock/__init__.py +12 -0
- biotite/application/autodock/app.py +500 -0
- biotite/application/blast/__init__.py +14 -0
- biotite/application/blast/alignment.py +92 -0
- biotite/application/blast/webapp.py +426 -0
- biotite/application/clustalo/__init__.py +12 -0
- biotite/application/clustalo/app.py +223 -0
- biotite/application/dssp/__init__.py +12 -0
- biotite/application/dssp/app.py +216 -0
- biotite/application/localapp.py +342 -0
- biotite/application/mafft/__init__.py +12 -0
- biotite/application/mafft/app.py +116 -0
- biotite/application/msaapp.py +363 -0
- biotite/application/muscle/__init__.py +13 -0
- biotite/application/muscle/app3.py +227 -0
- biotite/application/muscle/app5.py +163 -0
- biotite/application/sra/__init__.py +18 -0
- biotite/application/sra/app.py +447 -0
- biotite/application/tantan/__init__.py +12 -0
- biotite/application/tantan/app.py +199 -0
- biotite/application/util.py +77 -0
- biotite/application/viennarna/__init__.py +18 -0
- biotite/application/viennarna/rnaalifold.py +310 -0
- biotite/application/viennarna/rnafold.py +254 -0
- biotite/application/viennarna/rnaplot.py +208 -0
- biotite/application/viennarna/util.py +77 -0
- biotite/application/webapp.py +76 -0
- biotite/copyable.py +71 -0
- biotite/database/__init__.py +23 -0
- biotite/database/afdb/__init__.py +12 -0
- biotite/database/afdb/download.py +202 -0
- biotite/database/entrez/__init__.py +15 -0
- biotite/database/entrez/check.py +66 -0
- biotite/database/entrez/dbnames.py +101 -0
- biotite/database/entrez/download.py +224 -0
- biotite/database/entrez/key.py +44 -0
- biotite/database/entrez/query.py +263 -0
- biotite/database/error.py +16 -0
- biotite/database/pubchem/__init__.py +21 -0
- biotite/database/pubchem/download.py +259 -0
- biotite/database/pubchem/error.py +30 -0
- biotite/database/pubchem/query.py +819 -0
- biotite/database/pubchem/throttle.py +98 -0
- biotite/database/rcsb/__init__.py +13 -0
- biotite/database/rcsb/download.py +191 -0
- biotite/database/rcsb/query.py +963 -0
- biotite/database/uniprot/__init__.py +13 -0
- biotite/database/uniprot/check.py +40 -0
- biotite/database/uniprot/download.py +127 -0
- biotite/database/uniprot/query.py +292 -0
- biotite/file.py +244 -0
- biotite/interface/__init__.py +19 -0
- biotite/interface/openmm/__init__.py +20 -0
- biotite/interface/openmm/state.py +93 -0
- biotite/interface/openmm/system.py +227 -0
- biotite/interface/pymol/__init__.py +201 -0
- biotite/interface/pymol/cgo.py +346 -0
- biotite/interface/pymol/convert.py +185 -0
- biotite/interface/pymol/display.py +267 -0
- biotite/interface/pymol/object.py +1228 -0
- biotite/interface/pymol/shapes.py +178 -0
- biotite/interface/pymol/startup.py +169 -0
- biotite/interface/rdkit/__init__.py +19 -0
- biotite/interface/rdkit/mol.py +491 -0
- biotite/interface/version.py +94 -0
- biotite/interface/warning.py +19 -0
- biotite/sequence/__init__.py +84 -0
- biotite/sequence/align/__init__.py +199 -0
- biotite/sequence/align/alignment.py +763 -0
- biotite/sequence/align/banded.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/banded.pyx +652 -0
- biotite/sequence/align/buckets.py +71 -0
- biotite/sequence/align/cigar.py +425 -0
- biotite/sequence/align/kmeralphabet.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/kmeralphabet.pyx +595 -0
- biotite/sequence/align/kmersimilarity.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/kmersimilarity.pyx +233 -0
- biotite/sequence/align/kmertable.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.pyx +3411 -0
- biotite/sequence/align/localgapped.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/localgapped.pyx +892 -0
- biotite/sequence/align/localungapped.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.pyx +279 -0
- biotite/sequence/align/matrix.py +631 -0
- biotite/sequence/align/matrix_data/3Di.mat +24 -0
- biotite/sequence/align/matrix_data/BLOSUM100.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM30.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM35.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM40.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM45.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM50.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM50_13p.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM50_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM50_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM55.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM60.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM62.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM62_13p.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM62_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM62_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM65.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM70.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM75.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM80.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM85.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM90.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUMN.mat +31 -0
- biotite/sequence/align/matrix_data/CorBLOSUM49_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM57_13p.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM57_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM61_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM66_13p.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM67_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/DAYHOFF.mat +32 -0
- biotite/sequence/align/matrix_data/GONNET.mat +26 -0
- biotite/sequence/align/matrix_data/IDENTITY.mat +25 -0
- biotite/sequence/align/matrix_data/MATCH.mat +25 -0
- biotite/sequence/align/matrix_data/NUC.mat +25 -0
- biotite/sequence/align/matrix_data/PAM10.mat +34 -0
- biotite/sequence/align/matrix_data/PAM100.mat +34 -0
- biotite/sequence/align/matrix_data/PAM110.mat +34 -0
- biotite/sequence/align/matrix_data/PAM120.mat +34 -0
- biotite/sequence/align/matrix_data/PAM130.mat +34 -0
- biotite/sequence/align/matrix_data/PAM140.mat +34 -0
- biotite/sequence/align/matrix_data/PAM150.mat +34 -0
- biotite/sequence/align/matrix_data/PAM160.mat +34 -0
- biotite/sequence/align/matrix_data/PAM170.mat +34 -0
- biotite/sequence/align/matrix_data/PAM180.mat +34 -0
- biotite/sequence/align/matrix_data/PAM190.mat +34 -0
- biotite/sequence/align/matrix_data/PAM20.mat +34 -0
- biotite/sequence/align/matrix_data/PAM200.mat +34 -0
- biotite/sequence/align/matrix_data/PAM210.mat +34 -0
- biotite/sequence/align/matrix_data/PAM220.mat +34 -0
- biotite/sequence/align/matrix_data/PAM230.mat +34 -0
- biotite/sequence/align/matrix_data/PAM240.mat +34 -0
- biotite/sequence/align/matrix_data/PAM250.mat +34 -0
- biotite/sequence/align/matrix_data/PAM260.mat +34 -0
- biotite/sequence/align/matrix_data/PAM270.mat +34 -0
- biotite/sequence/align/matrix_data/PAM280.mat +34 -0
- biotite/sequence/align/matrix_data/PAM290.mat +34 -0
- biotite/sequence/align/matrix_data/PAM30.mat +34 -0
- biotite/sequence/align/matrix_data/PAM300.mat +34 -0
- biotite/sequence/align/matrix_data/PAM310.mat +34 -0
- biotite/sequence/align/matrix_data/PAM320.mat +34 -0
- biotite/sequence/align/matrix_data/PAM330.mat +34 -0
- biotite/sequence/align/matrix_data/PAM340.mat +34 -0
- biotite/sequence/align/matrix_data/PAM350.mat +34 -0
- biotite/sequence/align/matrix_data/PAM360.mat +34 -0
- biotite/sequence/align/matrix_data/PAM370.mat +34 -0
- biotite/sequence/align/matrix_data/PAM380.mat +34 -0
- biotite/sequence/align/matrix_data/PAM390.mat +34 -0
- biotite/sequence/align/matrix_data/PAM40.mat +34 -0
- biotite/sequence/align/matrix_data/PAM400.mat +34 -0
- biotite/sequence/align/matrix_data/PAM410.mat +34 -0
- biotite/sequence/align/matrix_data/PAM420.mat +34 -0
- biotite/sequence/align/matrix_data/PAM430.mat +34 -0
- biotite/sequence/align/matrix_data/PAM440.mat +34 -0
- biotite/sequence/align/matrix_data/PAM450.mat +34 -0
- biotite/sequence/align/matrix_data/PAM460.mat +34 -0
- biotite/sequence/align/matrix_data/PAM470.mat +34 -0
- biotite/sequence/align/matrix_data/PAM480.mat +34 -0
- biotite/sequence/align/matrix_data/PAM490.mat +34 -0
- biotite/sequence/align/matrix_data/PAM50.mat +34 -0
- biotite/sequence/align/matrix_data/PAM500.mat +34 -0
- biotite/sequence/align/matrix_data/PAM60.mat +34 -0
- biotite/sequence/align/matrix_data/PAM70.mat +34 -0
- biotite/sequence/align/matrix_data/PAM80.mat +34 -0
- biotite/sequence/align/matrix_data/PAM90.mat +34 -0
- biotite/sequence/align/matrix_data/PB.license +21 -0
- biotite/sequence/align/matrix_data/PB.mat +18 -0
- biotite/sequence/align/matrix_data/RBLOSUM52_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM59_13p.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM59_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM64_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM69_13p.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM69_14.3.mat +25 -0
- biotite/sequence/align/multiple.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/multiple.pyx +619 -0
- biotite/sequence/align/pairwise.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/pairwise.pyx +585 -0
- biotite/sequence/align/permutation.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.pyx +313 -0
- biotite/sequence/align/primes.txt +821 -0
- biotite/sequence/align/selector.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.pyx +954 -0
- biotite/sequence/align/statistics.py +264 -0
- biotite/sequence/align/tracetable.cp314-win_amd64.pyd +0 -0
- biotite/sequence/align/tracetable.pxd +64 -0
- biotite/sequence/align/tracetable.pyx +370 -0
- biotite/sequence/alphabet.py +555 -0
- biotite/sequence/annotation.py +836 -0
- biotite/sequence/codec.cp314-win_amd64.pyd +0 -0
- biotite/sequence/codec.pyx +155 -0
- biotite/sequence/codon.py +476 -0
- biotite/sequence/codon_tables.txt +202 -0
- biotite/sequence/graphics/__init__.py +33 -0
- biotite/sequence/graphics/alignment.py +1101 -0
- biotite/sequence/graphics/color_schemes/3di_flower.json +48 -0
- biotite/sequence/graphics/color_schemes/autumn.json +51 -0
- biotite/sequence/graphics/color_schemes/blossom.json +51 -0
- biotite/sequence/graphics/color_schemes/clustalx_dna.json +11 -0
- biotite/sequence/graphics/color_schemes/clustalx_protein.json +28 -0
- biotite/sequence/graphics/color_schemes/flower.json +51 -0
- biotite/sequence/graphics/color_schemes/jalview_buried.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_hydrophobicity.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_prop_helix.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_prop_strand.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_prop_turn.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_taylor.json +28 -0
- biotite/sequence/graphics/color_schemes/jalview_zappo.json +28 -0
- biotite/sequence/graphics/color_schemes/ocean.json +51 -0
- biotite/sequence/graphics/color_schemes/pb_flower.json +40 -0
- biotite/sequence/graphics/color_schemes/rainbow_dna.json +11 -0
- biotite/sequence/graphics/color_schemes/rainbow_protein.json +30 -0
- biotite/sequence/graphics/color_schemes/spring.json +51 -0
- biotite/sequence/graphics/color_schemes/sunset.json +51 -0
- biotite/sequence/graphics/color_schemes/wither.json +51 -0
- biotite/sequence/graphics/colorschemes.py +170 -0
- biotite/sequence/graphics/dendrogram.py +231 -0
- biotite/sequence/graphics/features.py +544 -0
- biotite/sequence/graphics/logo.py +102 -0
- biotite/sequence/graphics/plasmid.py +712 -0
- biotite/sequence/io/__init__.py +12 -0
- biotite/sequence/io/fasta/__init__.py +22 -0
- biotite/sequence/io/fasta/convert.py +462 -0
- biotite/sequence/io/fasta/file.py +265 -0
- biotite/sequence/io/fastq/__init__.py +19 -0
- biotite/sequence/io/fastq/convert.py +117 -0
- biotite/sequence/io/fastq/file.py +507 -0
- biotite/sequence/io/genbank/__init__.py +17 -0
- biotite/sequence/io/genbank/annotation.py +269 -0
- biotite/sequence/io/genbank/file.py +573 -0
- biotite/sequence/io/genbank/metadata.py +336 -0
- biotite/sequence/io/genbank/sequence.py +173 -0
- biotite/sequence/io/general.py +201 -0
- biotite/sequence/io/gff/__init__.py +26 -0
- biotite/sequence/io/gff/convert.py +128 -0
- biotite/sequence/io/gff/file.py +449 -0
- biotite/sequence/phylo/__init__.py +36 -0
- biotite/sequence/phylo/nj.cp314-win_amd64.pyd +0 -0
- biotite/sequence/phylo/nj.pyx +221 -0
- biotite/sequence/phylo/tree.cp314-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.pyx +1169 -0
- biotite/sequence/phylo/upgma.cp314-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.pyx +164 -0
- biotite/sequence/profile.py +561 -0
- biotite/sequence/search.py +117 -0
- biotite/sequence/seqtypes.py +720 -0
- biotite/sequence/sequence.py +373 -0
- biotite/setup_ccd.py +197 -0
- biotite/structure/__init__.py +135 -0
- biotite/structure/alphabet/__init__.py +25 -0
- biotite/structure/alphabet/encoder.py +332 -0
- biotite/structure/alphabet/encoder_weights_3di.kerasify +0 -0
- biotite/structure/alphabet/i3d.py +109 -0
- biotite/structure/alphabet/layers.py +86 -0
- biotite/structure/alphabet/pb.license +21 -0
- biotite/structure/alphabet/pb.py +170 -0
- biotite/structure/alphabet/unkerasify.py +128 -0
- biotite/structure/atoms.py +1596 -0
- biotite/structure/basepairs.py +1403 -0
- biotite/structure/bonds.cp314-win_amd64.pyd +0 -0
- biotite/structure/bonds.pyx +2036 -0
- biotite/structure/box.py +724 -0
- biotite/structure/celllist.cp314-win_amd64.pyd +0 -0
- biotite/structure/celllist.pyx +864 -0
- biotite/structure/chains.py +310 -0
- biotite/structure/charges.cp314-win_amd64.pyd +0 -0
- biotite/structure/charges.pyx +521 -0
- biotite/structure/compare.py +683 -0
- biotite/structure/density.py +109 -0
- biotite/structure/dotbracket.py +213 -0
- biotite/structure/error.py +39 -0
- biotite/structure/filter.py +646 -0
- biotite/structure/geometry.py +817 -0
- biotite/structure/graphics/__init__.py +13 -0
- biotite/structure/graphics/atoms.py +243 -0
- biotite/structure/graphics/rna.py +298 -0
- biotite/structure/hbond.py +426 -0
- biotite/structure/info/__init__.py +24 -0
- biotite/structure/info/atom_masses.json +121 -0
- biotite/structure/info/atoms.py +98 -0
- biotite/structure/info/bonds.py +149 -0
- biotite/structure/info/ccd.py +200 -0
- biotite/structure/info/components.bcif +0 -0
- biotite/structure/info/groups.py +128 -0
- biotite/structure/info/masses.py +121 -0
- biotite/structure/info/misc.py +137 -0
- biotite/structure/info/radii.py +267 -0
- biotite/structure/info/standardize.py +185 -0
- biotite/structure/integrity.py +213 -0
- biotite/structure/io/__init__.py +29 -0
- biotite/structure/io/dcd/__init__.py +13 -0
- biotite/structure/io/dcd/file.py +67 -0
- biotite/structure/io/general.py +243 -0
- biotite/structure/io/gro/__init__.py +14 -0
- biotite/structure/io/gro/file.py +343 -0
- biotite/structure/io/mol/__init__.py +20 -0
- biotite/structure/io/mol/convert.py +112 -0
- biotite/structure/io/mol/ctab.py +420 -0
- biotite/structure/io/mol/header.py +120 -0
- biotite/structure/io/mol/mol.py +149 -0
- biotite/structure/io/mol/sdf.py +940 -0
- biotite/structure/io/netcdf/__init__.py +13 -0
- biotite/structure/io/netcdf/file.py +64 -0
- biotite/structure/io/pdb/__init__.py +20 -0
- biotite/structure/io/pdb/convert.py +389 -0
- biotite/structure/io/pdb/file.py +1380 -0
- biotite/structure/io/pdb/hybrid36.cp314-win_amd64.pyd +0 -0
- biotite/structure/io/pdb/hybrid36.pyx +242 -0
- biotite/structure/io/pdbqt/__init__.py +15 -0
- biotite/structure/io/pdbqt/convert.py +113 -0
- biotite/structure/io/pdbqt/file.py +688 -0
- biotite/structure/io/pdbx/__init__.py +23 -0
- biotite/structure/io/pdbx/bcif.py +674 -0
- biotite/structure/io/pdbx/cif.py +1091 -0
- biotite/structure/io/pdbx/component.py +251 -0
- biotite/structure/io/pdbx/compress.py +362 -0
- biotite/structure/io/pdbx/convert.py +2122 -0
- biotite/structure/io/pdbx/encoding.cp314-win_amd64.pyd +0 -0
- biotite/structure/io/pdbx/encoding.pyx +1078 -0
- biotite/structure/io/trajfile.py +696 -0
- biotite/structure/io/trr/__init__.py +13 -0
- biotite/structure/io/trr/file.py +43 -0
- biotite/structure/io/util.py +38 -0
- biotite/structure/io/xtc/__init__.py +13 -0
- biotite/structure/io/xtc/file.py +43 -0
- biotite/structure/mechanics.py +72 -0
- biotite/structure/molecules.py +337 -0
- biotite/structure/pseudoknots.py +622 -0
- biotite/structure/rdf.py +245 -0
- biotite/structure/repair.py +302 -0
- biotite/structure/residues.py +716 -0
- biotite/structure/rings.py +452 -0
- biotite/structure/sasa.cp314-win_amd64.pyd +0 -0
- biotite/structure/sasa.pyx +322 -0
- biotite/structure/segments.py +328 -0
- biotite/structure/sequence.py +110 -0
- biotite/structure/spacegroups.json +1567 -0
- biotite/structure/spacegroups.license +26 -0
- biotite/structure/sse.py +306 -0
- biotite/structure/superimpose.py +511 -0
- biotite/structure/tm.py +581 -0
- biotite/structure/transform.py +736 -0
- biotite/structure/util.py +160 -0
- biotite/version.py +34 -0
- biotite/visualize.py +375 -0
- biotite-1.6.0.dist-info/METADATA +162 -0
- biotite-1.6.0.dist-info/RECORD +354 -0
- biotite-1.6.0.dist-info/WHEEL +4 -0
- biotite-1.6.0.dist-info/licenses/LICENSE.rst +30 -0
biotite/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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 is the top-level package of *Biotite*.
|
|
7
|
+
Although it does not provide useful functionality for most users,
|
|
8
|
+
it does provide utilities and base classes used by a lot of *Biotite*'s
|
|
9
|
+
modules.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
__name__ = "biotite"
|
|
13
|
+
__author__ = "Patrick Kunzmann"
|
|
14
|
+
|
|
15
|
+
from .copyable import *
|
|
16
|
+
from .file import *
|
|
17
|
+
from .version import __version__, __version_tuple__ # noqa: F401
|
|
18
|
+
from .visualize import *
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
A subpackage that provides interfaces for external software in case
|
|
7
|
+
*Biotite*’s integrated functionality is not sufficient for your tasks.
|
|
8
|
+
These interfaces range from locally installed software
|
|
9
|
+
(e.g. MSA software) to web services (e.g. BLAST).
|
|
10
|
+
The interfaces are seamless:
|
|
11
|
+
Writing input files and reading output files is handled internally.
|
|
12
|
+
The user only needs to provide objects like a :class:`Sequence`
|
|
13
|
+
and will receive objects like an :class:`Alignment`.
|
|
14
|
+
|
|
15
|
+
Note that in order to use an interface in :mod:`biotite.application`
|
|
16
|
+
the corresponding software must be installed or the web server must be
|
|
17
|
+
reachable, respectively.
|
|
18
|
+
These programs are not shipped with the *Biotite* package.
|
|
19
|
+
|
|
20
|
+
Each application is represented by its respective :class:`Application`
|
|
21
|
+
class.
|
|
22
|
+
Each :class:`Application` instance has a life cycle, starting with its
|
|
23
|
+
creation and ending with the result extraction.
|
|
24
|
+
Each state in this life cycle is described by the value of the
|
|
25
|
+
*enum* :class:`AppState`, that each :class:`Application` contains:
|
|
26
|
+
Directly after its instantiation the app is in the ``CREATED`` state.
|
|
27
|
+
In this state further parameters can be set for the application run.
|
|
28
|
+
After the user calls the :func:`Application.start()` method, the app
|
|
29
|
+
state is set to ``RUNNING`` and the app performs the calculations.
|
|
30
|
+
When the application finishes the AppState
|
|
31
|
+
changes to ``FINISHED``.
|
|
32
|
+
The user can now call the :func:`Application.join()` method, concluding
|
|
33
|
+
the application in the ``JOINED`` state and making the results of the
|
|
34
|
+
application accessible.
|
|
35
|
+
Furthermore, this may trigger cleanup actions in some applications.
|
|
36
|
+
:func:`Application.join()` can even be called in the ``RUNNING`` state:
|
|
37
|
+
This will constantly check if the application has finished and will
|
|
38
|
+
directly go into the ``JOINED`` state as soon as the application reaches
|
|
39
|
+
the ``FINISHED`` state.
|
|
40
|
+
Calling the :func:`Application.cancel()` method while the application is
|
|
41
|
+
``RUNNING`` or ``FINISHED`` leaves the application in the ``CANCELLED``
|
|
42
|
+
state.
|
|
43
|
+
This triggers cleanup, too, but there are no accessible results.
|
|
44
|
+
If a method is called in an unsuitable app state, an
|
|
45
|
+
:class:`AppStateError` is called.
|
|
46
|
+
At each state in the life cycle, :class:`Application` type specific
|
|
47
|
+
methods are called, as shown in the following diagram.
|
|
48
|
+
|
|
49
|
+
.. figure:: /static/assets/figures/app_lifecycle.png
|
|
50
|
+
:alt: Application life cycle
|
|
51
|
+
:scale: 50%
|
|
52
|
+
|
|
53
|
+
Taken from
|
|
54
|
+
`Kunzmann & Hamacher 2018 <https://doi.org/10.1186/s12859-018-2367-z>`_
|
|
55
|
+
licensed under `CC BY 4.0 <https://creativecommons.org/licenses/by/4.0/>`_.
|
|
56
|
+
|
|
57
|
+
The execution of an :class:`Application` can run in parallel:
|
|
58
|
+
The time between starting the run and collecting the results can be
|
|
59
|
+
used to run other code, similar to the *Python* :class:`Thread` or
|
|
60
|
+
:class:`Process` classes.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
__name__ = "biotite.application"
|
|
64
|
+
__author__ = "Patrick Kunzmann"
|
|
65
|
+
|
|
66
|
+
from .application import *
|
|
67
|
+
from .localapp import *
|
|
68
|
+
from .msaapp import *
|
|
69
|
+
from .webapp import *
|
|
@@ -0,0 +1,276 @@
|
|
|
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.application"
|
|
6
|
+
__author__ = "Patrick Kunzmann"
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Application",
|
|
9
|
+
"AppStateError",
|
|
10
|
+
"TimeoutError",
|
|
11
|
+
"VersionError",
|
|
12
|
+
"AppState",
|
|
13
|
+
"requires_state",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
import abc
|
|
17
|
+
import time
|
|
18
|
+
from enum import Flag, auto
|
|
19
|
+
from functools import wraps
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AppState(Flag):
|
|
23
|
+
"""
|
|
24
|
+
This enum type represents the app states of an application.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
CREATED = auto()
|
|
28
|
+
RUNNING = auto()
|
|
29
|
+
FINISHED = auto()
|
|
30
|
+
JOINED = auto()
|
|
31
|
+
CANCELLED = auto()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def requires_state(app_state):
|
|
35
|
+
"""
|
|
36
|
+
A decorator for methods of :class:`Application` subclasses that
|
|
37
|
+
raises an :class:`AppStateError` in case the method is called, when
|
|
38
|
+
the :class:`Application` is not in the specified :class:`AppState`
|
|
39
|
+
`app_state`.
|
|
40
|
+
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
app_state : AppState
|
|
44
|
+
The required app state.
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
--------
|
|
48
|
+
Raises :class:`AppStateError` when `function` is called,
|
|
49
|
+
if :class:`Application` is not in one of the specified states:
|
|
50
|
+
|
|
51
|
+
>>> @requires_state(AppState.RUNNING | AppState.FINISHED)
|
|
52
|
+
... def function(self):
|
|
53
|
+
... pass
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
def decorator(func):
|
|
57
|
+
@wraps(func)
|
|
58
|
+
def wrapper(*args, **kwargs):
|
|
59
|
+
# First parameter of method is always 'self'
|
|
60
|
+
try:
|
|
61
|
+
instance = args[0]
|
|
62
|
+
except IndexError:
|
|
63
|
+
raise TypeError("This method must be called from a class instance")
|
|
64
|
+
if not instance._state & app_state:
|
|
65
|
+
raise AppStateError(
|
|
66
|
+
f"The application is in {instance.get_app_state()} state, "
|
|
67
|
+
f"but {app_state} state is required"
|
|
68
|
+
)
|
|
69
|
+
return func(*args, **kwargs)
|
|
70
|
+
|
|
71
|
+
return wrapper
|
|
72
|
+
|
|
73
|
+
return decorator
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class Application(metaclass=abc.ABCMeta):
|
|
77
|
+
"""
|
|
78
|
+
This class is a wrapper around an external piece of runnable
|
|
79
|
+
software in any sense. Subclasses of this abstract base class
|
|
80
|
+
specify the respective kind of software and the way of interacting
|
|
81
|
+
with it.
|
|
82
|
+
|
|
83
|
+
Every :class:`Application` runs through a different app states
|
|
84
|
+
(instances of enum :class:`AppState`) from its creation until its
|
|
85
|
+
termination.
|
|
86
|
+
|
|
87
|
+
Directly after its instantiation the app is in the *CREATED* state.
|
|
88
|
+
In this state further parameters can be set for the application run.
|
|
89
|
+
After the user calls the :func:`start()` method, the app state is
|
|
90
|
+
set to *RUNNING* and the :class:`Application` type specific
|
|
91
|
+
:func:`run()` method is called.
|
|
92
|
+
When the application finishes the AppState changes to *FINISHED*.
|
|
93
|
+
This is checked via the :class:`Application` type specific
|
|
94
|
+
:func:`is_finished()` method.
|
|
95
|
+
The user can now call the :func:`join()` method, concluding the
|
|
96
|
+
application in the *JOINED* state and making the results of the
|
|
97
|
+
application accessible by executing the :class:`Application`
|
|
98
|
+
type specific :func:`evaluate()` method.
|
|
99
|
+
Furthermore this executes the :class:`Application` type specific
|
|
100
|
+
:func:`clean_up()` method.
|
|
101
|
+
:func:`join()` can even be called in the *RUNNING* state:
|
|
102
|
+
This will constantly check :func:`is_finished()` and will directly
|
|
103
|
+
go into the *JOINED* state as soon as the application reaches the
|
|
104
|
+
*FINISHED* state.
|
|
105
|
+
Calling the :func:`cancel()` method while the application is
|
|
106
|
+
*RUNNING* or *FINISHED* leaves the application in the *CANCELLED*
|
|
107
|
+
state.
|
|
108
|
+
This triggers the :func:`clean_up()` method, too, but there are no
|
|
109
|
+
accessible results.
|
|
110
|
+
If a method is called in an unsuitable app state, an
|
|
111
|
+
:class:`AppStateError` is called.
|
|
112
|
+
|
|
113
|
+
The application run behaves like an additional thread: Between the
|
|
114
|
+
call of :func:`start()` and :func:`join()` other Python code can be
|
|
115
|
+
executed, while the application runs in the background.
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
def __init__(self):
|
|
119
|
+
self._state = AppState.CREATED
|
|
120
|
+
|
|
121
|
+
@requires_state(AppState.CREATED)
|
|
122
|
+
def start(self):
|
|
123
|
+
"""
|
|
124
|
+
Start the application run and set its state to *RUNNING*.
|
|
125
|
+
This can only be done from the *CREATED* state.
|
|
126
|
+
"""
|
|
127
|
+
self.run()
|
|
128
|
+
self._start_time = time.time()
|
|
129
|
+
self._state = AppState.RUNNING
|
|
130
|
+
|
|
131
|
+
@requires_state(AppState.RUNNING | AppState.FINISHED)
|
|
132
|
+
def join(self, timeout=None):
|
|
133
|
+
"""
|
|
134
|
+
Conclude the application run and set its state to *JOINED*.
|
|
135
|
+
This can only be done from the *RUNNING* or *FINISHED* state.
|
|
136
|
+
|
|
137
|
+
If the application is *FINISHED* the joining process happens
|
|
138
|
+
immediately, if otherwise the application is *RUNNING*, this
|
|
139
|
+
method waits until the application is *FINISHED*.
|
|
140
|
+
|
|
141
|
+
Parameters
|
|
142
|
+
----------
|
|
143
|
+
timeout : float, optional
|
|
144
|
+
If this parameter is specified, the :class:`Application`
|
|
145
|
+
only waits for finishing until this value (in seconds) runs
|
|
146
|
+
out.
|
|
147
|
+
After this time is exceeded a :class:`TimeoutError` is
|
|
148
|
+
raised and the application is cancelled.
|
|
149
|
+
|
|
150
|
+
Raises
|
|
151
|
+
------
|
|
152
|
+
TimeoutError
|
|
153
|
+
If the joining process exceeds the `timeout` value.
|
|
154
|
+
"""
|
|
155
|
+
time.sleep(self.wait_interval())
|
|
156
|
+
while self.get_app_state() != AppState.FINISHED:
|
|
157
|
+
if timeout is not None and time.time() - self._start_time > timeout:
|
|
158
|
+
self.cancel()
|
|
159
|
+
raise TimeoutError(
|
|
160
|
+
f"The application expired its timeout ({timeout:.1f} s)"
|
|
161
|
+
)
|
|
162
|
+
else:
|
|
163
|
+
time.sleep(self.wait_interval())
|
|
164
|
+
time.sleep(self.wait_interval())
|
|
165
|
+
try:
|
|
166
|
+
self.evaluate()
|
|
167
|
+
except AppStateError:
|
|
168
|
+
raise
|
|
169
|
+
except:
|
|
170
|
+
self._state = AppState.CANCELLED
|
|
171
|
+
raise
|
|
172
|
+
else:
|
|
173
|
+
self._state = AppState.JOINED
|
|
174
|
+
self.clean_up()
|
|
175
|
+
|
|
176
|
+
@requires_state(AppState.RUNNING | AppState.FINISHED)
|
|
177
|
+
def cancel(self):
|
|
178
|
+
"""
|
|
179
|
+
Cancel the application when in *RUNNING* or *FINISHED* state.
|
|
180
|
+
"""
|
|
181
|
+
self._state = AppState.CANCELLED
|
|
182
|
+
self.clean_up()
|
|
183
|
+
|
|
184
|
+
def get_app_state(self):
|
|
185
|
+
"""
|
|
186
|
+
Get the current app state.
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
app_state : AppState
|
|
191
|
+
The current app state.
|
|
192
|
+
"""
|
|
193
|
+
if self._state == AppState.RUNNING:
|
|
194
|
+
if self.is_finished():
|
|
195
|
+
self._state = AppState.FINISHED
|
|
196
|
+
return self._state
|
|
197
|
+
|
|
198
|
+
@abc.abstractmethod
|
|
199
|
+
def run(self):
|
|
200
|
+
"""
|
|
201
|
+
Commence the application run. Called in :func:`start()`.
|
|
202
|
+
|
|
203
|
+
PROTECTED: Override when inheriting.
|
|
204
|
+
"""
|
|
205
|
+
pass
|
|
206
|
+
|
|
207
|
+
@abc.abstractmethod
|
|
208
|
+
def is_finished(self):
|
|
209
|
+
"""
|
|
210
|
+
Check if the application has finished.
|
|
211
|
+
|
|
212
|
+
PROTECTED: Override when inheriting.
|
|
213
|
+
|
|
214
|
+
Returns
|
|
215
|
+
-------
|
|
216
|
+
finished : bool
|
|
217
|
+
True of the application has finished, false otherwise.
|
|
218
|
+
"""
|
|
219
|
+
pass
|
|
220
|
+
|
|
221
|
+
@abc.abstractmethod
|
|
222
|
+
def wait_interval(self):
|
|
223
|
+
"""
|
|
224
|
+
The time interval of :func:`is_finished()` calls in the joining
|
|
225
|
+
process.
|
|
226
|
+
|
|
227
|
+
PROTECTED: Override when inheriting.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
interval : float
|
|
232
|
+
Time (in seconds) between calls of :func:`is_finished()` in
|
|
233
|
+
:func:`join()`.
|
|
234
|
+
"""
|
|
235
|
+
pass
|
|
236
|
+
|
|
237
|
+
@abc.abstractmethod
|
|
238
|
+
def evaluate(self):
|
|
239
|
+
"""
|
|
240
|
+
Evaluate application results. Called in :func:`join()`.
|
|
241
|
+
|
|
242
|
+
PROTECTED: Override when inheriting.
|
|
243
|
+
"""
|
|
244
|
+
pass
|
|
245
|
+
|
|
246
|
+
def clean_up(self):
|
|
247
|
+
"""
|
|
248
|
+
Do clean up work after the application terminates.
|
|
249
|
+
|
|
250
|
+
PROTECTED: Optionally override when inheriting.
|
|
251
|
+
"""
|
|
252
|
+
pass
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class AppStateError(Exception):
|
|
256
|
+
"""
|
|
257
|
+
Indicate that the application lifecycle was violated.
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
pass
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
class TimeoutError(Exception):
|
|
264
|
+
"""
|
|
265
|
+
Indicate that the application's timeout expired.
|
|
266
|
+
"""
|
|
267
|
+
|
|
268
|
+
pass
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class VersionError(Exception):
|
|
272
|
+
"""
|
|
273
|
+
Indicate that the application's version is invalid.
|
|
274
|
+
"""
|
|
275
|
+
|
|
276
|
+
pass
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
A subpackage for static ligand docking with *Autodock*.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__name__ = "biotite.application.autodock"
|
|
10
|
+
__author__ = "Patrick Kunzmann"
|
|
11
|
+
|
|
12
|
+
from .app import *
|