Skip to content

Commit 200e05d

Browse files
committed
fixed seq read error
1 parent ab21c3d commit 200e05d

File tree

6 files changed

+40
-23
lines changed

6 files changed

+40
-23
lines changed

.github/workflows/wheel.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jobs:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
os: [windows-2019, ubuntu-20.04, macos-13]
11+
os: [windows-2022, ubuntu-22.04, macos-15, macos-15-intel]
1212

1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v6
1515

16-
- uses: actions/setup-python@v5
16+
- uses: actions/setup-python@v6
1717
with:
18-
python-version: "3.10"
18+
python-version: "3.12"
1919

2020
- name: Set up QEMU
2121
if: runner.os == 'Linux'
@@ -24,12 +24,11 @@ jobs:
2424
platforms: all
2525

2626
- name: Build wheels
27-
uses: pypa/cibuildwheel@v2.22.0
27+
uses: pypa/cibuildwheel@v3.3.1
2828
env:
29-
CIBW_SKIP: pp*
29+
CIBW_SKIP: pp* gp*
3030
CIBW_BUILD_VERBOSITY: 0
31-
#CIBW_ARCHS_LINUX: auto aarch64
32-
#CIBW_ARCHS_MACOS: x86_64 arm64 universal2
31+
CIBW_ARCHS: auto64
3332
CIBW_TEST_COMMAND: python {project}/setup.py build_ext -i && pytest {project}/tests
3433
CIBW_TEST_REQUIRES: pyfaidx==0.5.8 pytest
3534

@@ -46,12 +45,12 @@ jobs:
4645
name: Build source distribution
4746
runs-on: ubuntu-latest
4847
steps:
49-
- uses: actions/checkout@v4
48+
- uses: actions/checkout@v6
5049

51-
- uses: actions/setup-python@v5
50+
- uses: actions/setup-python@v6
5251
name: Install Python
5352
with:
54-
python-version: "3.10"
53+
python-version: "3.12"
5554

5655
- name: Build sdist
5756
run: python setup.py sdist
@@ -69,7 +68,7 @@ jobs:
6968
runs-on: ubuntu-latest
7069
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
7170
steps:
72-
- uses: actions/download-artifact@v4
71+
- uses: actions/download-artifact@v5
7372
with:
7473
pattern: artifact-*
7574
merge-multiple: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,7 @@ indexed_gzip-1.9.4.zip
9393
pyfastx.cpython-39-darwin.so
9494
sqlite-amalgamation-3470200.zip
9595
zlib-1.3.1.zip
96+
/indexed_gzip-1.10.3
97+
indexed_gzip-1.10.3.zip
98+
pyfastx.cpython-312-x86_64-linux-gnu.so
99+
src.zip

setup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def prepare_indexed_gzip():
5454
global include_dirs
5555
global sources
5656

57-
igzip_dir = os.path.join(root_dir, "indexed_gzip-1.9.4", "indexed_gzip")
58-
igzip_file = os.path.join(root_dir, "indexed_gzip-1.9.4.zip")
59-
url = "https://github.com/pauldmccarthy/indexed_gzip/archive/refs/tags/v1.9.4.zip"
57+
igzip_dir = os.path.join(root_dir, "indexed_gzip-1.10.3", "indexed_gzip")
58+
igzip_file = os.path.join(root_dir, "indexed_gzip-1.10.3.zip")
59+
url = "https://github.com/pauldmccarthy/indexed_gzip/archive/refs/tags/v1.10.3.zip"
6060

6161
if not os.path.exists(igzip_dir):
6262
if not os.path.isfile(igzip_file):
@@ -168,14 +168,13 @@ def build_extensions(self):
168168
"Natural Language :: English",
169169
"License :: OSI Approved :: MIT License",
170170
"Programming Language :: C",
171-
"Programming Language :: Python :: 3.6",
172-
"Programming Language :: Python :: 3.7",
173171
"Programming Language :: Python :: 3.8",
174172
"Programming Language :: Python :: 3.9",
175173
"Programming Language :: Python :: 3.10",
176174
"Programming Language :: Python :: 3.11",
177175
"Programming Language :: Python :: 3.12",
178176
"Programming Language :: Python :: 3.13",
177+
"Programming Language :: Python :: 3.14",
179178
"Operating System :: Microsoft :: Windows",
180179
"Operating System :: POSIX :: Linux",
181180
"Operating System :: Unix",

src/fasta.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ PyObject * pyfastx_fasta_slice_from_cache(pyfastx_Fasta *self, Py_ssize_t start,
208208

209209
PyObject *ret;
210210

211+
if (flank < 0) {
212+
PyErr_SetString(PyExc_ValueError, "Flank length must be non-negative");
213+
return NULL;
214+
}
215+
211216
slice_start = start - flank - 1;
212217
if (slice_start < 0) {
213218
slice_len = flank + slice_start;

src/read.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ void pyfastx_read_continue_reader(pyfastx_Read *self) {
5454
Py_ssize_t offset;
5555
Py_ssize_t offset1;
5656

57+
if (self->raw) {
58+
return;
59+
}
60+
5761
//read raw string offset
5862
offset = self->seq_offset - self->desc_len - 1;
5963
offset1 = offset;
@@ -251,12 +255,14 @@ PyObject* pyfastx_read_quali(pyfastx_Read *self, void* closure) {
251255
PyObject *quals;
252256
PyObject *q;
253257

254-
if (self->middle->iterating) {
255-
pyfastx_read_continue_reader(self);
256-
} else if (!self->qual) {
257-
self->qual = (char *)malloc(self->read_len + 1);
258-
pyfastx_read_random_reader(self, self->qual, self->qual_offset, self->read_len);
259-
self->qual[self->read_len] = '\0';
258+
if (!self->qual) {
259+
if (self->middle->iterating) {
260+
pyfastx_read_continue_reader(self);
261+
} else {
262+
self->qual = (char *)malloc(self->read_len + 1);
263+
pyfastx_read_random_reader(self, self->qual, self->qual_offset, self->read_len);
264+
self->qual[self->read_len] = '\0';
265+
}
260266
}
261267

262268
phred = self->middle->phred ? self->middle->phred : 33;

src/sequence.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ void pyfastx_sequence_continue_read(pyfastx_Sequence* self) {
1414
Py_ssize_t gap;
1515
Py_ssize_t rlen;
1616

17+
if (self->raw) {
18+
return;
19+
}
20+
1721
//raw string offset and bytelen
1822
header_len = self->desc_len + self->end_len + 1;
1923
offset = self->offset - header_len;

0 commit comments

Comments
 (0)