Esempio n. 1
0
 def _parseTagValue(cls, tag, value):
     if tag[0] in cls._tagReservedFieldPrefixes:
         # user reserved fields... not really sure what to do here
         return protocol.getValueFromValue(value.values[0]) \
             .encode(cls._encoding)
     elif tag in cls._tagIntegerFields:
         return int(protocol.getValueFromValue(value.values[0]))
     elif tag in cls._tagStringFields:
         return protocol.getValueFromValue(value.values[0]) \
             .encode(cls._encoding)
     elif tag in cls._tagIntegerArrayFields:
         return [int(integerString) for integerString in value]
     else:
         raise SamException("unrecognized tag '{}'".format(tag))
Esempio n. 2
0
 def _parseTagValue(cls, tag, value):
     if tag[0] in cls._tagReservedFieldPrefixes:
         # user reserved fields... not really sure what to do here
         return protocol.getValueFromValue(value.values[0]) \
             .encode(cls._encoding)
     elif tag in cls._tagIntegerFields:
         return int(protocol.getValueFromValue(value.values[0]))
     elif tag in cls._tagStringFields:
         return protocol.getValueFromValue(value.values[0]) \
             .encode(cls._encoding)
     elif tag in cls._tagIntegerArrayFields:
         return [int(integerString) for integerString in value]
     else:
         raise SamException("unrecognized tag '{}'".format(tag))
Esempio n. 3
0
 def _assertEquivalentGaVCFValues(gaValue, pyvcfValue):
     compareValue = protocol.getValueFromValue(gaValue)
     if isinstance(pyvcfValue, str):
         self.assertEqual(compareValue, pyvcfValue)
     elif isinstance(pyvcfValue, (int, bool)):
         self.assertEqual(compareValue, str(pyvcfValue))
     elif isinstance(pyvcfValue, float):
         self.assertAlmostEqual(float(compareValue), float(pyvcfValue))
     elif pyvcfValue is None:
         self.assertEqual(compareValue, ".")
     else:
         raise Exception(key, (" values are inconsistent",
                               "between ga4ghObject and pyvcf!"))
Esempio n. 4
0
 def _assertEquivalentGaVCFValues(gaValue, pyvcfValue):
     compareValue = protocol.getValueFromValue(gaValue)
     if isinstance(pyvcfValue, str):
         self.assertEqual(compareValue, pyvcfValue)
     elif isinstance(pyvcfValue, (int, bool)):
         self.assertEqual(compareValue, str(pyvcfValue))
     elif isinstance(pyvcfValue, float):
         self.assertAlmostEqual(float(compareValue), float(pyvcfValue))
     elif pyvcfValue is None:
         self.assertEqual(compareValue, ".")
     else:
         raise Exception(key, (
             " values are inconsistent",
             "between ga4ghObject and pyvcf!"))
Esempio n. 5
0
 def getDictFromMessageMap(self, messageMap):
     return dict([
         (k, [protocol.getValueFromValue(x) for x in v.values])
         for (k, v) in messageMap._values.items()])
Esempio n. 6
0
 def getDictFromMessageMap(self, messageMap):
     return dict([(k, [protocol.getValueFromValue(x) for x in v.values])
                  for (k, v) in messageMap._values.items()])