Skip to content

Commit

Permalink
Merge pull request #53 from microbiomedata/issue-52-reconcile
Browse files Browse the repository at this point in the history
Issue 52 reconcile
  • Loading branch information
turbomam authored Mar 4, 2022
2 parents 81b994d + 10febe6 commit e923409
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## NEVER EVER COMMIT THIS
googlemaps-api-key.txt

bin

cachedir
examples/outputs

Expand Down
34 changes: 27 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
RUN = poetry run

biosample_sqlite_file = ~/biosample_basex_data_good_subset.db

.PHONY: test clean all

all: clean test examples/outputs/report.tsv
all: clean test examples/outputs/report.tsv assets/bibo_DocumentStatus.tsv rel_to_oxygen_example \
examples/outputs/non_attribute_metadata_sel_envs_partial.tsv

# ---------------------------------------
# Test runner
Expand All @@ -14,19 +17,24 @@ test:

clean:
find examples -name "*report.tsv" -exec rm -rf {} \;
rm -rf assets/*bak
rm -rf assets/*tsv
rm -rf bin/*jar
rm -rf downloads/*db
rm -rf downloads/*gz
rm -rf downloads/*owl
rm -rf downloads/*tsv
rm -rf downloads/*zip
rm -rf examples/outputs/*tsv
rm -rf logs/*log
rm -rf examples/outputs/*

rm -rf target/*

examples/outputs/report.tsv: examples/gold.json
$(RUN) annotate-sample -R $@ $<

downloads/mixs6_core.tsv:
curl -L -s 'https://docs.google.com/spreadsheets/d/1QDeeUcDqXes69Y2RjU2aWgOpCVWo5OVsBX9MKmMqi_o/export?format=tsv&gid=178015749' > $@


biosample_sqlite_file = ~/biosample_basex_data_good_subset.db

examples/outputs/non_attribute_metadata_sel_envs_partial.tsv:
$(RUN) sqlite_client_cli \
--sqlite_path $(biosample_sqlite_file) \
Expand All @@ -36,4 +44,16 @@ examples/outputs/non_attribute_metadata_sel_envs_partial.tsv:
rel_to_oxygen_example: downloads/mixs6_core.tsv
$(RUN) rel_to_oxygen_example \
--sqlite_path $(biosample_sqlite_file) \
--mixs_core_path $<
--mixs_core_path $<


bin/robot.jar:
curl -s https://api.github.com/repos/ontodev/robot/releases/latest | grep 'browser_download_url.*\.jar"' | cut -d : -f 2,3 | tr -d \" | wget -O $@ -i -

downloads/bibo.owl:
# --location (-L) pursues redirects
curl --location https://raw.githubusercontent.com/structureddynamics/Bibliographic-Ontology-BIBO/master/bibo.owl -o $@

assets/bibo_DocumentStatus.tsv: downloads/bibo.owl bin/robot.jar
java -jar bin/robot.jar query --input $< --query sparql/bibo_DocumentStatus.sparql $@
sed --in-place=.bak 's/^\?//' $@
10 changes: 10 additions & 0 deletions assets/bibo_DocumentStatus.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
status_label
"accepted"
"draft"
"forthcoming"
"legal"
"non peer reviewed"
"peer reviewed"
"published"
"rejected"
"unpublished"
10 changes: 10 additions & 0 deletions assets/bibo_DocumentStatus.tsv.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
?status_label
"accepted"
"draft"
"forthcoming"
"legal"
"non peer reviewed"
"peer reviewed"
"published"
"rejected"
"unpublished"
1 change: 1 addition & 0 deletions assets/placeholder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder
Empty file removed downloads/placeholder
Empty file.
1 change: 1 addition & 0 deletions downloads/placeholder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder
1 change: 1 addition & 0 deletions examples/outputs/placeholder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder
12 changes: 9 additions & 3 deletions sample_annotator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import os

MAIN_MODEL_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'model')
MAIN_SCHEMA_DIR = os.path.join(MAIN_MODEL_DIR, 'schema')
MIXS_SCHEMA = os.path.join(MAIN_SCHEMA_DIR, 'mixs.json')
MAIN_MODEL_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "model")
MAIN_SCHEMA_DIR = os.path.join(MAIN_MODEL_DIR, "schema")
MIXS_SCHEMA = os.path.join(MAIN_SCHEMA_DIR, "mixs.json")

from .sample_annotator import SampleAnnotator
from .geolocation.geotools import GeoEngine

# , Message
from .sample_annotator import AnnotationReport

# # this import seemed to succeed a week or so ago
# # but not now
# # and may not even be necessary?
# from report_model import Message
8 changes: 8 additions & 0 deletions sparql/bibo_DocumentStatus.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix bibo: <http://purl.org/ontology/bibo/>
select distinct (str(?status_label_raw) as ?status_label)
where { ?s a bibo:DocumentStatus ;
rdfs:label ?status_label_raw }
order by ?status_label
1 change: 1 addition & 0 deletions sparql/placeholder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder

0 comments on commit e923409

Please sign in to comment.