Skip to content

Commit

Permalink
Minor bug fixes and improvements manual testing notes (#39)
Browse files Browse the repository at this point in the history
* Added get_most_specific_objects and get_most_specific_subjects methods

* Version has been updated to 0.3.3

* Added get_ancestor_enrichment_query method

* Added ancestor_enrichment method

* Added new test cases for ancestor_enrichment

* Added new data for ancestor_enrichment

* Fixed import order

* Updated test_get_ancestor_enrichment_query

* Removed unnecessary f-string

* Minor refactoring in query.py

* Added new cases for get_most_specific_objects and get_most_specific_subjects

* Added parent_enrichment and docstrings for parent_enrichment and ancestor_enrichment

* Refactored object_list to prevent duplicated terms
  • Loading branch information
Ismail Ugur Bayindir authored Sep 28, 2023
1 parent 454c8c8 commit 3194d44
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 454 deletions.
9 changes: 4 additions & 5 deletions pandasaurus/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def simple_enrichment(self) -> pd.DataFrame:
"""
source_list = [term.get_iri() for term in self._term_list]
object_list = [term.get_iri() for term in self._term_list]
object_list = source_list
query_string = get_simple_enrichment_query(source_list, object_list, self._enrichment_property_list)
self.enriched_df = (
pd.DataFrame(
Expand All @@ -105,7 +105,7 @@ def minimal_slim_enrichment(self, slim_list: List[str]) -> pd.DataFrame:
"""
source_list = [term.get_iri() for term in self._term_list]
object_list = source_list + SlimManager.get_slim_members(slim_list)
object_list = list(set(source_list + SlimManager.get_slim_members(slim_list)))
s_result = []
for chunk in chunks(object_list, 90):
s_result.extend(
Expand Down Expand Up @@ -139,7 +139,7 @@ def full_slim_enrichment(self, slim_list: List[str]) -> pd.DataFrame:
"""
source_list = [term.get_iri() for term in self._term_list]
object_list = source_list + SlimManager.get_slim_members(slim_list)
object_list = list(set(source_list + SlimManager.get_slim_members(slim_list)))
s_result = []
for chunk in chunks(object_list, 90):
s_result.extend([res for res in run_sparql_query(get_full_enrichment_query(source_list, chunk))])
Expand Down Expand Up @@ -171,7 +171,7 @@ def contextual_slim_enrichment(self, context: List[str]) -> pd.DataFrame:
# TODO add a curie checking mechanism for context list
query_string = get_contextual_enrichment_query(context)
source_list = [term.get_iri() for term in self._term_list]
object_list = source_list + [res.get("term") for res in run_sparql_query(query_string)]
object_list = list(set(source_list + [res.get("term") for res in run_sparql_query(query_string)]))
s_result = []
for chunk in chunks(object_list, 90):
s_result.extend(
Expand Down Expand Up @@ -378,4 +378,3 @@ def _generate_enrichment_graph(self, object_list):
self.mirror_enrichment_for_graph_generation(object_list)
self.graph = GraphGenerator.generate_enrichment_graph(self.graph_df)
self.graph = GraphGenerator.apply_transitive_reduction(self.graph, self.enriched_df["p"].unique().tolist())
# self.graph = GraphGenerator.apply_transitive_reduction(self.graph, self.graph_df["p"].unique().tolist())ş
Loading

0 comments on commit 3194d44

Please sign in to comment.