Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

G2P Client search_phenotype missing qualifiers parameter #23

Open
bwalsh opened this issue Nov 2, 2016 · 0 comments
Open

G2P Client search_phenotype missing qualifiers parameter #23

bwalsh opened this issue Nov 2, 2016 · 0 comments

Comments

@bwalsh
Copy link
Member

bwalsh commented Nov 2, 2016

Bug: Searching by qualifier is missing from the client.
(The parameter and functionality is there on server)

Work in progress snippets below ...


$ git diff  ga4gh_client/client.py
diff --git a/ga4gh_client/client.py b/ga4gh_client/client.py
index e4aeb0e..668d6db 100644
--- a/ga4gh_client/client.py
+++ b/ga4gh_client/client.py
@@ -678,7 +678,7 @@ class AbstractClient(object):

     def search_phenotype(
             self, phenotype_association_set_id=None, phenotype_id=None,
-            description=None, type_=None, age_of_onset=None):
+            description=None, qualifiers=None, type_=None, age_of_onset=None):
         """
         Returns an iterator over the Phenotypes from the server
         """
@@ -690,6 +690,8 @@ class AbstractClient(object):
             request.description = description
         if type_:
             request.type.mergeFrom(type_)
+        if qualifiers:
+            request.qualifiers.extend(qualifiers)
         if age_of_onset:
             request.age_of_onset = age_of_onset
         request.page_size = pb.int(self._page_size)


$ git diff  tests/unit/test_client.py
diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py
index f599efb..af11178 100644
--- a/tests/unit/test_client.py
+++ b/tests/unit/test_client.py
@@ -56,6 +56,9 @@ class TestSearchMethodsCallRunRequest(unittest.TestCase):
         self.rnaQuantificationId = "rnaQuantificationId"
         self.expressionLevelId = "expressionLevelId"
         self.threshold = 0.0
+        self.qualifiers = [protocol.OntologyTerm(), protocol.OntologyTerm()]
+        self.qualifiers[0].id = "q0"
+        self.qualifiers[1].id = "q1"

     def testSetPageSize(self):
         testClient = client.AbstractClient()
@@ -383,6 +386,19 @@ class TestSearchMethodsCallRunRequest(unittest.TestCase):
             request, "phenotypes",
             protocol.SearchPhenotypesResponse)

+    def testSearchPhenotypeQualifiers(self):
+        request = protocol.SearchPhenotypesRequest()
+        request.phenotype_association_set_id = \
+            self.phenotype_association_set_id
+        request.qualifiers.extend(self.qualifiers)
+        request.page_size = self.pageSize
+        self.httpClient.search_phenotype(
+            phenotype_association_set_id=self.phenotype_association_set_id,
+            qualifiers=self.qualifiers)
+        self.httpClient._run_search_request.assert_called_once_with(
+            request, "phenotypes",
+            protocol.SearchPhenotypesResponse)
+
     def testSearchPhenotypeAssociationSets(self):
         request = protocol.SearchPhenotypeAssociationSetsRequest()
         request.dataset_id = self.datasetId

@bwalsh bwalsh changed the title G2P Client search_phenotype missing parameter G2P Client search_phenotype missing qualifiers parameter Nov 2, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant