Exemple #1
0
 def verifyGenotypeConversion(self, vcfGenotype, vcfPhaseset, callGenotype,
                              callPhaseset):
     """
     Verifies that the convertGenotype function properly converts the vcf
     genotype and phaseset values into the desired call genotype and
     phaseset values.
     """
     self.assertEqual((callGenotype, callPhaseset),
                      variants.convertVCFGenotype(vcfGenotype, vcfPhaseset))
 def verifyGenotypeConversion(
         self, vcfGenotype, vcfPhaseset, callGenotype, callPhaseset):
     """
     Verifies that the convertGenotype function properly converts the vcf
     genotype and phaseset values into the desired call genotype and
     phaseset values.
     """
     self.assertEqual(
         (callGenotype, callPhaseset),
         variants.convertVCFGenotype(vcfGenotype, vcfPhaseset))
 def _verifyVariantCallEqual(self, gaCall, pyvcfCall):
     genotype, phaseset = variants.convertVCFGenotype(
         pyvcfCall.data.GT, pyvcfCall.phased)
     # callSetId information is not available in pyvcf.model._Call
     self.assertEqual(gaCall.callSetName, pyvcfCall.sample)
     self.assertEqual(gaCall.genotype, genotype)
     phaseset = None
     if pyvcfCall.phased:
         phaseset = "*"
     self.assertEqual(gaCall.phaseset, phaseset)
     if len(gaCall.genotypeLikelihood) > 0:
         self._compareTwoListFloats(
             gaCall.genotypeLikelihood, pyvcfCall.data.GL)
     else:
         self.assertNotIn("GL", pyvcfCall.data)
     for key, value in gaCall.info.items():
         if key != "GT" and key != "GL":
             if isinstance(value[0], (list, tuple)):
                 self._compareTwoListFloats(value[0], getattr(
                     pyvcfCall.data, key))
             elif isinstance(value[0], float):
                 self._compareTwoFloats(value[0], getattr(
                     pyvcfCall.data, key))
Exemple #4
0
 def _verifyVariantCallEqual(self, gaCall, pyvcfCall):
     genotype, phaseset = variants.convertVCFGenotype(
         pyvcfCall.data.GT, pyvcfCall.phased)
     # callSetId information is not available in pyvcf.model._Call
     self.assertEqual(gaCall.callSetName, pyvcfCall.sample)
     self.assertEqual(gaCall.genotype, genotype)
     phaseset = None
     if pyvcfCall.phased:
         phaseset = "*"
     self.assertEqual(gaCall.phaseset, phaseset)
     if len(gaCall.genotypeLikelihood) > 0:
         self._compareTwoListFloats(gaCall.genotypeLikelihood,
                                    pyvcfCall.data.GL)
     else:
         self.assertNotIn("GL", pyvcfCall.data)
     for key, value in gaCall.info.items():
         if key != "GT" and key != "GL":
             if isinstance(value[0], (list, tuple)):
                 self._compareTwoListFloats(value[0],
                                            getattr(pyvcfCall.data, key))
             elif isinstance(value[0], float):
                 self._compareTwoFloats(value[0],
                                        getattr(pyvcfCall.data, key))