pybiolib 1.2.980__py3-none-any.whl → 1.2.985__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.
@@ -86,25 +86,23 @@ def fasta_batch_records(records, work_per_batch_min, work_per_residue=1, verbose
86
86
 
87
87
  batches = []
88
88
  batch = []
89
- current_work_units = 0
90
- total_work_units = 0
89
+ current_longest_seq_len = 0
91
90
  for record in records:
92
- # Add to batch
93
- batch.append(record)
94
-
95
- # Calculate work units
96
- seq = record.sequence
97
- sequence_work_units = len(seq) * work_per_residue
91
+ seq_len = len(record.sequence)
92
+ potential_longest_seq_len = max(current_longest_seq_len, seq_len)
98
93
 
99
- # Increase counters
100
- current_work_units += sequence_work_units
101
- total_work_units += sequence_work_units
94
+ # Calculate work units if we were to add this record
95
+ potential_work_units = potential_longest_seq_len * work_per_residue * (len(batch) + 1)
102
96
 
103
- # If above limit, start a new batch
104
- if current_work_units >= work_per_batch_min:
97
+ if potential_work_units >= work_per_batch_min and len(batch) > 0:
105
98
  batches.append(batch)
106
99
  batch = []
107
- current_work_units = 0
100
+ current_longest_seq_len = 0
101
+ potential_longest_seq_len = seq_len
102
+
103
+ # Add to batch
104
+ batch.append(record)
105
+ current_longest_seq_len = potential_longest_seq_len
108
106
 
109
107
  # Append last batch if present
110
108
  if batch:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pybiolib
3
- Version: 1.2.980
3
+ Version: 1.2.985
4
4
  Summary: BioLib Python Client
5
5
  License: MIT
6
6
  Keywords: biolib
@@ -51,7 +51,7 @@ biolib/_internal/types/result.py,sha256=MesSTBXCkaw8HydXgHf1OKGVLzsxhZ1KV5z4w-VI
51
51
  biolib/_internal/types/typing.py,sha256=qrsk8hHcGEbDpU1QQFzHAKnhQxkMe7uJ6pxHeAnfv1Y,414
52
52
  biolib/_internal/types/user.py,sha256=5_hYG0jrdGxynCCWXGaHZCAlVcRKBqMIEA2EBGrnpiE,439
53
53
  biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
54
- biolib/_internal/utils/multinode.py,sha256=-J3PEAK3NaOwCn--5T7vWHkA3yu5w9QhmuhkQcH-2wY,8229
54
+ biolib/_internal/utils/multinode.py,sha256=N7kR49xD1PdkMVlxxzRiSYHfgi9MG-kLCwemcY1rojg,8323
55
55
  biolib/_runtime/runtime.py,sha256=Z9YVF8e2A1VMdndEf7CIGqvVKHS7FPY0VGmRgLBB7ck,5699
56
56
  biolib/_session/session.py,sha256=US1Y1jfFIAm86-Lq3C7nCXpZXUJXXBVBkND9djMNYxI,1649
57
57
  biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
@@ -146,8 +146,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
146
146
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
147
147
  biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
148
148
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
149
- pybiolib-1.2.980.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
150
- pybiolib-1.2.980.dist-info/METADATA,sha256=77xEPJfd-BquWYU05wt6-i58ZJi4vG6jxtHnpaZggtM,1570
151
- pybiolib-1.2.980.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
152
- pybiolib-1.2.980.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
153
- pybiolib-1.2.980.dist-info/RECORD,,
149
+ pybiolib-1.2.985.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
150
+ pybiolib-1.2.985.dist-info/METADATA,sha256=_-kdUgRMvtN7R7I8bf2eqmBOOB3YYQuY_VBFpfjpgs8,1570
151
+ pybiolib-1.2.985.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
152
+ pybiolib-1.2.985.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
153
+ pybiolib-1.2.985.dist-info/RECORD,,