Esempio n. 1
0
 def _testSearchMethod(self, repoIteratorMethod, clientSearchMethod):
     repoObjs = list(repoIteratorMethod())
     numRepoObjs = len(repoObjs)
     pageSizes = self._getPageSizes(numRepoObjs)
     for pageSize in pageSizes:
         self._client.set_page_size(pageSize)
         clientObjs = list(clientSearchMethod())
         for repoObj, clientObj in utils.zipLists(repoObjs, clientObjs):
             self._assertEqual(repoObj, clientObj)
Esempio n. 2
0
 def _testSearchMethod(self, repoIteratorMethod, clientSearchMethod):
     repoObjs = list(repoIteratorMethod())
     numRepoObjs = len(repoObjs)
     pageSizes = self._getPageSizes(numRepoObjs)
     for pageSize in pageSizes:
         self._client.set_page_size(pageSize)
         clientObjs = list(clientSearchMethod())
         for repoObj, clientObj in utils.zipLists(repoObjs, clientObjs):
             self._assertEqual(repoObj, clientObj)
Esempio n. 3
0
 def verifyObjectList(self, gaObjects, datamodelObjects, getMethod):
     """
     Verifies that the specified list of protocol objects corresponds
     to the specified list of datamodel objects.
     """
     for gaObject, datamodelObject in utils.zipLists(
             gaObjects, datamodelObjects):
         self.assertEqual(gaObject, datamodelObject.toProtocolElement())
         otherGaObject = getMethod(gaObject.id)
         self.assertEqual(gaObject, otherGaObject)
Esempio n. 4
0
 def testSearchFeatures(self):
     repoFeatureSets = self._repo.allFeatureSets()
     for repoFeatureSet in repoFeatureSets:
         repoFeatures = list(repoFeatureSet.getFeatures())
         numFeatures = len(repoFeatures)
         featureSetId = repoFeatureSet.getId()
         pageSizes = self._getPageSizes(numFeatures)
         for pageSize in pageSizes:
             features = list(self._client.search_features(featureSetId))
             for repoFeature, feature in utils.zipLists(
                     repoFeatures, features):
                 self.assertEqual(repoFeature, feature)
Esempio n. 5
0
 def testSearchFeatures(self):
     repoFeatureSets = self._repo.allFeatureSets()
     for repoFeatureSet in repoFeatureSets:
         repoFeatures = list(repoFeatureSet.getFeatures())
         numFeatures = len(repoFeatures)
         featureSetId = repoFeatureSet.getId()
         pageSizes = self._getPageSizes(numFeatures)
         for pageSize in pageSizes:
             features = list(self._client.search_features(featureSetId))
             for repoFeature, feature in utils.zipLists(
                     repoFeatures, features):
                 self.assertEqual(repoFeature, feature)
Esempio n. 6
0
 def _testSearchMethodInContainer(self, containerAccessorMethod,
                                  clientSearchMethod,
                                  containerIteratorMethod):
     for container in containerIteratorMethod:
         containerId = container.getId()
         repoObjs = getattr(container, containerAccessorMethod)()
         numRepoObjs = len(repoObjs)
         pageSizes = self._getPageSizes(numRepoObjs)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             clientObjs = list(clientSearchMethod(containerId))
             for repoObj, clientObj in utils.zipLists(repoObjs, clientObjs):
                 self._assertEqual(repoObj, clientObj)
Esempio n. 7
0
 def testSearchReferences(self):
     repoReferenceSets = self._repo.getReferenceSets()
     for repoReferenceSet in repoReferenceSets:
         referenceSetId = repoReferenceSet.getId()
         repoReferences = repoReferenceSet.getReferences()
         numRefs = len(repoReferences)
         pageSizes = self._getPageSizes(numRefs)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             references = list(
                 self._client.search_references(referenceSetId))
             for repoReference, reference in utils.zipLists(
                     repoReferences, references):
                 self._assertEqual(repoReference, reference)
Esempio n. 8
0
 def testSearchPhenotypes(self):
     phenotypeAssociationSets = self._repo.allPhenotypeAssociationSets()
     for phenotypeAssociationSet in phenotypeAssociationSets:
         repoAssociations = list(phenotypeAssociationSet.getAssociations())
         numAssociations = len(repoAssociations)
         phenotypeAssociationSetId = phenotypeAssociationSet.getId()
         pageSizes = self._getPageSizes(numAssociations)
         for pageSize in pageSizes:
             clientPhenotypes = list(self._client.search_phenotype
                                     (phenotypeAssociationSetId))
             for repoAssociation, clientPhenotype in utils.zipLists(
                     repoAssociations, clientPhenotypes):
                 self.assertEqual(repoAssociation.phenotype,
                                  clientPhenotype)
Esempio n. 9
0
 def _testSearchMethodInContainer(
         self, containerAccessorMethod, clientSearchMethod,
         containerIteratorMethod):
     for container in containerIteratorMethod:
         containerId = container.getId()
         repoObjs = getattr(container, containerAccessorMethod)()
         numRepoObjs = len(repoObjs)
         pageSizes = self._getPageSizes(numRepoObjs)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             clientObjs = list(clientSearchMethod(containerId))
             for repoObj, clientObj in utils.zipLists(
                     repoObjs, clientObjs):
                 self._assertEqual(repoObj, clientObj)
Esempio n. 10
0
 def testSearchReferences(self):
     repoReferenceSets = self._repo.getReferenceSets()
     for repoReferenceSet in repoReferenceSets:
         referenceSetId = repoReferenceSet.getId()
         repoReferences = repoReferenceSet.getReferences()
         numRefs = len(repoReferences)
         pageSizes = self._getPageSizes(numRefs)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             references = list(
                 self._client.search_references(referenceSetId))
             for repoReference, reference in utils.zipLists(
                     repoReferences, references):
                 self._assertEqual(repoReference, reference)
Esempio n. 11
0
 def testSearchPhenotypes(self):
     phenotypeAssociationSets = self._repo.allPhenotypeAssociationSets()
     for phenotypeAssociationSet in phenotypeAssociationSets:
         repoAssociations = list(phenotypeAssociationSet.getAssociations())
         numAssociations = len(repoAssociations)
         phenotypeAssociationSetId = phenotypeAssociationSet.getId()
         pageSizes = self._getPageSizes(numAssociations)
         for pageSize in pageSizes:
             clientPhenotypes = list(
                 self._client.search_phenotype(phenotypeAssociationSetId))
             for repoAssociation, clientPhenotype in utils.zipLists(
                     repoAssociations, clientPhenotypes):
                 self.assertEqual(repoAssociation.phenotype,
                                  clientPhenotype)
Esempio n. 12
0
 def testSearchVariants(self):
     for variantSet in self._repo.allVariantSets():
         referenceSet = variantSet.getReferenceSet()
         referenceName = referenceSet.getLocalId()
         variantSetId = variantSet.getId()
         repoVariants = list(
             variantSet.getVariants(referenceName, 0, 2**32))
         numRepoVariants = len(repoVariants)
         pageSizes = self._getPageSizes(numRepoVariants)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             variants = self._client.search_variants(variantSetId)
             for repoVariant, variant in utils.zipLists(
                     repoVariants, variants):
                 self._assertEqual(repoVariant, variant)
Esempio n. 13
0
 def testSearchVariants(self):
     for variantSet in self._repo.allVariantSets():
         referenceSet = variantSet.getReferenceSet()
         referenceName = referenceSet.getLocalId()
         variantSetId = variantSet.getId()
         repoVariants = list(variantSet.getVariants(referenceName, 0,
                                                    2**32))
         numRepoVariants = len(repoVariants)
         pageSizes = self._getPageSizes(numRepoVariants)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             variants = self._client.search_variants(variantSetId)
             for repoVariant, variant in utils.zipLists(
                     repoVariants, variants):
                 self._assertEqual(repoVariant, variant)
Esempio n. 14
0
 def testAllReads(self):
     for dmDataset in self.dataRepo.getDatasets():
         for dmReadGroupSet in dmDataset.getReadGroupSets():
             dmReferenceSet = dmReadGroupSet.getReferenceSet()
             for dmReadGroup in dmReadGroupSet.getReadGroups():
                 for dmReference in dmReferenceSet.getReferences():
                     # TODO fix these coordinates.
                     start = 0
                     end = 10
                     dmReads = list(dmReadGroup.getReadAlignments(
                         dmReference, start, end))
                     reads = list(self.client.searchReads(
                         [dmReadGroup.getId()], dmReference.getId(),
                         start, end))
                     self.assertGreater(len(reads), 0)
                     for dmRead, read in utils.zipLists(dmReads, reads):
                         self.assertEqual(dmRead, read)
Esempio n. 15
0
 def testPrograms(self):
     # test that program info is set correctly
     readGroupSet = self._gaObject
     for readGroup in readGroupSet.getReadGroups():
         readGroupInfo = self._readGroupInfos[readGroup.getLocalId()]
         gaPrograms = readGroup.getPrograms()
         htslibPrograms = readGroupInfo.programs
         for gaProgram, htslibProgram in utils.zipLists(
                 gaPrograms, htslibPrograms):
             self.assertEqual(gaProgram.id, htslibProgram.get('ID'))
             self.assertEqual(gaProgram.commandLine,
                              htslibProgram.get('CL', None))
             self.assertEqual(gaProgram.name, htslibProgram.get('PN', None))
             self.assertEqual(gaProgram.prevProgramId,
                              htslibProgram.get('PP', None))
             self.assertEqual(gaProgram.version,
                              htslibProgram.get('VN', None))
Esempio n. 16
0
 def testSearchReads(self):
     for repoReadGroup in self._repo.allReadGroups():
         repoReferenceSet = \
             repoReadGroup._parentContainer.getReferenceSet()
         for repoReference in repoReferenceSet.getReferences():
             referenceId = repoReference.getId()
             readGroupId = repoReadGroup.getId()
             repoReads = list(
                 repoReadGroup.getReadAlignments(repoReference))
             numRepoReads = len(repoReads)
             pageSizes = self._getPageSizes(numRepoReads)
             for pageSize in pageSizes:
                 self._client.set_page_size(pageSize)
                 reads = list(
                     self._client.search_reads([readGroupId], referenceId))
                 for repoRead, read in utils.zipLists(repoReads, reads):
                     self.assertEqual(repoRead, read)
Esempio n. 17
0
 def testSearchReads(self):
     for repoReadGroup in self._repo.allReadGroups():
         repoReferenceSet = \
             repoReadGroup._parentContainer.getReferenceSet()
         for repoReference in repoReferenceSet.getReferences():
             referenceId = repoReference.getId()
             readGroupId = repoReadGroup.getId()
             repoReads = list(
                 repoReadGroup.getReadAlignments(repoReference))
             numRepoReads = len(repoReads)
             pageSizes = self._getPageSizes(numRepoReads)
             for pageSize in pageSizes:
                 self._client.set_page_size(pageSize)
                 reads = list(self._client.search_reads(
                     [readGroupId], referenceId))
                 for repoRead, read in utils.zipLists(
                         repoReads, reads):
                     self.assertEqual(repoRead, read)
Esempio n. 18
0
 def testSearchVariantAnnotations(self):
     for variantAnnotationSet in self._repo.allVariantAnnotationSets():
         variantAnnotationSetId = variantAnnotationSet.getId()
         variantSet = variantAnnotationSet._parentContainer
         referenceSet = variantSet.getReferenceSet()
         referenceName = referenceSet.getLocalId()
         repoVariantAnnotations = list(
             variantAnnotationSet.getVariantAnnotations(
                 referenceName, 0, 2**32))
         numRepoVariantAnnotations = len(repoVariantAnnotations)
         pageSizes = self._getPageSizes(numRepoVariantAnnotations)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             variantAnnotations = self._client.search_variant_annotations(
                 variantAnnotationSetId, referenceName=referenceName)
             for repoVa, va in utils.zipLists(
                     repoVariantAnnotations, variantAnnotations):
                 self._assertEqual(repoVa, va)
Esempio n. 19
0
 def testSearchVariantAnnotations(self):
     for variantAnnotationSet in self._repo.allVariantAnnotationSets():
         variantAnnotationSetId = variantAnnotationSet.getId()
         variantSet = variantAnnotationSet._parentContainer
         referenceSet = variantSet.getReferenceSet()
         referenceName = referenceSet.getLocalId()
         repoVariantAnnotations = list(
             variantAnnotationSet.getVariantAnnotations(
                 referenceName, 0, 2**32))
         numRepoVariantAnnotations = len(repoVariantAnnotations)
         pageSizes = self._getPageSizes(numRepoVariantAnnotations)
         for pageSize in pageSizes:
             self._client.set_page_size(pageSize)
             variantAnnotations = self._client.search_variant_annotations(
                 variantAnnotationSetId, referenceName=referenceName)
             for repoVa, va in utils.zipLists(repoVariantAnnotations,
                                              variantAnnotations):
                 self._assertEqual(repoVa, va)
Esempio n. 20
0
 def testPrograms(self):
     # test that program info is set correctly
     readGroupSet = self._gaObject
     for readGroup in readGroupSet.getReadGroups():
         readGroupInfo = self._readGroupInfos[readGroup.getLocalId()]
         gaPrograms = readGroup.getPrograms()
         htslibPrograms = readGroupInfo.programs
         for gaProgram, htslibProgram in utils.zipLists(
                 gaPrograms, htslibPrograms):
             self.assertEqual(
                 gaProgram.id, htslibProgram.get('ID'))
             self.assertEqual(
                 gaProgram.command_line, htslibProgram.get('CL', None))
             self.assertEqual(
                 gaProgram.name, htslibProgram.get('PN', None))
             self.assertEqual(
                 gaProgram.prev_program_id, htslibProgram.get('PP', None))
             self.assertEqual(
                 gaProgram.version, htslibProgram.get('VN', None))
Esempio n. 21
0
 def assertAlignmentListsEqual(
         self, gaAlignments, pysamAlignments, readGroupInfo):
     for gaAlignment, pysamAlignment in utils.zipLists(
             gaAlignments, pysamAlignments):
         self.assertAlignmentsEqual(
             gaAlignment, pysamAlignment, readGroupInfo)
Esempio n. 22
0
 def assertAlignmentListsEqual(self, gaAlignments, pysamAlignments,
                               readGroupInfo):
     for gaAlignment, pysamAlignment in utils.zipLists(
             gaAlignments, pysamAlignments):
         self.assertAlignmentsEqual(gaAlignment, pysamAlignment,
                                    readGroupInfo)