Exemplo n.º 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))
Exemplo n.º 2
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))
Exemplo n.º 3
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))
Exemplo n.º 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))