Skip to content

Commit

Permalink
routine maintenance (May 2023)
Browse files Browse the repository at this point in the history
* bump SQLite & zstd
* fix bitrot in tests & CI
  • Loading branch information
mlin authored May 7, 2023
1 parent efaefe5 commit 2df9782
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 15 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

env:
APT_DEPS: libzstd-dev samtools tabix libhts-dev pigz python3-pip libcurl4-openssl-dev
BREW_DEPS: [email protected] zstd samtools pigz coreutils sqlite
BREW_DEPS: zstd samtools pigz coreutils sqlite
PIP_DEPS: pytest pytest-xdist

jobs:
Expand Down Expand Up @@ -114,11 +114,14 @@ jobs:
path: libsqlite3.so.0

macOS-x86-64-dylib:
runs-on: macOS-10.15
runs-on: macOS-11
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: dependencies
run: |
rm -f /usr/local/bin/2to3 # https://github.com/pypa/pipenv/issues/3831
Expand All @@ -127,17 +130,17 @@ jobs:
brew install $dep || brew upgrade $dep
done
/usr/local/bin/pip3 install $PIP_DEPS
pip install $PIP_DEPS
- name: rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- name: build environment
run: |
echo "PATH=$(brew --prefix)/opt/python/libexec/bin:$(brew --prefix)/opt/sqlite/bin:${PATH}" >> $GITHUB_ENV
echo "CFLAGS=-I$(brew --prefix)/include -I$(brew --prefix)/opt/sqlite/include -march=sandybridge" >> $GITHUB_ENV
echo "CXXFLAGS=-I$(brew --prefix)/include -I$(brew --prefix)/opt/sqlite/include -march=sandybridge" >> $GITHUB_ENV
echo "PATH=$(brew --prefix)/bin:$(brew --prefix)/opt/sqlite/bin:${PATH}" >> $GITHUB_ENV
echo "CFLAGS=-I$(brew --prefix)/include -I$(brew --prefix)/opt/sqlite/include -march=ivybridge" >> $GITHUB_ENV
echo "CXXFLAGS=-I$(brew --prefix)/include -I$(brew --prefix)/opt/sqlite/include -march=ivybridge" >> $GITHUB_ENV
echo "LDFLAGS=-L$(brew --prefix)/lib -L$(brew --prefix)/opt/sqlite/lib" >> $GITHUB_ENV
# used by rusqlite:
echo "SQLITE3_INCLUDE_DIR=$(brew --prefix)/opt/sqlite/include" >> $GITHUB_ENV
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ build/
__pycache__
.vscode/
site/
venv/
.venv/
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
FROM centos:7 as builder

ARG CMAKE_VERSION=3.17.3
ARG SQLITE_VERSION=3410000
ARG ZSTD_VERSION=1.5.4
ARG SQLITE_VERSION=3410200
ARG ZSTD_VERSION=1.5.5
ARG CPU_ARCH=ivybridge
ENV CFLAGS="-march=${CPU_ARCH} -O3"
ENV CXXFLAGS=${CFLAGS}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Our **[Colab notebook](https://colab.research.google.com/drive/1OlHPOcRQBhDmEnS1

**Start Here 👉 [full documentation site](https://mlin.github.io/GenomicSQLite/)**

We supply the extension [prepackaged](https://github.com/mlin/GenomicSQLite/releases) for Linux x86-64 and macOS Catalina. An up-to-date version of SQLite itself is also required, as specified in the docs.
We supply the extension [prepackaged](https://github.com/mlin/GenomicSQLite/releases) for Linux and macOS on x86-64. An up-to-date version of SQLite itself is also required, as specified in the docs.

Programming language support:

Expand Down
7 changes: 5 additions & 2 deletions src/genomicsqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1552,9 +1552,12 @@ const unsigned char dna_complement_table[] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

extern "C" int dna_revcomp(const char *dna, size_t len, char *out) {
for (; len; --len, ++out)
if ((*out = dna_complement_table[(unsigned char)dna[len - 1]]) == 0xFF)
for (; len; --len, ++out) {
unsigned char c = dna_complement_table[(unsigned char)dna[len - 1]];
if (c == 0xFF)
return -1;
*out = c;
}
*out = 0;
return 0;
}
Expand Down
5 changes: 4 additions & 1 deletion test/test_gri.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def test_gri_lvl():
)


@pytest.mark.skipif(
sqlite3.sqlite_version in ("3.40.0", "3.40.1"), reason="SQLite query planning regression"
)
def test_indexing():
con = sqlite3.connect(":memory:")
_fill_exons(con)
Expand Down Expand Up @@ -271,7 +274,7 @@ def test_connect(tmp_path):
con.executescript(genomicsqlite.put_reference_assembly_sql(con, "GRCh38_no_alt_analysis_set"))
_fill_exons(con)
con.commit()
del con
con.close()

con = genomicsqlite.connect(dbfile, read_only=True)
query = (
Expand Down
6 changes: 3 additions & 3 deletions test/test_twobit.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def test_dna_revcomp():
assert next(con.execute("SELECT dna_revcomp('')"))[0] == ""
assert next(con.execute("SELECT dna_revcomp(NULL)"))[0] is None

with pytest.raises(sqlite3.OperationalError):
with pytest.raises(sqlite3.OperationalError, match="non-DNA input to dna_revcomp()"):
con.execute("SELECT dna_revcomp('GATTACAb')")

with pytest.raises(sqlite3.OperationalError):
with pytest.raises(sqlite3.OperationalError, match="non-DNA input to dna_revcomp()"):
con.execute("SELECT dna_revcomp('GATTACA ')")

with pytest.raises(sqlite3.OperationalError):
with pytest.raises(sqlite3.OperationalError, match="argument #1 type mismatch"):
con.execute("SELECT dna_revcomp(42)")
5 changes: 5 additions & 0 deletions test/test_vcf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import sqlite3
import subprocess
import pytest
import genomicsqlite

HERE = os.path.dirname(__file__)
Expand All @@ -18,6 +20,9 @@ def vcf_into_sqlite(infilename, outfilename, *options):
print(outfilename)


@pytest.mark.skipif(
sqlite3.sqlite_version in ("3.40.0", "3.40.1"), reason="SQLite query planning regression"
)
def test_gnomad_sites_small(tmp_path):
dbfile = str(tmp_path / "test.gsql")

Expand Down
6 changes: 6 additions & 0 deletions test/test_vcf_lines.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import sqlite3
import subprocess
import genomicsqlite
import pytest


HERE = os.path.dirname(__file__)
BUILD = os.path.abspath(os.path.join(HERE, "..", "build"))
Expand All @@ -13,6 +16,9 @@ def vcf_lines_into_sqlite(infilename, outfilename, *options):
print(outfilename)


@pytest.mark.skipif(
sqlite3.sqlite_version in ("3.40.0", "3.40.1"), reason="SQLite query planning regression"
)
def test_gnomad_sites_small(tmp_path):
dbfile = str(tmp_path / "gnomad_lines.gsql")

Expand Down

0 comments on commit 2df9782

Please sign in to comment.