Skip to content

Commit

Permalink
Merge pull request #191 from indralab/fix-node-header
Browse files Browse the repository at this point in the history
Fix node header and other docker issues
  • Loading branch information
bgyori committed Jul 6, 2023
2 parents 36994e1 + ac7f04f commit 34488c0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
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

0 comments on commit 34488c0

Please sign in to comment.