def test_create_call_set(self): call_set = VariantCallSet.create_and_save( name="call_set", sample_id="C00123", variant_sets=self.variant_sets) cs = VariantCallSet.objects.get(name="call_set") assert call_set == cs assert cs.name == "call_set" assert cs.variant_sets[0].reference_set.name == "ref_set"
def _create_call_sets(self): for sample in self.vcf_reader.samples: try: cs = VariantCallSet.create_and_save( name="_".join([sample, self.method]), variant_sets=self.variant_sets, sample_id=sample, info={"variant_caller": self.method}) except NotUniqueError: raise ValueError( "There is already a call set for sample %s with method %s " % (sample, self.method)) else: self.call_sets[sample] = cs
def _create_call_sets(self): try: self.call_set = VariantCallSet.create_and_save( name=self.call_set_name, variant_sets=[self.global_variant_set], sample_id=self.sample, info={"variant_caller": self.method}) except NotUniqueError: if self.force: # logger.info("There is already a call set for sample %s with method %s but add has been called with --force so this callset is being removed from the DB" % # (self.sample, self.method)) cs = VariantCallSet.objects.get( name="_".join([self.sample, self.method])) VariantCall.objects(call_set=cs).delete() cs.delete() self._create_call_sets() else: raise ValueError( "There is already a call set for sample %s with method %s " % (self.sample, self.method))