def getCallSetId(self, sampleName): """ Returns the callSetId for the specified sampleName in this VariantSet. """ compoundId = datamodel.CallSetCompoundId( self.getCompoundId(), sampleName) return str(compoundId)
def testCallSet(self): name = "sampleName" variantSet = self.getVariantSet() dataset = variantSet.getParentContainer() cid = datamodel.CallSetCompoundId(variantSet.getCompoundId(), name) self.assertRaises(ValueError, datamodel.CallSetCompoundId, variantSet.getCompoundId()) self.assertEqual(cid.dataset, dataset.getLocalId()) self.assertEqual(cid.variant_set, variantSet.getLocalId()) self.assertEqual(cid.name, name) self.assertEqual(cid.dataset_id, dataset.getId()) self.assertEqual(cid.variant_set_id, variantSet.getId())
def _verifyVariantsCallSetIds(self, searchsampleIds): """ leaving searchSampleIds will get all samples. """ gaCallSetVariants = [] for referenceName in self._referenceNames: end = datamodel.PysamDatamodelMixin.vcfMax gaSearchIds = [ str( datamodel.CallSetCompoundId(self._gaObject.getCompoundId(), sampleId)) for sampleId in searchsampleIds ] gaVariants = list( self._gaObject.getVariants(referenceName, 0, end, gaSearchIds)) self._verifyGaVariantsSample(gaVariants, searchsampleIds) gaCallSetVariants += gaVariants localVariants = filter(lambda v: v.CHROM == referenceName, self._variantRecords) self._verifyVariantsEqual(gaVariants, localVariants) self.assertEqual(len(gaCallSetVariants), len(self._variantRecords))