Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
sco query non trans; curie resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
turbomam committed Jan 16, 2022
1 parent bccba93 commit 5926bf5
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: all clean tests dep_check

all: clean dep_check tests target/sco.tsv
all: clean dep_check tests target/envo_sco.tsv

clean:
rm -rf downloads/*
Expand All @@ -17,5 +17,5 @@ downloads/envo.owl:
# --location (-L) pursues redirects
curl --location http://purl.obolibrary.org/obo/envo.owl -o $@

target/sco.tsv: downloads/envo.owl
target/envo_sco.tsv: downloads/envo.owl
robot query --input $< --query sparql/sco.sparql $@
21 changes: 21 additions & 0 deletions hident/hident.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import logging
import click
import click_log

logger = logging.getLogger(__name__)
click_log.basic_config(logger)


@click.command()
@click_log.simple_verbosity_option(logger)
@click.option('--termlist', type=click.Path(exists=True), required=True, help="headerless list of term ids")
@click.option('--sco_table', type=click.Path(exists=True), required=True, help="subclass table from sparql/sco.sparql")
def hident(termlist, sco_file):
logger.info(termlist)
logger.info(sco_file)


def set_to_sorted_list(term_set: set[str]) -> list[str]:
listified = list(term_set)
listified.sort()
return listified


if __name__ == "__main__":
hident()
175 changes: 173 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ authors = ["Mark A. Miller <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
click = "^8.0.3"
click-log = "^0.3.2"
prefixcommons = "^0.1.9"

[tool.poetry.dev-dependencies]
pytest = "^5.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
hident = 'hident.hident:hident'
4 changes: 3 additions & 1 deletion sparql/sco.sparql
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix ENVO: <http://purl.obolibrary.org/obo/ENVO_>
select
?sub ?super
where
{
?sub rdfs:subClassOf+ ?super
?sub rdfs:subClassOf ?super
filter(isuri(?super))
filter(isuri(?sub))
}
#limit 3
# also try a sco+ query?

5 changes: 5 additions & 0 deletions tests/data/termlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENVO:00001998
ENVO:00002232
ENVO:00002263
ENVO:00005779
ENVO:01001841

0 comments on commit 5926bf5

Please sign in to comment.