aldepyde 0.0.0a1__py3-none-any.whl → 0.0.0a32__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.

Files changed (45) hide show
  1. aldepyde/Parsers/_mmcif_parser.py +0 -0
  2. aldepyde/Parsers/_pdb_parser.py +0 -0
  3. aldepyde/__init__.py +50 -0
  4. aldepyde/_config.py +113 -0
  5. aldepyde/biomolecule/Residue.py +9 -0
  6. aldepyde/biomolecule/_Atom.py +95 -0
  7. aldepyde/biomolecule/_AtomFactory.py +71 -0
  8. aldepyde/biomolecule/__init__.py +15 -0
  9. aldepyde/biomolecule/_amino_acid.py +6 -0
  10. aldepyde/biomolecule/_dna.py +6 -0
  11. aldepyde/biomolecule/_pdb.py +455 -0
  12. aldepyde/biomolecule/_rna.py +6 -0
  13. aldepyde/biomolecule/utils.py +60 -0
  14. aldepyde/cache/__init__.py +2 -0
  15. aldepyde/cache/_cache.py +257 -0
  16. aldepyde/cache/cachemanager.py +212 -0
  17. aldepyde/cache/downloader.py +13 -0
  18. aldepyde/cache/utils.py +32 -0
  19. aldepyde/configurable.py +7 -0
  20. aldepyde/data/RemoteFileHandler.py +32 -0
  21. aldepyde/data/__init__.py +1 -0
  22. aldepyde/data.py +148 -0
  23. aldepyde/databases/PDB.py +0 -0
  24. aldepyde/databases/RemoteFileHandler.py +43 -0
  25. aldepyde/databases/UniRef.py +75 -0
  26. aldepyde/databases/__init__.py +0 -0
  27. aldepyde/databases/_database.py +38 -0
  28. aldepyde/env.py +43 -0
  29. aldepyde/fetcher/__init__.py +0 -0
  30. aldepyde/fetcher/test.py +2 -0
  31. aldepyde/json/CHG.json +25 -0
  32. aldepyde/json/Swiss_Prot.json +25 -0
  33. aldepyde/json/chemistry.json +4622 -0
  34. aldepyde/rand/RandomProtein.py +402 -0
  35. aldepyde/rand/__init__.py +3 -0
  36. aldepyde/stats/ProteinStats.py +89 -0
  37. aldepyde/stats/__init__.py +0 -0
  38. aldepyde/utils.py +275 -0
  39. {aldepyde-0.0.0a1.dist-info → aldepyde-0.0.0a32.dist-info}/METADATA +4 -3
  40. aldepyde-0.0.0a32.dist-info/RECORD +43 -0
  41. {aldepyde-0.0.0a1.dist-info → aldepyde-0.0.0a32.dist-info}/WHEEL +1 -1
  42. aldepyde-0.0.0a32.dist-info/top_level.txt +1 -0
  43. aldepyde-0.0.0a1.dist-info/RECORD +0 -5
  44. aldepyde-0.0.0a1.dist-info/top_level.txt +0 -1
  45. {aldepyde-0.0.0a1.dist-info → aldepyde-0.0.0a32.dist-info/licenses}/LICENSE +0 -0
aldepyde/utils.py ADDED
@@ -0,0 +1,275 @@
1
+ import sys
2
+ import time
3
+
4
+ # I'm sorry tqdm. I love you too :(
5
+ # This is NOT meant to replace tqdm. Only bother using this if you are on
6
+ # a restrictive system that doesn't allow 3rd party resources
7
+ class ProgressBar():
8
+ def __init__(self, itb=None, ascii=False, blength=30, total=None, minupdate=.1, fp=sys.stdout):
9
+ self.itb = self.iterize(itb)
10
+ self.ascii = ascii
11
+ self.blength = blength
12
+ self.minupdate = minupdate
13
+ self._ascii_char = self.default_ascii()
14
+ self._uni_char = self.default_uni()
15
+ self._empty = self.default_empty()
16
+ self._progress_printer = self._print_bar if total != 0 else self._print_current
17
+ self.fp = fp
18
+ self.description = ""
19
+ self.current = 0
20
+ self.start = -1
21
+
22
+
23
+ if total is None:
24
+ try:
25
+ self.total = len(self.itb)
26
+ except TypeError:
27
+ self.total = 0
28
+ else:
29
+ self.total = total
30
+
31
+ def load(self, itb):
32
+ self.itb = self.iterize(itb)
33
+
34
+ def set_total(self, total):
35
+ self.total = total
36
+
37
+ def __iter__(self):
38
+ it = self.itb
39
+ minupdate = self.minupdate
40
+ self.start = last = time.perf_counter()
41
+ current = 0
42
+ pbar_type = self._print_current if self.total == 0 else self._print_bar
43
+ fp = self.fp
44
+ for item in iter(it):
45
+ yield item
46
+ current += 1
47
+ self.current = current
48
+ now = time.perf_counter()
49
+ if now - last >= minupdate:
50
+ last = now
51
+ fp.write("".join(["\r", self.description, pbar_type(current)]))
52
+ fp.write("".join(["\r", self.description , pbar_type(current)]))
53
+ fp.write('\n')
54
+
55
+ def update(self, current=1):
56
+ self.current += 1
57
+ if self.start == -1:
58
+ self.start = time.perf_counter()
59
+ if self.total == 0:
60
+ self.sp.write("".join(["\r", self.description ,self._print_current(self.current)]))
61
+ else:
62
+ self.fp.write("".join(["\r",self.description ,self._print_bar(self.current)]))
63
+
64
+ def _print_current(self, current:int) -> str:
65
+ return "".join([str(current), self._get_meta_current(current)])
66
+
67
+ def _get_meta_current(self, current):
68
+ elapsed = time.perf_counter() - self.start
69
+ eh, er = divmod(elapsed, 3600)
70
+ em, es = divmod(er, 60)
71
+ eh = int(eh)
72
+ em = int(em)
73
+ es = int(es)
74
+ rate = round(current / elapsed)
75
+ elp = "".join([str(eh).zfill(2), ':', str(em).zfill(2), ':', str(es).zfill(2)])
76
+ return "".join(['|', '|ELP ' , elp, '|', str(rate), ' itr/sec'])
77
+
78
+ def _print_bar(self, current:int) -> str:
79
+ completed = current / self.total
80
+ cycle = self._ascii_char if self.ascii else self._uni_char
81
+ if len(cycle) == 1:
82
+ return "".join([cycle[0]*round(completed*self.blength), self._empty*(self.blength - round(completed*self.blength)), self._get_meta_pbar(current)])
83
+ else:
84
+ full = min(len(cycle[-1] * int(completed * self.blength)), self.blength)
85
+ empty = self.blength - full - 1
86
+ bridge_index = round(((self.blength * completed)%1) * (len(cycle) - 1))
87
+ bridge = "" if empty < 0 else cycle[bridge_index]
88
+ return "".join( ['[', cycle[-1] * full, bridge, self._empty*empty, self._get_meta_pbar(current), ']'])
89
+
90
+
91
+ def _get_meta_pbar(self, current):
92
+ elapsed = time.perf_counter() - self.start
93
+ eh, er = divmod(elapsed, 3600)
94
+ em, es = divmod(er, 60)
95
+ eh = int(eh)
96
+ em = int(em)
97
+ es = int(es)
98
+ rate = round(current / elapsed)
99
+ eta = (self.total - current) / (rate + 0.00001)
100
+ h, r = divmod(eta, 3600)
101
+ m, s = divmod(r, 60)
102
+ h = int(h)
103
+ m = int(m)
104
+ s = int(s)
105
+ rs = "".join([str(h).zfill(2), ':', str(m).zfill(2), ':', str(s).zfill(2)])
106
+ elp = "".join([str(eh).zfill(2), ':', str(em).zfill(2), ':', str(es).zfill(2)])
107
+ return "".join(['|', str(round(100*current/self.total)), '%|ETA ', rs, '|ELP ' , elp, '|', str(rate), ' itr/sec'])
108
+
109
+
110
+ def iterize(self, itb):
111
+ if isinstance(itb, int):
112
+ return range(itb)
113
+ else:
114
+ try:
115
+ iter(itb)
116
+ return itb
117
+ except TypeError:
118
+ sys.stderr.write("The object loaded into the progress bar is not iterable")
119
+ return None
120
+
121
+ def default_empty(self):
122
+ return '-'
123
+
124
+ def set_empty(self, char: str):
125
+ if len(char) != 1:
126
+ raise ValueError("The empty character must only be one character")
127
+ self._empty = char
128
+
129
+ def default_ascii(self):
130
+ return ('@')
131
+
132
+ def set_ascii(self, progression : tuple):
133
+ self._ascii_char = progression
134
+
135
+ def default_uni(self):
136
+ return ('░', '▒', '▓', '█')
137
+
138
+ def set_uni(self, progression : tuple):
139
+ self._uni_char = progression
140
+
141
+ def set_description(self, desc):
142
+ self.description = desc
143
+
144
+
145
+
146
+
147
+ class ProgressBar_dep():
148
+ def __init__(self, itb=None, force_ascii=False, force_spinner=False, bar_length=10):
149
+ self.itb = None
150
+ self.iterator = None
151
+ self.current = 0
152
+ self.total = 0
153
+ self.bar_length = bar_length
154
+ self.description = ""
155
+ self._force_ascii = force_ascii
156
+ self.empty = ' '
157
+ self.spinner = ['\\', '|', '/', '-']
158
+ # TODO Make _quarters adjustable
159
+ self._quarters = ['░', '▒', '▓', '█']
160
+ self.set_quarters(self._quarters)
161
+ self._force_spinner=force_spinner
162
+ self.set_force_ascii(self._force_ascii)
163
+ self.times = []
164
+ if itb is None:
165
+ return
166
+ else:
167
+ self.load(itb)
168
+
169
+ # Mostly for debugging
170
+ def set_force_spinner(self, force_spinner):
171
+ self._force_spinner = force_spinner
172
+
173
+ # Mostly for debugging
174
+ def set_force_ascii(self, force_ascii):
175
+ self._force_ascii = force_ascii
176
+ if not force_ascii:
177
+ self.spinner = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
178
+ else:
179
+ self.spinner = ['\\', '|', '/', '-']
180
+
181
+ def set_quarters(self, quarters):
182
+ self._quarters = [self.empty] + quarters
183
+
184
+ def set_total(self, total):
185
+ self.total = total
186
+
187
+ def load(self, itb):
188
+ if itb is not None:
189
+ if isinstance(itb, int):
190
+ itb = range(itb)
191
+ try:
192
+ iter(itb)
193
+ self.current = 0
194
+ self.description = ""
195
+ self.itb = itb
196
+ self.iterator = iter(self.itb)
197
+ try:
198
+ self.total = len(itb)
199
+ except TypeError:
200
+ self.total = 0
201
+
202
+ except TypeError:
203
+ print("The object loaded into the progress bar is not iterable", file=sys.stderr)
204
+
205
+
206
+ def update(self, updates : int):
207
+ self.current += updates
208
+
209
+ def set_description(self, description):
210
+ if description is None:
211
+ description = ""
212
+ self.description = description
213
+
214
+ # TODO Toggle ETA
215
+ def eta(self):
216
+ if len(self.times) == 2:
217
+ try:
218
+ seconds = (self.times[1] - self.times[0]) * (self.total - self.current)
219
+ hours, remainder = divmod(seconds, 3600)
220
+ minutes, sec = divmod(remainder, 60)
221
+ tstr = ""
222
+ if hours >= 1:
223
+ tstr += f"{int(hours)}h "
224
+ if minutes >= 1:
225
+ tstr += f"{int(minutes)}m "
226
+ tstr += f"{round(sec)}s "
227
+ return f" {{{tstr}}}"
228
+ except ZeroDivisionError:
229
+ return ""
230
+ else:
231
+ return ""
232
+
233
+ def push_time(self, t):
234
+ while len(self.times) >= 2:
235
+ self.times.pop(0)
236
+ self.times.append(t)
237
+
238
+ def _progress_as_bar(self) -> str:
239
+ return ""
240
+ try:
241
+ current_progress = self.current / self.total
242
+ except ZeroDivisionError:
243
+ return ""
244
+ if self._force_ascii:
245
+ current_progress = round(current_progress * self.bar_length)
246
+ return '*' * current_progress + '-' * (self.bar_length - current_progress)
247
+ else:
248
+ current_progress = current_progress * self.bar_length
249
+ whole_length = int(current_progress // 1)
250
+ whole_portion = self._quarters[-1] * whole_length
251
+ bp = round((current_progress%1) * 4)
252
+ bridge = self._quarters[bp]
253
+ decimal_portion = '-' * (self.bar_length - whole_length - 1)
254
+ return whole_portion + bridge + decimal_portion
255
+
256
+ def __iter__(self):
257
+ return self
258
+
259
+ def __next__(self):
260
+ try:
261
+ self.push_time(time())
262
+ item = next(self.iterator)
263
+
264
+ self.current += 1
265
+ d = " | " + self.description if len(self.description) != 0 else ""
266
+ return item
267
+
268
+ progress_statement = f"{self.current}/{self.total}" if self.total != 0 and not self._force_spinner else f"{self.current} {self.spinner[self.current % len(self.spinner)]}"
269
+ sys.stdout.write('\r' + self._progress_as_bar() + ' ' + progress_statement + d + self.eta())
270
+ sys.stdout.flush()
271
+ return item
272
+
273
+ except StopIteration:
274
+ print()
275
+ raise
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: aldepyde
3
- Version: 0.0.0a1
3
+ Version: 0.0.0a32
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
@@ -35,10 +35,11 @@ Classifier: Operating System :: OS Independent
35
35
  Requires-Python: >=3.8
36
36
  Description-Content-Type: text/markdown
37
37
  License-File: LICENSE
38
+ Dynamic: license-file
38
39
 
39
40
  <p align="left"><img src="https://github.com/cathepsin/aldepyde/blob/main/Aldepyde%20rough.png" height="250"/></p>
40
41
 
41
- #### A module for mangling biomolecules
42
+ ### A module for mangling biomolecules
42
43
  ---
43
44
  AldePYde is a module of spite. Being frustrated with either the lack of obscure potential or the difficult and steep learning curve of other similar modules,
44
45
  I made this. Here I present my various tools for chem/bioinformatics. This is all very much a work-in-progress, especially as I move over functionality from my
@@ -0,0 +1,43 @@
1
+ aldepyde/__init__.py,sha256=MY5qU07PyoSEySBCRiQcjiYhME8F4EjjTeTtBOf71zE,1378
2
+ aldepyde/_config.py,sha256=Jne1TH8w_brEpUD3b-4XY2T8nXtWi8mTcBV5_YqMlX0,4789
3
+ aldepyde/configurable.py,sha256=OJ7vLA-UIAmsNVw_A_j2nCERUi91kRtFGZS9Brr_7s0,214
4
+ aldepyde/data.py,sha256=4dhArC3yt8u7sArrZ5lvWEtwFC7rhM4B02LofbQVV64,5780
5
+ aldepyde/env.py,sha256=409OK1bbu5JMxpMfVWHqmzjlZ_tF7odd8jomp6-tx6A,1540
6
+ aldepyde/utils.py,sha256=zzAj913YrtVrhrd5a-HZC3U9U6e9KF0cf4gFtU3Dm60,9676
7
+ aldepyde/Parsers/_mmcif_parser.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ aldepyde/Parsers/_pdb_parser.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ aldepyde/biomolecule/Residue.py,sha256=CgTEIT7F4ljgxSscxzGU1AuThIRnX7i1mJ1DleUrcN0,172
10
+ aldepyde/biomolecule/_Atom.py,sha256=XkZ-qu7U2EHbRJ7erLKV-qUc6NpizCiWbxqGZw0FHpQ,3314
11
+ aldepyde/biomolecule/_AtomFactory.py,sha256=CA4PCESBe55ttr4riBX0F8nFToqbAAT4VSgP06_WER4,2642
12
+ aldepyde/biomolecule/__init__.py,sha256=FlVxzp2MSgD6hGZUo-1mY6M4AarSxqFdNw2mpLRiu5Y,482
13
+ aldepyde/biomolecule/_amino_acid.py,sha256=Ovgx12oygCDQuZjSSRVhdMY7nNPhJWFgcLIB537x-QM,116
14
+ aldepyde/biomolecule/_dna.py,sha256=VWanPQRkD_GHMLjudSsZkDzIHVMWqcPB87b4APpGZC0,102
15
+ aldepyde/biomolecule/_pdb.py,sha256=fh0hZaueFV8EuKfGBTpmCyI40fR7l6HYUFiGAS1kGto,17244
16
+ aldepyde/biomolecule/_rna.py,sha256=VNUpitmymT1UegcR4kQCr-DQvy_Sf1S4IV7ZZ1pl9Bs,102
17
+ aldepyde/biomolecule/utils.py,sha256=VilApyR56jNr1McKEDLLT-2c72Iu2QnFhAuAn_4Weeo,1715
18
+ aldepyde/cache/__init__.py,sha256=R_AaOpCnIY8TlsABi-YvSP1NqUZOuYtn45T1ZsKJ3ME,76
19
+ aldepyde/cache/_cache.py,sha256=QWPTbUC6qaFuawoXXX5T7EBFYGmTgYkqfTTlo7GOAmc,10430
20
+ aldepyde/cache/cachemanager.py,sha256=ARS7JGzMtjMt0kUt6FznqpwK6CJ52q1XyFkQT1KaB9s,7311
21
+ aldepyde/cache/downloader.py,sha256=yD2okj5ZYP_fooIBOhn1T9tayyup00NlH2SnRow18CY,347
22
+ aldepyde/cache/utils.py,sha256=M3R_4Z8ZM8YEiJX9AnFqDzLXrqKB9lbXpWEYw7DFBs8,1177
23
+ aldepyde/data/RemoteFileHandler.py,sha256=aPASdoYgt0xnRrSYiwMcefQAizLIbB93SKVrlfXfrds,925
24
+ aldepyde/data/__init__.py,sha256=_yKL38EKhXkRM8PSafeee0A6VXGncAoUXVdUyiJ5n3s,48
25
+ aldepyde/databases/PDB.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ aldepyde/databases/RemoteFileHandler.py,sha256=HHx69o6IpI60lf_7hY1ZwI8k0OVyfofG4x1bFeF1uL4,1231
27
+ aldepyde/databases/UniRef.py,sha256=AMRUXe8hy6il7EDWcBeQAM2g51_t3q0y-UoXhIPJpdU,3567
28
+ aldepyde/databases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
+ aldepyde/databases/_database.py,sha256=ZRwGWyuhXHe9i0WYzStqRL7-SYevQkR5Jik7J360a2A,949
30
+ aldepyde/fetcher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ aldepyde/fetcher/test.py,sha256=Q0O3TrMnyd_V3QZvMaDtkFGXIvtQLg57RofKjxtG8Y8,23
32
+ aldepyde/json/CHG.json,sha256=igz1QSwoyXieOWMRwPnQjUJX29N5bk5OBVkhpFjyCzo,614
33
+ aldepyde/json/Swiss_Prot.json,sha256=mJiUiYnvDLa_59tlb_hcIsaYGFrwvJAorwhHc2O9H1U,612
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
37
+ aldepyde/stats/ProteinStats.py,sha256=t_gqhld2wKweszPZvtHhrORadFc28glFx5OgJs23TsM,2569
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1 @@
1
+ aldepyde
@@ -1,5 +0,0 @@
1
- aldepyde-0.0.0a1.dist-info/LICENSE,sha256=VbOVaNlEaWa9cnYi8gOnenCBAVk9s_P3J_z-n_F-638,1091
2
- aldepyde-0.0.0a1.dist-info/METADATA,sha256=grDlZURg0kPsDeLidwdcKOJdbhfgPSjEHj5PlzQtqhQ,2531
3
- aldepyde-0.0.0a1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
4
- aldepyde-0.0.0a1.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
5
- aldepyde-0.0.0a1.dist-info/RECORD,,
@@ -1 +0,0 @@
1
-