Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: '^docs/conf.py'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -19,7 +19,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.2
rev: v0.15.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## Version 0.0.1
## Version 0.0.1

- Initial implementation to access OrgDB objects.
- Initial implementation to access OrgDB objects.
- This also fetches the annotation hub sqlite file and queries for available org sqlite files instead of a static registry used in the txdb package.
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
furo
myst-nb
# Requirements file for ReadTheDocs, check .readthedocs.yml.
# To build the module reference correctly, make sure every external package
# under `install_requires` in `setup.cfg` is also listed here!
# sphinx_rtd_theme
myst-parser[linkify]
sphinx>=3.2.1
myst-nb
furo
sphinx-autodoc-typehints
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Setup file for orgdb.
Use setup.cfg to configure your project.
Setup file for orgdb.
Use setup.cfg to configure your project.

This file was generated with PyScaffold 4.6.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
This file was generated with PyScaffold 4.6.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""

from setuptools import setup
Expand Down
2 changes: 1 addition & 1 deletion src/orgdb/orgdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def genes(self) -> GenomicRanges:
return GenomicRanges.empty()

query = """
SELECT
SELECT
g.gene_id,
c.seqname,
c.start_location,
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- https://docs.pytest.org/en/stable/writing_plugins.html
"""

import sqlite3
import sqlite3
from orgdb import OrgDb
import pytest

Expand Down Expand Up @@ -102,4 +102,4 @@ def mock_orgdb(mock_orgdb_path):
"""Return an open OrgDb instance using the mock database."""
db = OrgDb(mock_orgdb_path)
yield db
db.close()
db.close()
16 changes: 8 additions & 8 deletions tests/test_orgdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ def test_select_simple(mock_orgdb):
def test_select_multikey(mock_orgdb):
res = mock_orgdb.select(keys=["1", "10"], columns=["SYMBOL"], keytype="ENTREZID")
assert len(res) == 2

symbols = res.get_column("SYMBOL")
assert "A1BG" in symbols
assert "NAT2" in symbols

def test_select_go_expansion(mock_orgdb):
res = mock_orgdb.select(keys="1", columns=["GO"], keytype="ENTREZID")

col_names = list(res.column_names)
assert "GO" in col_names
assert "EVIDENCE" in col_names
assert "ONTOLOGY" in col_names

assert len(res) == 2
go_ids = res.get_column("GO")
assert "GO:0000001" in go_ids
Expand All @@ -66,12 +66,12 @@ def test_select_many_to_one(mock_orgdb):

def test_mapIds(mock_orgdb):
keys = ["1", "10", "100"]

res = mock_orgdb.mapIds(keys, column="SYMBOL", keytype="ENTREZID")
assert isinstance(res, dict)
assert res["1"] == "A1BG"
assert res["10"] == "NAT2"

res_list = mock_orgdb.mapIds(["1"], column="GO", keytype="ENTREZID", multiVals="list")
assert isinstance(res_list["1"], list)
assert len(res_list["1"]) == 2
Expand All @@ -81,12 +81,12 @@ def test_genes_genomicranges(mock_orgdb):
gr = mock_orgdb.genes()
assert isinstance(gr, GenomicRanges)
assert len(gr) == 2

names = list(gr.names)
idx = names.index("1")
assert str(gr.seqnames[idx]) == "chr19"
assert gr.start[idx] == 58346806
assert gr.end[idx] == 58353492

assert "gene_id" in gr.mcols.column_names
assert gr.mcols.get_column("gene_id")[idx] == "1"
assert gr.mcols.get_column("gene_id")[idx] == "1"
2 changes: 1 addition & 1 deletion tests/test_real.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ def test_real_orgdb_workflow(tmp_path):
"GO:0048699",
"GO:0048143"],
columns="SYMBOL")

assert res.shape == (104, 4)
orgdb.close()
2 changes: 1 addition & 1 deletion tests/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def registry(tmp_path):
def test_registry_init(registry):
assert isinstance(registry, OrgDbRegistry)
assert "org.Hs.eg.db" in registry.list_orgdb()

def test_get_record(registry):
rec = registry.get_record("org.Hs.eg.db")
assert rec.orgdb_id == "org.Hs.eg.db"
Expand Down
Loading