예제 #1
0
 def testPhenotypesSearchDescriptionWildcard(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     request.description = ".*sensitivity.*"
     postUrl = '/phenotypes/search'
     response = self.sendSearchRequest(
         postUrl,
         request,
         protocol.SearchPhenotypesResponse)
     self.assertEquals(7, len(response.phenotypes))
예제 #2
0
 def testPhenotypesSearchOntologyTerm(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     request.type.term_id = "http://ohsu.edu/cgd/5c895709"
     postUrl = '/phenotypes/search'
     response = self.sendSearchRequest(
         postUrl,
         request,
         protocol.SearchPhenotypesResponse)
     self.assertGreater(len(response.phenotypes), 0)
예제 #3
0
 def testPhenotypesSearchDescription(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     request.description = \
             "Papillary thyroid carcinoma with sensitivity to therapy"  # noqa
     postUrl = '/phenotypes/search'
     response = self.sendSearchRequest(
         postUrl,
         request,
         protocol.SearchPhenotypesResponse)
     self.assertGreater(len(response.phenotypes), 0)
예제 #4
0
 def testPhenotypesSearchById(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     # setup phenotype query
     request.id = "http://ohsu.edu/cgd/30ebfd1a"
     postUrl = '/phenotypes/search'
     response = self.sendSearchRequest(
         postUrl,
         request,
         protocol.SearchPhenotypesResponse)
     self.assertEqual(request.id, response.phenotypes[0].id)
예제 #5
0
 def testPhenotypeSearchMultipleQualifiers(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     ontologyterm = protocol.OntologyTerm()
     ontologyterm.term_id = "http://purl.obolibrary.org/obo/PATO_0000396"
     ontologyterm2 = protocol.OntologyTerm()
     ontologyterm2.term_id = "http://purl.obolibrary.org/obo/PATO_0000460"
     request.qualifiers.extend([ontologyterm, ontologyterm2])
     postUrl = '/phenotypes/search'
     response = self.sendSearchRequest(postUrl, request,
                                       protocol.SearchPhenotypesResponse)
     self.assertGreater(len(response.phenotypes), 0)
예제 #6
0
 def testPhenotypesSearchMultipleTerms(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     request.description = "Melanoma, NOS with response to therapy"
     request.age_of_onset.term_id = \
         "http://purl.obolibrary.org/obo/HP_0003581"
     postUrl = '/phenotypes/search'
     response = self.sendSearchRequest(
         postUrl,
         request,
         protocol.SearchPhenotypesResponse)
     self.assertGreater(len(response.phenotypes), 0)
예제 #7
0
 def testPhenotypeSearchQualifiersSensitivity(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     ontologyterm = protocol.OntologyTerm()
     ontologyterm.term_id = "http://ohsu.edu/cgd/sensitivity"
     request.qualifiers.extend([ontologyterm])
     postUrl = '/phenotypes/search'
     response = self.sendSearchRequest(
         postUrl,
         request,
         protocol.SearchPhenotypesResponse)
     self.assertGreater(len(response.phenotypes), 0)
예제 #8
0
 def search_phenotype(self,
                      phenotype_association_set_id=None,
                      phenotype_id=None,
                      description=None,
                      type_=None,
                      age_of_onset=None):
     """
     Returns an iterator over the Phenotypes from the server
     """
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = phenotype_association_set_id
     if phenotype_id:
         request.id = phenotype_id
     if description:
         request.description = description
     if type_:
         request.type.mergeFrom(type_)
     if age_of_onset:
         request.age_of_onset = age_of_onset
     request.page_size = pb.int(self._page_size)
     return self._run_search_request(request, "phenotypes",
                                     protocol.SearchPhenotypesResponse)
예제 #9
0
 def sendPhenotypesSearch(self):
     request = protocol.SearchPhenotypesRequest()
     request.phenotype_association_set_id = self.phenotypeAssociationSetId
     return self.sendPostRequest('/phenotypes/search', request)