aldepyde 0.0.0a32__py3-none-any.whl → 0.0.0a33__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aldepyde might be problematic. Click here for more details.

aldepyde/__init__.py CHANGED
@@ -17,25 +17,6 @@ def get_cache() -> CacheManager:
17
17
  global _cache_manager
18
18
  return _cache_manager
19
19
 
20
- # def get_cache() -> _cache_handler:
21
- # global _cache
22
- # # if _cache.null:
23
- # # return create_cache()
24
- # return _cache
25
-
26
- # def SaveConfig(path: str="config.json", indent: str = "") -> None:
27
- # global _config
28
- # get_config().Save(path=path, indent=indent)
29
- #
30
- #
31
- # def LoadConfig(s: dict | str, ignore_missing=False) -> None:
32
- # global _config
33
- # get_config().Load(s, ignore_missing=ignore_missing)
34
-
35
-
36
- # from . import rand
37
- # from . import biomolecule
38
- # from . import fetcher
39
20
 
40
21
  from importlib import import_module
41
22
 
@@ -13,3 +13,6 @@ __all__ = list(set(_amino_acid.__all__.copy()) |
13
13
  set(_pdb.__all__.copy()) |
14
14
  set(_rna.__all__.copy()))
15
15
 
16
+ import sys
17
+
18
+ sys.stderr.write("Note that the `biomolecule` submodule is not yet fully tested and may be unstable")
@@ -8,30 +8,47 @@ import gzip
8
8
 
9
9
  class uniref_parser(_database):
10
10
  def __init__(self):
11
- pass
11
+ super().__init__()
12
+
13
+ # TODO single entry parsing
14
+ # TODO store metadata upon request
12
15
 
13
- #TODO Fix the total calculation
14
16
  @staticmethod
15
17
  def stream_uniref_gz(filepath, chunk_size=8192, use_progress_bar=False):
16
- if use_progress_bar is not None:
17
- raw_stream, size = _database.open_stream(filepath)
18
- pbar = ProgressBar(size//chunk_size) if use_progress_bar else None
19
- decompressor = zlib.decompressobj(16 + zlib.MAX_WBITS)
20
- try:
21
- while True:
22
- comp_chunk = raw_stream.read(chunk_size)
23
- if not comp_chunk:
24
- break
25
- if pbar is not None:
26
- pbar.update()
27
- decomp_chunk = decompressor.decompress(comp_chunk)
28
- if decomp_chunk:
29
- yield decomp_chunk
30
- final = decompressor.flush()
31
- if final:
32
- yield final
33
- finally:
34
- raw_stream.close()
18
+ raw_stream, size = _database.open_stream(filepath)
19
+ pbar = ProgressBar(size//chunk_size) if use_progress_bar else None
20
+ decompressor = zlib.decompressobj(16 + zlib.MAX_WBITS)
21
+ try:
22
+ while True:
23
+ comp_chunk = raw_stream.read(chunk_size)
24
+ if not comp_chunk:
25
+ break
26
+ if pbar is not None:
27
+ pbar.update()
28
+ decomp_chunk = decompressor.decompress(comp_chunk)
29
+ if decomp_chunk:
30
+ yield decomp_chunk
31
+ final = decompressor.flush()
32
+ if final:
33
+ yield final
34
+ finally:
35
+ raw_stream.close()
36
+
37
+ @staticmethod
38
+ def download_file(url, destination, chunk_size=8192, use_progress_bar=False):
39
+ raw_stream, size = _database.open_stream(url)
40
+ pbar = ProgressBar(size // chunk_size) if use_progress_bar else None
41
+ with open(destination, 'wb') as fp:
42
+ while True:
43
+ chunk = raw_stream.read(chunk_size)
44
+ if not chunk:
45
+ break
46
+ if pbar is not None:
47
+ pbar.update()
48
+ fp.write(chunk)
49
+
50
+
51
+
35
52
 
36
53
  @staticmethod
37
54
  def stitch_streamed_sequences(stream, as_str=True):
@@ -52,24 +69,45 @@ class uniref_parser(_database):
52
69
  return b"".join(lines[1:])
53
70
 
54
71
  @staticmethod
55
- def stream_uniref50(chunk_size=8192, use_progress_bar=False):
56
- yield from uniref_parser.stream_uniref_gz('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref50/uniref50.fasta.gz',
72
+ def stream_uniref50(chunk_size=8192, use_progress_bar=False, stitch=False):
73
+ if not stitch:
74
+ yield from uniref_parser.stream_uniref_gz('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref50/uniref50.fasta.gz',
57
75
  chunk_size=chunk_size, use_progress_bar=use_progress_bar)
58
- # yield from RemoteFileHandler.stream_url(
59
- # 'https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref50/uniref50.fasta.gz', chunk_size=chunk_size)
76
+ else:
77
+ yield from uniref_parser.stitch_streamed_sequences(uniref_parser.stream_uniref_gz(
78
+ 'https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref50/uniref50.fasta.gz',
79
+ chunk_size=chunk_size, use_progress_bar=use_progress_bar))
60
80
 
61
81
  @staticmethod
62
- def stream_uniref90(chunk_size=8192, use_progress_bar=False):
63
- yield from uniref_parser.stream_uniref_gz('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref50/uniref50.fasta.gz',
82
+ def stream_uniref90(chunk_size=8192, use_progress_bar=False, stitch=False):
83
+ if not stitch:
84
+ yield from uniref_parser.stream_uniref_gz('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref90/uniref90.fasta.gz',
64
85
  chunk_size=chunk_size, use_progress_bar=use_progress_bar)
65
-
66
- # yield from RemoteFileHandler.stream_url(
67
- # 'https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref90/uniref90.fasta.gz', chunk_size=chunk_size)
86
+ else:
87
+ yield from uniref_parser.stitch_streamed_sequences(uniref_parser.stream_uniref_gz(
88
+ 'https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref90/uniref90.fasta.gz',
89
+ chunk_size=chunk_size, use_progress_bar=use_progress_bar))
68
90
 
69
91
  @staticmethod
70
- def stream_uniref100(chunk_size=8192, use_progress_bar=False):
71
- yield from uniref_parser.stream_uniref_gz('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref50/uniref50.fasta.gz',
92
+ def stream_uniref100(chunk_size=8192, use_progress_bar=False, stitch=False):
93
+ if not stitch:
94
+ yield from uniref_parser.stream_uniref_gz('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref100/uniref100.fasta.gz',
72
95
  chunk_size=chunk_size, use_progress_bar=use_progress_bar)
96
+ else:
97
+ yield from uniref_parser.stitch_streamed_sequences(uniref_parser.stream_uniref_gz(
98
+ 'https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref100/uniref100.fasta.gz',
99
+ chunk_size=chunk_size, use_progress_bar=use_progress_bar))
100
+
101
+ @staticmethod
102
+ def download_uniref50(destination='uniref50.fasta.gz', chunk_size=8192, use_progress_bar=False):
103
+ uniref_parser.download_file('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref50/uniref50.fasta.gz', destination=destination,
104
+ chunk_size=chunk_size, use_progress_bar=use_progress_bar)
73
105
 
74
- # yield from RemoteFileHandler.stream_url(
75
- # 'https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref100/uniref100.fasta.gz', chunk_size=chunk_size)
106
+ @staticmethod
107
+ def download_uniref90(destination='uniref90.fasta.gz', chunk_size=8192, use_progress_bar=False):
108
+ uniref_parser.download_file('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref90/uniref90.fasta.gz', destination=destination,
109
+ chunk_size=chunk_size, use_progress_bar=use_progress_bar)
110
+ @staticmethod
111
+ def download_uniref100(destination='uniref100.fasta.gz', chunk_size=8192, use_progress_bar=False):
112
+ uniref_parser.download_file('https://ftp.uniprot.org/pub/databases/uniprot/uniref/uniref100/uniref100.fasta.gz', destination=destination,
113
+ chunk_size=chunk_size, use_progress_bar=use_progress_bar)
@@ -7,6 +7,9 @@ from io import TextIOWrapper
7
7
 
8
8
  class _database(ABC):
9
9
 
10
+ def __init__(self):
11
+ pass
12
+
10
13
  @abstractmethod
11
14
  def fetch(self, url):
12
15
  pass
@@ -11,6 +11,8 @@ class InvalidDistribution(Exception):
11
11
  class ImpossibleSetting(Exception):
12
12
  pass
13
13
 
14
+
15
+ # TODO This whole thing needs to be cleaned up to better align with more modern python
14
16
  class RandomProtein:
15
17
  # Hardcode data for now
16
18
  def __init__(self, His_Is_Charged=True, Cys_Is_Polar=True, Charged_Is_Polar=True, Distribution="Swiss"):
aldepyde/rand/__init__.py CHANGED
@@ -1,3 +1,6 @@
1
1
  from aldepyde.rand.RandomProtein import *
2
2
 
3
- __all__ = ['RandomProtein']
3
+ __all__ = ['RandomProtein']
4
+
5
+ import sys
6
+ sys.stderr.write("Note that the `rand` submodule is not yet fully tested and may be unstable")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aldepyde
3
- Version: 0.0.0a32
3
+ Version: 0.0.0a33
4
4
  Summary: A package of chemistry and biochemical tools
5
5
  Author-email: Nate McMurray <nate.mcmurray13@gmail.com>
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- aldepyde/__init__.py,sha256=MY5qU07PyoSEySBCRiQcjiYhME8F4EjjTeTtBOf71zE,1378
1
+ aldepyde/__init__.py,sha256=vAL59PwNON2aqFJWnN62vwuJ2Q-1F0qwbGQb3ek4dnw,862
2
2
  aldepyde/_config.py,sha256=Jne1TH8w_brEpUD3b-4XY2T8nXtWi8mTcBV5_YqMlX0,4789
3
3
  aldepyde/configurable.py,sha256=OJ7vLA-UIAmsNVw_A_j2nCERUi91kRtFGZS9Brr_7s0,214
4
4
  aldepyde/data.py,sha256=4dhArC3yt8u7sArrZ5lvWEtwFC7rhM4B02LofbQVV64,5780
@@ -9,7 +9,7 @@ aldepyde/Parsers/_pdb_parser.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
9
9
  aldepyde/biomolecule/Residue.py,sha256=CgTEIT7F4ljgxSscxzGU1AuThIRnX7i1mJ1DleUrcN0,172
10
10
  aldepyde/biomolecule/_Atom.py,sha256=XkZ-qu7U2EHbRJ7erLKV-qUc6NpizCiWbxqGZw0FHpQ,3314
11
11
  aldepyde/biomolecule/_AtomFactory.py,sha256=CA4PCESBe55ttr4riBX0F8nFToqbAAT4VSgP06_WER4,2642
12
- aldepyde/biomolecule/__init__.py,sha256=FlVxzp2MSgD6hGZUo-1mY6M4AarSxqFdNw2mpLRiu5Y,482
12
+ aldepyde/biomolecule/__init__.py,sha256=mBr_PozzTu70-rgMWXFFJQB5ZINjQBFOo5F7Lt-JdQg,597
13
13
  aldepyde/biomolecule/_amino_acid.py,sha256=Ovgx12oygCDQuZjSSRVhdMY7nNPhJWFgcLIB537x-QM,116
14
14
  aldepyde/biomolecule/_dna.py,sha256=VWanPQRkD_GHMLjudSsZkDzIHVMWqcPB87b4APpGZC0,102
15
15
  aldepyde/biomolecule/_pdb.py,sha256=fh0hZaueFV8EuKfGBTpmCyI40fR7l6HYUFiGAS1kGto,17244
@@ -24,20 +24,20 @@ aldepyde/data/RemoteFileHandler.py,sha256=aPASdoYgt0xnRrSYiwMcefQAizLIbB93SKVrlf
24
24
  aldepyde/data/__init__.py,sha256=_yKL38EKhXkRM8PSafeee0A6VXGncAoUXVdUyiJ5n3s,48
25
25
  aldepyde/databases/PDB.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  aldepyde/databases/RemoteFileHandler.py,sha256=HHx69o6IpI60lf_7hY1ZwI8k0OVyfofG4x1bFeF1uL4,1231
27
- aldepyde/databases/UniRef.py,sha256=AMRUXe8hy6il7EDWcBeQAM2g51_t3q0y-UoXhIPJpdU,3567
27
+ aldepyde/databases/UniRef.py,sha256=9Inu5rnmm7xoPUtg6I2ge6sKh7IYFR1q_8orK-ZtaI0,5614
28
28
  aldepyde/databases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- aldepyde/databases/_database.py,sha256=ZRwGWyuhXHe9i0WYzStqRL7-SYevQkR5Jik7J360a2A,949
29
+ aldepyde/databases/_database.py,sha256=i5cXf65d2YYIJMvCDaeAVYfXTZeJsIpwBMWDONFAGlw,990
30
30
  aldepyde/fetcher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  aldepyde/fetcher/test.py,sha256=Q0O3TrMnyd_V3QZvMaDtkFGXIvtQLg57RofKjxtG8Y8,23
32
32
  aldepyde/json/CHG.json,sha256=igz1QSwoyXieOWMRwPnQjUJX29N5bk5OBVkhpFjyCzo,614
33
33
  aldepyde/json/Swiss_Prot.json,sha256=mJiUiYnvDLa_59tlb_hcIsaYGFrwvJAorwhHc2O9H1U,612
34
34
  aldepyde/json/chemistry.json,sha256=pCWYNRv5xVEMuhYi1nn1RutgsoFSMo_TRu1dk_TYyds,124436
35
- aldepyde/rand/RandomProtein.py,sha256=CaFYJh8WiT5hvvWONXNkJAEVLefu7qPfnLi7WR5YL1g,16056
36
- aldepyde/rand/__init__.py,sha256=1EztGz5e6NRmKuAfp66trQDDa5ov-_ZkxrD9Zp8fScA,72
35
+ aldepyde/rand/RandomProtein.py,sha256=sNXx4jop9Fplz2oz4g6pEArF69j31_PvtiZuRpLz51I,16146
36
+ aldepyde/rand/__init__.py,sha256=Q30wrG_XHrmdgaXaLWSlce_ZGT_ZpOT3CYLDj6OgEy0,182
37
37
  aldepyde/stats/ProteinStats.py,sha256=t_gqhld2wKweszPZvtHhrORadFc28glFx5OgJs23TsM,2569
38
38
  aldepyde/stats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- aldepyde-0.0.0a32.dist-info/licenses/LICENSE,sha256=VbOVaNlEaWa9cnYi8gOnenCBAVk9s_P3J_z-n_F-638,1091
40
- aldepyde-0.0.0a32.dist-info/METADATA,sha256=VpqfGzulHQ-omiPapAvVCVMIRGeTxPKUroF8FJkKBe8,2554
41
- aldepyde-0.0.0a32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
- aldepyde-0.0.0a32.dist-info/top_level.txt,sha256=xv0YJ1izG4AP9ZlielN_0z9QGQQdwtHFM3-TmJivBOM,9
43
- aldepyde-0.0.0a32.dist-info/RECORD,,
39
+ aldepyde-0.0.0a33.dist-info/licenses/LICENSE,sha256=VbOVaNlEaWa9cnYi8gOnenCBAVk9s_P3J_z-n_F-638,1091
40
+ aldepyde-0.0.0a33.dist-info/METADATA,sha256=II-y79yF2xeV5RAsqd-AP9BvW7N0C38vvpGvfgLt_TI,2554
41
+ aldepyde-0.0.0a33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
+ aldepyde-0.0.0a33.dist-info/top_level.txt,sha256=xv0YJ1izG4AP9ZlielN_0z9QGQQdwtHFM3-TmJivBOM,9
43
+ aldepyde-0.0.0a33.dist-info/RECORD,,