示例#1
0
 def testNoFind(self):
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     request.feature_ids.extend(["FOOBAR"])
     response = self.sendSearchRequest(
         '/featurephenotypeassociations/search', request,
         protocol.SearchGenotypePhenotypeResponse)
     self.assertEqual(0, len(response.associations))
示例#2
0
 def testGenotypePhenotypeSearchPhenotype(self):
     """
     Search for associations given a phenotype
     """
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     request.phenotype_ids.extend(["http://ohsu.edu/cgd/25abbb09"])
     response = self.sendSearchRequest(
         '/featurephenotypeassociations/search', request,
         protocol.SearchGenotypePhenotypeResponse)
     self.assertEqual(1, len(response.associations[0].feature_ids))
示例#3
0
 def testGenotypePhenotypeSearchEvidence(self):
     """
     Search for associations given an evidence
     """
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     eq = protocol.EvidenceQuery()
     eq.description = "imatinib"
     request.evidence.extend([eq])
     response = self.sendSearchRequest(
         '/featurephenotypeassociations/search', request,
         protocol.SearchGenotypePhenotypeResponse)
     self.assertEqual(1, len(response.associations[0].feature_ids))
示例#4
0
 def testSearchGenotypePhenotype(self):
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = \
         self.phenotype_association_set_id
     request.feature_ids.extend(self.feature_ids)
     request.phenotype_ids.extend(self.phenotype_ids)
     request.evidence.extend([self.evidence])
     request.page_size = self.pageSize
     self.httpClient.search_genotype_phenotype(
         phenotype_association_set_id=self.phenotype_association_set_id,
         feature_ids=self.feature_ids,
         phenotype_ids=self.phenotype_ids,
         evidence=[self.evidence])
     self.httpClient._run_search_request.assert_called_once_with(
         request, "featurephenotypeassociations",
         protocol.SearchGenotypePhenotypeResponse)
示例#5
0
 def testGenotypePhenotypeSearchFeature(self):
     """
     Search for associations given a feature
     """
     # simulate user interacting with sequenceAnnotations
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     datasetName, featureSet = self.getCGDDataSetFeatureSet()
     featureId = \
         "http://ohsu.edu/cgd/27d2169c"
     obfuscated = self.getObfuscatedFeatureCompoundId(
         datasetName, featureSet.name, featureId)
     # use the feature to look up associations
     request.feature_ids.extend([obfuscated])
     response = self.sendSearchRequest(
         '/featurephenotypeassociations/search', request,
         protocol.SearchGenotypePhenotypeResponse)
     self.assertEqual(1, len(response.associations[0].feature_ids))
示例#6
0
 def testGenotypePhenotypeSearchEnsureEnvironment(self):
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     datasetName, featureSet = self.getCGDDataSetFeatureSet()
     featureId = \
         "http://ohsu.edu/cgd/27d2169c"
     obfuscated = self.getObfuscatedFeatureCompoundId(
         datasetName, featureSet.name, featureId)
     request.feature_ids.extend([obfuscated])
     eq = protocol.EvidenceQuery()
     eq.description = "imatinib"
     request.evidence.extend([eq])
     response = self.sendSearchRequest(
         '/featurephenotypeassociations/search', request,
         protocol.SearchGenotypePhenotypeResponse)
     self.assertEqual(1,
                      len(response.associations[0].environmental_contexts))
     environmentalContext = response.associations[0] \
                                    .environmental_contexts[0]
     self.assertEqual('imatinib', environmentalContext.description)
示例#7
0
 def testGenotypePhenotypeSearchEnsureEvidence(self):
     """
     Ensure evidence level is serialized in responses
     """
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     request.phenotype_association_set_id = \
         self.getPhenotypeAssociationSetId()
     datasetName, featureSet = self.getCGDDataSetFeatureSet()
     featureId = \
         "http://ohsu.edu/cgd/27d2169c"
     obfuscated = self.getObfuscatedFeatureCompoundId(
         datasetName, featureSet.name, featureId)
     request.feature_ids.extend([obfuscated])
     response = self.sendSearchRequest(
         '/featurephenotypeassociations/search', request,
         protocol.SearchGenotypePhenotypeResponse)
     self.assertEqual(1, len(response.associations[0].evidence))
     evidence = response.associations[0].evidence[0]
     self.assertEqual('decreased_sensitivity', evidence.description)
示例#8
0
文件: client.py 项目: ga4ghpoc/server
 def search_genotype_phenotype(self,
                               phenotype_association_set_id=None,
                               feature_ids=None,
                               phenotype_ids=None,
                               evidence=None):
     """
     Returns an iterator over the GeneotypePhenotype associations from
     the server
     """
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = phenotype_association_set_id
     if feature_ids:
         request.feature_ids.extend(feature_ids)
     if phenotype_ids:
         request.phenotype_ids.extend(phenotype_ids)
     if evidence:
         request.evidence.extend(evidence)
     request.page_size = pb.int(self._page_size)
     self._logger.debug("search_genotype_phenotype {}".format(request))
     return self._run_search_request(
         request, "featurephenotypeassociations",
         protocol.SearchGenotypePhenotypeResponse)
示例#9
0
    def testCompoundFeatureSearch(self):
        datasetName, featureSet = self.getCGDDataSetFeatureSet()
        featureId = \
            "http://cancer.sanger.ac.uk/cosmic/mutation/overview?id=736"
        obfuscated = self.getObfuscatedFeatureCompoundId(
            datasetName, featureSet.name, featureId)
        request = protocol.GetFeatureRequest
        request.feature_id = obfuscated
        response = self.sendGetRequest('/features/{}'.format(obfuscated))

        feature = protocol.fromJson(response.data, protocol.Feature)

        self.assertIsNotNone(feature)
        featureId = feature.id

        request = protocol.SearchGenotypePhenotypeRequest()
        request.phenotype_association_set_id = \
            self.getPhenotypeAssociationSetId()
        request.feature_ids.append(featureId)
        response = self.sendSearchRequest(
            '/featurephenotypeassociations/search', request,
            protocol.SearchGenotypePhenotypeResponse)
        self.assertEqual(1, len(response.associations))
        self.assertEqual(1, len(response.associations[0].feature_ids))
示例#10
0
 def sendGenotypePhenotypesSearch(self):
     request = protocol.SearchGenotypePhenotypeRequest()
     request.phenotype_association_set_id = self.phenotypeAssociationSetId
     return self.sendPostRequest('/featurephenotypeassociations/search',
                                 request)