pybiolib 1.2.102.dev1__py3-none-any.whl → 1.2.106.dev1__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.
- biolib/utils/seq_util.py +8 -4
- {pybiolib-1.2.102.dev1.dist-info → pybiolib-1.2.106.dev1.dist-info}/METADATA +1 -1
- {pybiolib-1.2.102.dev1.dist-info → pybiolib-1.2.106.dev1.dist-info}/RECORD +6 -6
- {pybiolib-1.2.102.dev1.dist-info → pybiolib-1.2.106.dev1.dist-info}/LICENSE +0 -0
- {pybiolib-1.2.102.dev1.dist-info → pybiolib-1.2.106.dev1.dist-info}/WHEEL +0 -0
- {pybiolib-1.2.102.dev1.dist-info → pybiolib-1.2.106.dev1.dist-info}/entry_points.txt +0 -0
biolib/utils/seq_util.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import re
|
2
|
-
from io import BufferedIOBase,
|
2
|
+
from io import BufferedIOBase, TextIOBase
|
3
3
|
|
4
4
|
from biolib.typing_utils import Dict, List, Optional, Union, Iterator
|
5
5
|
|
@@ -59,7 +59,7 @@ class SeqUtil:
|
|
59
59
|
for line in file_handle:
|
60
60
|
yield line.decode('utf-8')
|
61
61
|
|
62
|
-
def
|
62
|
+
def line_generator_from_text_io_base(file_handle: TextIOBase) -> Iterator[str]:
|
63
63
|
for line in file_handle:
|
64
64
|
yield line
|
65
65
|
|
@@ -71,10 +71,12 @@ class SeqUtil:
|
|
71
71
|
|
72
72
|
file_handle = None
|
73
73
|
if isinstance(input_file, str):
|
74
|
-
file_handle = open(input_file, "
|
75
|
-
line_iterator =
|
74
|
+
file_handle = open(input_file, "rb")
|
75
|
+
line_iterator = line_generator_from_buffered_io_base(file_handle)
|
76
76
|
elif isinstance(input_file, BufferedIOBase):
|
77
77
|
line_iterator = line_generator_from_buffered_io_base(input_file)
|
78
|
+
elif isinstance(input_file, TextIOBase):
|
79
|
+
line_iterator = line_generator_from_text_io_base(input_file)
|
78
80
|
else:
|
79
81
|
raise ValueError('input_file must be a file name (str) or a BufferedIOBase object')
|
80
82
|
|
@@ -84,6 +86,8 @@ class SeqUtil:
|
|
84
86
|
try:
|
85
87
|
for line_number, line in enumerate(line_iterator):
|
86
88
|
line = line.strip()
|
89
|
+
if not line:
|
90
|
+
continue # skip empty lines
|
87
91
|
if line.startswith('>'):
|
88
92
|
if header is not None:
|
89
93
|
yield from process_and_yield_record(header, sequence_lines)
|
@@ -117,10 +117,10 @@ biolib/utils/__init__.py,sha256=fwjciJyJicvYyZcVTzfDBgD0SKY13DeXqvTeG4qZIy8,5548
|
|
117
117
|
biolib/utils/app_uri.py,sha256=Yq_-_VGugQhMMo6mM5f0G9yNlLkr0WK4j0Nrf3FE4xQ,2171
|
118
118
|
biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3100
|
119
119
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
120
|
-
biolib/utils/seq_util.py,sha256=
|
120
|
+
biolib/utils/seq_util.py,sha256=WJnU9vZdwY8RHXvzATyV80OXzyJ7w9EkG33Tna9Nr6A,5698
|
121
121
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
122
|
-
pybiolib-1.2.
|
123
|
-
pybiolib-1.2.
|
124
|
-
pybiolib-1.2.
|
125
|
-
pybiolib-1.2.
|
126
|
-
pybiolib-1.2.
|
122
|
+
pybiolib-1.2.106.dev1.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
123
|
+
pybiolib-1.2.106.dev1.dist-info/METADATA,sha256=nfPXBgHW1zZD412eFZ2Z-XG2qpNAsDOVrfbc43mksGU,1512
|
124
|
+
pybiolib-1.2.106.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
125
|
+
pybiolib-1.2.106.dev1.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
126
|
+
pybiolib-1.2.106.dev1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|