Skip to content

Commit

Permalink
VICC results, see #1
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed Jun 26, 2019
1 parent 4523711 commit 6fb8f6a
Show file tree
Hide file tree
Showing 8 changed files with 2,130 additions and 9 deletions.
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ FROM swipl:7.5.12
MAINTAINER Chris Mungall <[email protected]>

RUN apt-get update && apt-get -y install make curl
RUN mkdir /data && curl -L http://purl.obolibrary.org/obo/mondo.owl -o /data/mondo.owl && curl -L http://purl.obolibrary.org/obo/ncit/neoplasm-core.owl -o /data/neoplasm-core.owl
RUN mkdir /data && curl -L http://purl.obolibrary.org/obo/mondo.owl -o /data/mondo.owl && curl -L http://purl.obolibrary.org/obo/doid.owl -o /data/doid.owl && curl -L http://purl.obolibrary.org/obo/ncit/neoplasm-core.owl -o /data/neoplasm-core.owl

ADD ./prolog/ /tools/prolog
ADD ./bin/ /tools/bin
ADD ./utf8.pl /tools/
ADD ./install.pl /tools/
ADD ./pack.pl /tools/
ADD ./tests/data/inputs.txt /tools/
WORKDIR /tools
RUN swipl -g "Opts=[interactive(false)],pack_install(sparqlprog,[url('https://github.com/cmungall/index_util/archive/v0.0.2.zip')|Opts]),pack_install(sparqlprog,Opts),pack_install(rdf_matcher,Opts),halt"
RUN swipl -l install -g install_requirements,halt
ENV PATH "/tools/bin:$PATH"

RUN swipl -G0 -p library=/tools/prolog -l /tools/utf8.pl /tools/bin/neoplasmer -X .cache -i /data/mondo.owl -i /data/doid.owl -i /data/neoplasm-core.owl inputs.txt

EXPOSE ${PORT}
CMD swipl -p library=prolog ./bin/neoplasmer -h
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include ../Makefile.inc

SWIPL = swipl -L0 -G0 -T0 -p library=prolog
all: test
all: tmp test

check:
install:
clean:


test:
test: tmp
$(SWIPL) -l tests/tests.pl -g run_tests,halt

bigtest:
Expand All @@ -27,6 +27,8 @@ coverage:
t-%:
$(SWIPL) -l tests/$*_test.pl -g run_tests,halt

tmp:
mkdir $@

# --------------------
# Docker
Expand Down
11 changes: 8 additions & 3 deletions bin/neoplasmer
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,19 @@ main(Argv) :-


parse_and_match(File) :-
csv_read_file(File,Rows,[]),
csv_read_file(File,Rows,[match_arity(false)]),
maplist(parse_row,Rows).

parse_row(Row) :-
Opts=[format(tsv)],
Row =.. [_Pred,Term|_],
G = term_best_match(Term,_,_,_),
forall(G,
write_result_wrap(G,[format(tsv)])).
findall(G,G,Gs),
( Gs=[]
-> write_result_wrap(term_best_match(Term,no_match,'n/a',none),Opts)
; forall(member(G,Gs),
write_result_wrap(G,Opts))).



write_result_wrap(G,Opts) :-
Expand Down
12 changes: 12 additions & 0 deletions install.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

install_requirements :-
ensure_loaded(pack),
% https://swi-prolog.discourse.group/t/www-swi-prolog-org-goes-https/811/3
ensure_loaded(library(prolog_pack)),
set_setting(prolog_pack:server, 'https://www.swi-prolog.org/pack/'),
Opts=[interactive(false)],
requires(X),
pack_install(X, Opts),
fail.
install_requirements.

2 changes: 1 addition & 1 deletion neoplasmer.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
docker run -p 9055:9055 -e PORT=9055 -v $PWD:/work -w /work --rm -ti cmungall/neoplasmer swipl -G0 -p library=/tools/prolog -l /tools/utf8.pl /tools/bin/neoplasmer -X .cache -i /data/mondo.owl -i /data/neoplasm-core.owl "$@"
docker run -p 9055:9055 -e PORT=9055 -v $PWD:/work -w /work --rm -ti cmungall/neoplasmer swipl -G0 -p library=/tools/prolog -l /tools/utf8.pl /tools/bin/neoplasmer -X .cache -i /data/mondo.owl -i /data/doid.owl -i /data/neoplasm-core.owl "$@"

2 changes: 1 addition & 1 deletion pack.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name(neoplasmer).
title('neoplasm entity recognition').
version('0.0.1').
version('0.0.2').
author('Chris Mungall','[email protected]').
packager('Chris Mungall','[email protected]').
home('https://github.com/cmungall/neoplasmER').
Expand Down
1 change: 1 addition & 0 deletions prolog/neoplasmer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
%! term_best_match(+Term, ?MatchCls, ?MatchScore, ?MatchClsPrefix) is nondet
term_best_match(V, C, S, P) :-
debug(matcher,'Matching: ~w',[V]),
% succeeds once for every value of P
setof(C-S,term_match_score(V, C, S, P),Pairs),
member(C-S,Pairs),
\+ ((member(_-S2,Pairs),S2>S)).
Expand Down
Loading

0 comments on commit 6fb8f6a

Please sign in to comment.