Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node header and other docker issues #191

Merged
merged 6 commits into from
Jul 6, 2023
Merged
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
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN wget -O /sw/nodes.tsv.gz https://askem-mira.s3.amazonaws.com/dkg/$domain/bui
neo4j-admin import --delimiter='TAB' --skip-duplicate-nodes=true --skip-bad-relationships=true --nodes /sw/nodes.tsv.gz --relationships /sw/edges.tsv.gz

# Python packages
RUN python -m pip install git+https://github.com/indralab/mira.git@main#egg=mira[web,uvicorn] && \
RUN python -m pip install git+https://github.com/indralab/mira.git@main#egg=mira[web,uvicorn,dkg-client] && \
python -m pip uninstall -y flask_bootstrap && \
python -m pip uninstall -y bootstrap_flask && \
python -m pip install bootstrap_flask
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN sed -i 's/#dbms.default_listen_address/dbms.default_listen_address/' /etc/ne
neo4j-admin import --delimiter='TAB' --skip-duplicate-nodes=true --skip-bad-relationships=true --nodes /sw/nodes.tsv.gz --relationships /sw/edges.tsv.gz

# Python packages
RUN python -m pip install git+https://github.com/indralab/mira.git@$branch#egg=mira[web,uvicorn] && \
RUN python -m pip install git+https://github.com/indralab/mira.git@$branch#egg=mira[web,uvicorn,dkg-client] && \
python -m pip uninstall -y flask_bootstrap && \
python -m pip uninstall -y bootstrap_flask && \
python -m pip install bootstrap_flask
Expand Down
38 changes: 22 additions & 16 deletions mira/dkg/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,15 @@ def get_grounder(self, prefix: Union[str, List[str]]) -> "gilda.grounder.Grounde

if isinstance(prefix, str):
prefix = [prefix]
terms = list(
itt.chain.from_iterable(
terms = [
term
for term in itt.chain.from_iterable(
self.get_grounder_terms(p) for p in tqdm(
prefix, desc="Caching grounding terms"
)
)
)
if term.norm_text
]
return Grounder(terms)

def get_node_counter(self) -> Counter:
Expand Down Expand Up @@ -598,25 +600,29 @@ def get_terms(
from gilda.process import normalize
from gilda.term import Term

yield Term(
norm_text=normalize(name),
text=name,
db=prefix,
id=identifier,
entry_name=name,
status="name",
source=prefix,
)
for synonym in synonyms or []:
norm_text = normalize(name)
if norm_text:
yield Term(
norm_text=normalize(synonym),
text=synonym,
norm_text=norm_text,
text=name,
db=prefix,
id=identifier,
entry_name=name,
status="synonym",
status="name",
source=prefix,
)
for synonym in synonyms or []:
norm_text = normalize(synonym)
if norm_text:
yield Term(
norm_text=norm_text,
text=synonym,
db=prefix,
id=identifier,
entry_name=name,
status="synonym",
source=prefix,
)


def build_match_clause(
Expand Down
5 changes: 5 additions & 0 deletions mira/dkg/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"xrefs:string[]",
"alts:string[]",
"version:string",
"property_predicates:string[]",
"property_values:string[]",
"xref_types:string[]",
"synonym_types:string[]",
"source:string",
)

#: The used for the edges files in the neo4j bulk import
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ web =
gilda
click
neo4j
networkx
pystow
tabulate
pygraphviz
Expand Down