-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bumping version * support for extracting dug elements from graph (#197) * support for extracting dug elements from graph * adding flag for enabling dug element extraction from graph * adding new config for node_to dug element parsing * adding more parameters to crawler to able configuration to element extraction logic * add tests * add tests for crawler Co-authored-by: Yaphetkg <[email protected]> * Update _version.py * Update _version.py updating version for final push to master * Update factory.py Adding more comments Co-authored-by: Carl Schreep <[email protected]> Co-authored-by: Yaphetkg <[email protected]>
- Loading branch information
1 parent
1b5c10a
commit 60b473a
Showing
13 changed files
with
491 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "2.7.0" | ||
__version__ = "2.8.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from unittest.mock import MagicMock, Mock | ||
|
||
import pytest | ||
import os | ||
import json | ||
|
||
|
||
from dug.core.annotate import Identifier | ||
from dug.core.tranql import QueryFactory, QueryKG | ||
|
||
# Makes some simple mokes | ||
ParserMock = MagicMock() | ||
HTTPSessionMock = MagicMock() | ||
|
||
# mocking tranql queries | ||
TranqlQueriesMock = {} | ||
for key, query in { | ||
"disease": ["disease", "phenotypic_feature"], | ||
"pheno": ["phenotypic_feature", "disease"] | ||
}.items(): | ||
TranqlQueriesMock[key] = QueryFactory(query, source="test") | ||
|
||
|
||
# for testing no id exclusion | ||
ExcludedIDs = [] | ||
|
||
ANNOTATED_IDS = [ | ||
Identifier("MONDO:0", "0", ["disease"]), | ||
Identifier("PUBCHEM.COMPOUND:1", "1", ["chemical"]) | ||
] | ||
for ids in ANNOTATED_IDS: | ||
ids.type = ids.types[0] | ||
# annotator with annotate method returning mocked concepts | ||
AnnotatorMock = MagicMock() | ||
AnnotatorMock.annotate = Mock(return_value=ANNOTATED_IDS) | ||
|
||
# tranqlizer returning mock kg when expanding concepts | ||
TranqlizerMock = MagicMock() | ||
|
||
# Get example tranql answer | ||
with open(os.path.join(os.path.dirname(__file__), "data", "tranql_response.json")) as stream: | ||
tranql_json = json.load(stream) | ||
kg_answer = QueryKG(kg_json=tranql_json) | ||
TRANQL_ANSWERS = [] | ||
for answer in kg_answer.answers: | ||
TRANQL_ANSWERS.append(kg_answer.get_answer_subgraph(answer)) | ||
|
||
TranqlizerMock.expand_identifier = Mock(return_value=TRANQL_ANSWERS) | ||
|
||
#mock a crawler with mock dependencies | ||
@pytest.fixture | ||
def crawler_init_args_no_graph_extraction(): | ||
return { | ||
"crawl_file": "test", | ||
"parser": ParserMock, | ||
"annotator": AnnotatorMock, | ||
"tranqlizer": TranqlizerMock, | ||
"tranql_queries": TranqlQueriesMock, | ||
"http_session": HTTPSessionMock, | ||
"exclude_identifiers": ExcludedIDs, | ||
"element_type": "TestElement", | ||
"element_extraction": None | ||
} |
Empty file.
Oops, something went wrong.