biotite 1.5.0__cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.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 +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 +428 -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 +197 -0
- biotite/database/entrez/__init__.py +15 -0
- biotite/database/entrez/check.py +60 -0
- biotite/database/entrez/dbnames.py +101 -0
- biotite/database/entrez/download.py +228 -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 +258 -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 +161 -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 +126 -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 +490 -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 +702 -0
- biotite/sequence/align/banded.cpython-311-x86_64-linux-gnu.so +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.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/kmeralphabet.pyx +595 -0
- biotite/sequence/align/kmersimilarity.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/kmersimilarity.pyx +233 -0
- biotite/sequence/align/kmertable.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/kmertable.pyx +3411 -0
- biotite/sequence/align/localgapped.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/localgapped.pyx +892 -0
- biotite/sequence/align/localungapped.cpython-311-x86_64-linux-gnu.so +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.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/multiple.pyx +619 -0
- biotite/sequence/align/pairwise.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/pairwise.pyx +585 -0
- biotite/sequence/align/permutation.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/permutation.pyx +313 -0
- biotite/sequence/align/primes.txt +821 -0
- biotite/sequence/align/selector.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/selector.pyx +954 -0
- biotite/sequence/align/statistics.py +264 -0
- biotite/sequence/align/tracetable.cpython-311-x86_64-linux-gnu.so +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.cpython-311-x86_64-linux-gnu.so +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 +283 -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.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/phylo/nj.pyx +221 -0
- biotite/sequence/phylo/tree.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/sequence/phylo/tree.pyx +1169 -0
- biotite/sequence/phylo/upgma.cpython-311-x86_64-linux-gnu.so +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 +1562 -0
- biotite/structure/basepairs.py +1403 -0
- biotite/structure/bonds.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/structure/bonds.pyx +2036 -0
- biotite/structure/box.py +724 -0
- biotite/structure/celllist.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/structure/celllist.pyx +864 -0
- biotite/structure/chains.py +310 -0
- biotite/structure/charges.cpython-311-x86_64-linux-gnu.so +0 -0
- biotite/structure/charges.pyx +520 -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 +591 -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 +425 -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.cpython-311-x86_64-linux-gnu.so +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 +2113 -0
- biotite/structure/io/pdbx/encoding.cpython-311-x86_64-linux-gnu.so +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 +451 -0
- biotite/structure/sasa.cpython-311-x86_64-linux-gnu.so +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.5.0.dist-info/METADATA +162 -0
- biotite-1.5.0.dist-info/RECORD +354 -0
- biotite-1.5.0.dist-info/WHEEL +6 -0
- biotite-1.5.0.dist-info/licenses/LICENSE.rst +30 -0
|
@@ -0,0 +1,13 @@
|
|
|
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 downloading files from the UniProt.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__name__ = "biotite.database.uniprot"
|
|
10
|
+
__author__ = "Maximilian Greil"
|
|
11
|
+
|
|
12
|
+
from .download import *
|
|
13
|
+
from .query import *
|
|
@@ -0,0 +1,40 @@
|
|
|
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.database.uniprot"
|
|
6
|
+
__author__ = "Maximilian Greil"
|
|
7
|
+
__all__ = ["assert_valid_response"]
|
|
8
|
+
|
|
9
|
+
from biotite.database.error import RequestError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Taken from https://www.uniprot.org/help/api_retrieve_entries
|
|
13
|
+
def assert_valid_response(response):
|
|
14
|
+
"""
|
|
15
|
+
Checks whether the response is valid.
|
|
16
|
+
|
|
17
|
+
Parameters
|
|
18
|
+
----------
|
|
19
|
+
response : Response
|
|
20
|
+
Status code of :func:`requests.get()`.
|
|
21
|
+
"""
|
|
22
|
+
if len(response.content) == 0:
|
|
23
|
+
raise RequestError("No content returned")
|
|
24
|
+
match response.status_code:
|
|
25
|
+
case 400:
|
|
26
|
+
raise RequestError("Bad request. There is a problem with your input.")
|
|
27
|
+
case 404:
|
|
28
|
+
raise RequestError("Not found. The resource you requested doesn't exist.")
|
|
29
|
+
case 410:
|
|
30
|
+
raise RequestError("Gone. The resource you requested was removed.")
|
|
31
|
+
case 500:
|
|
32
|
+
raise RequestError(
|
|
33
|
+
"Internal server error. "
|
|
34
|
+
"Most likely a temporary problem, "
|
|
35
|
+
"but if the problem persists please contact UniProt team."
|
|
36
|
+
)
|
|
37
|
+
case 503:
|
|
38
|
+
raise RequestError(
|
|
39
|
+
"Service not available. The server is being updated, try again later."
|
|
40
|
+
)
|
|
@@ -0,0 +1,126 @@
|
|
|
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.database.uniprot"
|
|
6
|
+
__author__ = "Maximilian Greil"
|
|
7
|
+
__all__ = ["fetch"]
|
|
8
|
+
|
|
9
|
+
import io
|
|
10
|
+
import os
|
|
11
|
+
from os.path import getsize, isdir, isfile, join
|
|
12
|
+
import requests
|
|
13
|
+
from biotite.database.uniprot.check import assert_valid_response
|
|
14
|
+
|
|
15
|
+
_fetch_url = "https://rest.uniprot.org/"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_database_name(id):
|
|
19
|
+
"""
|
|
20
|
+
Get the correct UniProt database from the ID of the file to be downloaded.
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
id: str
|
|
25
|
+
ID of the file to be downloaded.
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
name : str
|
|
30
|
+
E-utility UniProt database name.
|
|
31
|
+
"""
|
|
32
|
+
if id[:3] == "UPI":
|
|
33
|
+
return "uniparc"
|
|
34
|
+
elif id[:6] == "UniRef":
|
|
35
|
+
return "uniref"
|
|
36
|
+
return "uniprotkb"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def fetch(ids, format, target_path=None, overwrite=False, verbose=False):
|
|
40
|
+
"""
|
|
41
|
+
Download files from the UniProt in various formats.
|
|
42
|
+
|
|
43
|
+
Available databases are UniProtKB, UniRef and UniParc.
|
|
44
|
+
This function requires an internet connection.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
ids : str or iterable object of str
|
|
49
|
+
A single ID or a list of IDs of the file(s)
|
|
50
|
+
to be downloaded.
|
|
51
|
+
format : {'fasta', 'gff', 'txt', 'xml', 'rdf', 'tab'}
|
|
52
|
+
The format of the files to be downloaded.
|
|
53
|
+
target_path : str, optional
|
|
54
|
+
The target directory of the downloaded files.
|
|
55
|
+
By default, the file content is stored in a file-like object
|
|
56
|
+
(`StringIO` or `BytesIO`, respectively).
|
|
57
|
+
overwrite : bool, optional
|
|
58
|
+
If true, existing files will be overwritten. Otherwise the
|
|
59
|
+
respective file will only be downloaded if the file does not
|
|
60
|
+
exist yet in the specified target directory.
|
|
61
|
+
verbose : bool, optional
|
|
62
|
+
If true, the function will output the download progress.
|
|
63
|
+
|
|
64
|
+
Returns
|
|
65
|
+
-------
|
|
66
|
+
files : str or StringIO or BytesIO or list of (str or StringIO or BytesIO)
|
|
67
|
+
The file path(s) to the downloaded files.
|
|
68
|
+
If a single string (a single ID) was given in `ids`,
|
|
69
|
+
a single string is returned. If a list (or other iterable
|
|
70
|
+
object) was given, a list of strings is returned.
|
|
71
|
+
If no `target_path` was given, the file contents are stored in
|
|
72
|
+
either `StringIO` or `BytesIO` objects.
|
|
73
|
+
|
|
74
|
+
Examples
|
|
75
|
+
--------
|
|
76
|
+
|
|
77
|
+
>>> import os.path
|
|
78
|
+
>>> file = fetch("P12345", "fasta", path_to_directory)
|
|
79
|
+
>>> print(os.path.basename(file))
|
|
80
|
+
P12345.fasta
|
|
81
|
+
>>> files = fetch(["P12345", "Q8K9I1"], "fasta", path_to_directory)
|
|
82
|
+
>>> print([os.path.basename(file) for file in files])
|
|
83
|
+
['P12345.fasta', 'Q8K9I1.fasta']
|
|
84
|
+
"""
|
|
85
|
+
# If only a single ID is present,
|
|
86
|
+
# put it into a single element list
|
|
87
|
+
if isinstance(ids, str):
|
|
88
|
+
ids = [ids]
|
|
89
|
+
single_element = True
|
|
90
|
+
else:
|
|
91
|
+
single_element = False
|
|
92
|
+
# Create the target folder, if not existing
|
|
93
|
+
if target_path is not None and not isdir(target_path):
|
|
94
|
+
os.makedirs(target_path)
|
|
95
|
+
files = []
|
|
96
|
+
for i, id in enumerate(ids):
|
|
97
|
+
db_name = _get_database_name(id)
|
|
98
|
+
# Verbose output
|
|
99
|
+
if verbose:
|
|
100
|
+
print(f"Fetching file {i + 1:d} / {len(ids):d} ({id})...", end="\r")
|
|
101
|
+
# Fetch file from database
|
|
102
|
+
if target_path is not None:
|
|
103
|
+
file = join(target_path, id + "." + format)
|
|
104
|
+
else:
|
|
105
|
+
# 'file = None' -> store content in a file-like object
|
|
106
|
+
file = None
|
|
107
|
+
if file is None or not isfile(file) or getsize(file) == 0 or overwrite:
|
|
108
|
+
if format in ["fasta", "gff", "txt", "xml", "rdf", "tab"]:
|
|
109
|
+
r = requests.get(_fetch_url + db_name + "/" + id + "." + format)
|
|
110
|
+
content = r.text
|
|
111
|
+
assert_valid_response(r)
|
|
112
|
+
else:
|
|
113
|
+
raise ValueError(f"Format '{format}' is not supported")
|
|
114
|
+
if file is None:
|
|
115
|
+
file = io.StringIO(content)
|
|
116
|
+
else:
|
|
117
|
+
with open(file, "w+") as f:
|
|
118
|
+
f.write(content)
|
|
119
|
+
files.append(file)
|
|
120
|
+
if verbose:
|
|
121
|
+
print("\nDone")
|
|
122
|
+
# If input was a single ID, return only a single path
|
|
123
|
+
if single_element:
|
|
124
|
+
return files[0]
|
|
125
|
+
else:
|
|
126
|
+
return files
|
|
@@ -0,0 +1,292 @@
|
|
|
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.database.uniprot"
|
|
6
|
+
__author__ = "Maximilian Greil"
|
|
7
|
+
__all__ = ["Query", "SimpleQuery", "CompositeQuery", "search"]
|
|
8
|
+
|
|
9
|
+
import abc
|
|
10
|
+
import requests
|
|
11
|
+
from biotite.database.uniprot.check import assert_valid_response
|
|
12
|
+
|
|
13
|
+
_base_url = "https://rest.uniprot.org/uniprotkb/search/"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Query(metaclass=abc.ABCMeta):
|
|
17
|
+
"""
|
|
18
|
+
Base class for a wrapper around a search term
|
|
19
|
+
for the UniProt search service.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(self):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
@abc.abstractmethod
|
|
26
|
+
def __str__(self):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
def __or__(self, operand):
|
|
30
|
+
return CompositeQuery("OR", self, operand)
|
|
31
|
+
|
|
32
|
+
def __and__(self, operand):
|
|
33
|
+
return CompositeQuery("AND", self, operand)
|
|
34
|
+
|
|
35
|
+
def __xor__(self, operand):
|
|
36
|
+
return CompositeQuery("NOT", self, operand)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class CompositeQuery(Query):
|
|
40
|
+
"""
|
|
41
|
+
A representation of an composite query
|
|
42
|
+
for the UniProt search service.
|
|
43
|
+
|
|
44
|
+
A composite query is a combination of two other queries,
|
|
45
|
+
combined either with an 'AND', 'OR' or 'NOT' operator.
|
|
46
|
+
|
|
47
|
+
Usually the user does not create instances of this class directly,
|
|
48
|
+
but :class:`Query` instances are combined with
|
|
49
|
+
``|`` (OR), ``&`` (AND) or ``^`` (NOT).
|
|
50
|
+
|
|
51
|
+
Parameters
|
|
52
|
+
----------
|
|
53
|
+
operator : str, {"AND", "OR", "NOT"}
|
|
54
|
+
The combination operator.
|
|
55
|
+
query1, query2 : SimpleQuery
|
|
56
|
+
The queries to be combined.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
def __init__(self, operator, query1, query2):
|
|
60
|
+
super().__init__()
|
|
61
|
+
self._op = operator
|
|
62
|
+
self._q1 = query1
|
|
63
|
+
self._q2 = query2
|
|
64
|
+
|
|
65
|
+
def __str__(self):
|
|
66
|
+
return "{:} {:} {:}".format(str(self._q1), self._op, str(self._q2))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _check_brackets(term):
|
|
70
|
+
"""
|
|
71
|
+
Check if term contains correct number of round brackets and square brackets.
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
term: str
|
|
76
|
+
The search term.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
bool
|
|
81
|
+
True if term contains correct number of round brackets and square brackets, otherwise False.
|
|
82
|
+
"""
|
|
83
|
+
square_count = 0
|
|
84
|
+
round_count = 0
|
|
85
|
+
for i in term:
|
|
86
|
+
if i == "[":
|
|
87
|
+
square_count += 1
|
|
88
|
+
elif i == "]":
|
|
89
|
+
square_count -= 1
|
|
90
|
+
if i == "(":
|
|
91
|
+
round_count += 1
|
|
92
|
+
elif i == ")":
|
|
93
|
+
round_count -= 1
|
|
94
|
+
if square_count < 0:
|
|
95
|
+
return False
|
|
96
|
+
if round_count < 0:
|
|
97
|
+
return False
|
|
98
|
+
return square_count == 0 and round_count == 0
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class SimpleQuery(Query):
|
|
102
|
+
"""
|
|
103
|
+
A simple query for the UniProt search service without
|
|
104
|
+
combination via 'AND', 'OR' or 'NOT'. A query consists of a search
|
|
105
|
+
term and an optional field.
|
|
106
|
+
|
|
107
|
+
A list of available search fields with description can be found
|
|
108
|
+
`here <https://www.uniprot.org/help/query-fields>`_.
|
|
109
|
+
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
field : str
|
|
113
|
+
The field to search the term in.
|
|
114
|
+
The list of possible fields and the required search term
|
|
115
|
+
formatting can be found
|
|
116
|
+
`here <https://www.uniprot.org/help/query-fields>`_.
|
|
117
|
+
term : str
|
|
118
|
+
The search term.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
# Field identifiers are taken from
|
|
122
|
+
# https://www.uniprot.org/help/query-fields
|
|
123
|
+
_fields = [
|
|
124
|
+
"accession",
|
|
125
|
+
"active",
|
|
126
|
+
"ft_init_met",
|
|
127
|
+
"ft_signal",
|
|
128
|
+
"ft_transit",
|
|
129
|
+
"ft_propep",
|
|
130
|
+
"ft_chain",
|
|
131
|
+
"ft_peptide",
|
|
132
|
+
"ft_topo_dom",
|
|
133
|
+
"ft_transmem",
|
|
134
|
+
"ft_intramem",
|
|
135
|
+
"ft_domain",
|
|
136
|
+
"ft_repeat",
|
|
137
|
+
"ft_zn_fing",
|
|
138
|
+
"ft_dna_bind",
|
|
139
|
+
"ft_region",
|
|
140
|
+
"ft_coiled",
|
|
141
|
+
"ft_motif",
|
|
142
|
+
"ft_compbias",
|
|
143
|
+
"ft_act_site",
|
|
144
|
+
"ft_binding",
|
|
145
|
+
"ft_site",
|
|
146
|
+
"ft_non_std",
|
|
147
|
+
"ft_mod_res",
|
|
148
|
+
"ft_lipid",
|
|
149
|
+
"ft_carbohyd",
|
|
150
|
+
"ft_disulfid",
|
|
151
|
+
"ft_crosslnk",
|
|
152
|
+
"ft_var_seq",
|
|
153
|
+
"ft_variant",
|
|
154
|
+
"ft_mutagen",
|
|
155
|
+
"ft_unsure",
|
|
156
|
+
"ft_conflict",
|
|
157
|
+
"ft_non_cons",
|
|
158
|
+
"ft_non_ter",
|
|
159
|
+
"ft_helix",
|
|
160
|
+
"ft_turn",
|
|
161
|
+
"ft_strand",
|
|
162
|
+
"lit_author",
|
|
163
|
+
"protein_name",
|
|
164
|
+
"chebi",
|
|
165
|
+
"citation",
|
|
166
|
+
"uniref_cluster_90",
|
|
167
|
+
"xrefcount_pdb",
|
|
168
|
+
"date_created",
|
|
169
|
+
"database",
|
|
170
|
+
"xref",
|
|
171
|
+
"ec",
|
|
172
|
+
"cc_function",
|
|
173
|
+
"cc_catalytic_activity",
|
|
174
|
+
"cc_cofactor",
|
|
175
|
+
"cc_activity_regulation",
|
|
176
|
+
"cc_biophysicochemical_properties",
|
|
177
|
+
"cc_subunit",
|
|
178
|
+
"cc_pathway",
|
|
179
|
+
"cc_scl_term",
|
|
180
|
+
"cc_tissue_specificity",
|
|
181
|
+
"cc_developmental_stage",
|
|
182
|
+
"cc_induction",
|
|
183
|
+
"cc_domain",
|
|
184
|
+
"cc_ptm cc_rna_editing",
|
|
185
|
+
"cc_mass_spectrometry",
|
|
186
|
+
"cc_polymorphism",
|
|
187
|
+
"cc_disease",
|
|
188
|
+
"cc_disruption_phenotype",
|
|
189
|
+
"cc_allergen",
|
|
190
|
+
"cc_toxic_dose",
|
|
191
|
+
"cc_biotechnology",
|
|
192
|
+
"cc_pharmaceutical",
|
|
193
|
+
"cc_miscellaneous",
|
|
194
|
+
"cc_similarity",
|
|
195
|
+
"cc_caution",
|
|
196
|
+
"cc_sequence_caution",
|
|
197
|
+
"existence",
|
|
198
|
+
"family",
|
|
199
|
+
"fragment",
|
|
200
|
+
"gene",
|
|
201
|
+
"gene_exact",
|
|
202
|
+
"go",
|
|
203
|
+
"virus_host_name",
|
|
204
|
+
"virus_host_id",
|
|
205
|
+
"accession_id",
|
|
206
|
+
"inchikey",
|
|
207
|
+
"protein_name",
|
|
208
|
+
"interactor",
|
|
209
|
+
"keyword",
|
|
210
|
+
"length",
|
|
211
|
+
"lineage",
|
|
212
|
+
"mass",
|
|
213
|
+
"cc_mass_spectrometry",
|
|
214
|
+
"date_modified",
|
|
215
|
+
"protein_name",
|
|
216
|
+
"organelle",
|
|
217
|
+
"organism_name",
|
|
218
|
+
"organism_id",
|
|
219
|
+
"plasmid",
|
|
220
|
+
"proteome",
|
|
221
|
+
"proteomecomponent",
|
|
222
|
+
"sec_acc",
|
|
223
|
+
"reviewed",
|
|
224
|
+
"scope",
|
|
225
|
+
"sequence",
|
|
226
|
+
"date_sequence_modified",
|
|
227
|
+
"strain",
|
|
228
|
+
"taxonomy_name",
|
|
229
|
+
"taxonomy_id",
|
|
230
|
+
"tissue",
|
|
231
|
+
"cc_webresource",
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
def __init__(self, field, term):
|
|
235
|
+
super().__init__()
|
|
236
|
+
if field not in SimpleQuery._fields:
|
|
237
|
+
raise ValueError(f"Unknown field identifier '{field}'")
|
|
238
|
+
if not _check_brackets(term):
|
|
239
|
+
raise ValueError(
|
|
240
|
+
"Query term contains illegal number of round brackets ( ) and/or square brackets [ ]"
|
|
241
|
+
)
|
|
242
|
+
for invalid_string in ['"', "AND", "OR", "NOT", "\t", "\n"]:
|
|
243
|
+
if invalid_string in term:
|
|
244
|
+
raise ValueError(f"Query contains illegal term {invalid_string}")
|
|
245
|
+
if " " in term:
|
|
246
|
+
term = f'"{term}"'
|
|
247
|
+
self._field = field
|
|
248
|
+
self._term = term
|
|
249
|
+
|
|
250
|
+
def __str__(self):
|
|
251
|
+
return f"{self._field}:{self._term}"
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def search(query, number=500):
|
|
255
|
+
"""
|
|
256
|
+
Get all UniProt IDs that meet the given query requirements,
|
|
257
|
+
via the UniProt search service.
|
|
258
|
+
|
|
259
|
+
This function requires an internet connection.
|
|
260
|
+
|
|
261
|
+
Parameters
|
|
262
|
+
----------
|
|
263
|
+
query : Query
|
|
264
|
+
The search query.
|
|
265
|
+
number : int
|
|
266
|
+
The maximum number of IDs that are obtained.
|
|
267
|
+
|
|
268
|
+
Returns
|
|
269
|
+
-------
|
|
270
|
+
ids : list of str
|
|
271
|
+
A list of strings containing all UniProt IDs
|
|
272
|
+
that meet the query requirements.
|
|
273
|
+
|
|
274
|
+
Notes
|
|
275
|
+
-----
|
|
276
|
+
A list of available search fields with description can be found
|
|
277
|
+
`here <https://www.uniprot.org/help/query-fields>`_.
|
|
278
|
+
|
|
279
|
+
Examples
|
|
280
|
+
--------
|
|
281
|
+
>>> query = SimpleQuery("accession", "P12345") & \
|
|
282
|
+
SimpleQuery("reviewed", "true")
|
|
283
|
+
>>> ids = search(query)
|
|
284
|
+
>>> print(sorted(ids))
|
|
285
|
+
['P12345']
|
|
286
|
+
"""
|
|
287
|
+
|
|
288
|
+
params = {"query": str(query), "format": "list", "size": str(number)}
|
|
289
|
+
r = requests.get(_base_url, params=params)
|
|
290
|
+
content = r.text
|
|
291
|
+
assert_valid_response(r)
|
|
292
|
+
return content.split("\n")[:-1]
|