def setUp(self):
     super().setUp()
     self.project = ProjectFactory()
     variant_sets = SmallVariantSetFactory.create_batch(
         2, case__project=self.project)
     SmallVariantFactory(variant_set=variant_sets[0])
     SmallVariantFactory(variant_set=variant_sets[1])
     for variant_set in variant_sets:
         update_variant_counts(variant_set.case)
 def setUp(self):
     super().setUp()
     user = self.make_user("superuser")
     self.bgjob = ProjectCasesFilterBgJobFactory(user=user)
     variant_sets = SmallVariantSetFactory.create_batch(
         2, case__project=self.bgjob.project)
     SmallVariantFactory.create_batch(3, variant_set=variant_sets[0])
     SmallVariantFactory.create_batch(3, variant_set=variant_sets[1])
     self.bgjob.projectcasessmallvariantquery.query_settings.update(
         vars(FormDataFactory(names=self.bgjob.project.get_members())))
 def setUp(self):
     self.user = self.make_user("superuser")
     self.variant_set_active_above_thres = SmallVariantSetFactory(state="active")
     self.variant_set_active_above_thres.date_created = datetime.now() - timedelta(hours=1)
     self.variant_set_active_above_thres.save()
     self.variant_set_inactive_above_thres = SmallVariantSetFactory(state="importing")
     self.variant_set_inactive_above_thres.date_created = datetime.now() - timedelta(hours=2)
     self.variant_set_inactive_above_thres.save()
     self.variant_set_active_below_thres = SmallVariantSetFactory(state="active")
     self.variant_set_active_below_thres.date_created = datetime.now() - timedelta(hours=13)
     self.variant_set_active_below_thres.save()
     self.variant_set_inactive_below_thres = SmallVariantSetFactory(state="importing")
     self.variant_set_inactive_below_thres.date_created = datetime.now() - timedelta(hours=14)
     self.variant_set_inactive_below_thres.save()
 def setUp(self):
     self.user = self.make_user("superuser")
     variant_set = SmallVariantSetFactory()
     self.bg_job = BackgroundJob.objects.create(
         name="job name",
         project=Project.objects.first(),
         job_type="variants.export_file_bg_job",
         user=self.user,
     )
     self.export_job = ExportFileBgJob.objects.create(
         project=self.bg_job.project,
         bg_job=self.bg_job,
         case=variant_set.case,
         query_args={"some": "args"},
         file_type="xlsx",
     )
Beispiel #5
0
 def setUp(self):
     super().setUp()
     self.variant_set = SmallVariantSetFactory()
     self.hponame = HpoNameFactory(hpo_id="HP:0000001")
     self.hpos = [
         HpoFactory(
             database_id="OMIM:000001",
             hpo_id="HP:0000002",
             name="Disease 1;;Alternative Description",
         ),
         HpoFactory(
             database_id="OMIM:000001",
             hpo_id="HP:0000003",
             name="Disease 1;;Alternative Description",
         ),
     ]
     self.maxDiff = None
Beispiel #6
0
 def setUp(self):
     self.user = self.make_user("superuser")
     self.variant_set = SmallVariantSetFactory()
     self.small_vars = SmallVariantFactory.create_batch(3, variant_set=self.variant_set)
     self.case = self.variant_set.case
     self.bg_job = BackgroundJob.objects.create(
         name="job name",
         project=Project.objects.first(),
         job_type="variants.export_file_bg_job",
         user=self.user,
     )
     self.export_job = ExportFileBgJob.objects.create(
         project=self.bg_job.project,
         bg_job=self.bg_job,
         case=self.case,
         query_args={"export_flags": True, "export_comments": True},
         file_type="xlsx",
     )
 def setUp(self):
     super().setUp()
     self.variant_set = SmallVariantSetFactory()
     self.hpo_id = "HP:0000001"
     self.case = self.variant_set.case
     self.user = self.make_user("superuser")
     self.small_vars = [
         SmallVariantFactory(chromosome="1",
                             refseq_gene_id="1234",
                             variant_set=self.variant_set),
         SmallVariantFactory(chromosome="1",
                             refseq_gene_id="2234",
                             variant_set=self.variant_set),
         SmallVariantFactory(chromosome="1",
                             refseq_gene_id="2234",
                             variant_set=self.variant_set,
                             in_clinvar=True),
     ]
     self.bgjob = FilterBgJobFactory(case=self.case, user=self.user)
class TestCleanupVariantSets(TestCase):
    def setUp(self):
        self.user = self.make_user("superuser")
        self.variant_set_active_above_thres = SmallVariantSetFactory(state="active")
        self.variant_set_active_above_thres.date_created = datetime.now() - timedelta(hours=1)
        self.variant_set_active_above_thres.save()
        self.variant_set_inactive_above_thres = SmallVariantSetFactory(state="importing")
        self.variant_set_inactive_above_thres.date_created = datetime.now() - timedelta(hours=2)
        self.variant_set_inactive_above_thres.save()
        self.variant_set_active_below_thres = SmallVariantSetFactory(state="active")
        self.variant_set_active_below_thres.date_created = datetime.now() - timedelta(hours=13)
        self.variant_set_active_below_thres.save()
        self.variant_set_inactive_below_thres = SmallVariantSetFactory(state="importing")
        self.variant_set_inactive_below_thres.date_created = datetime.now() - timedelta(hours=14)
        self.variant_set_inactive_below_thres.save()

    def test_cleanup_variant_sets(self):
        self.assertEqual(SmallVariantSet.objects.all().count(), 4)
        cleanup_variant_sets()
        variant_sets = SmallVariantSet.objects.all().order_by("-date_created")
        self.assertEqual(variant_sets.count(), 3)
        self.assertEqual(variant_sets[0].id, self.variant_set_active_above_thres.id)
        self.assertEqual(variant_sets[1].id, self.variant_set_inactive_above_thres.id)
        self.assertEqual(variant_sets[2].id, self.variant_set_active_below_thres.id)
 def setUp(self):
     super().setUp()
     variant_set = SmallVariantSetFactory()
     self.case = variant_set.case
     small_var = SmallVariantFactory(variant_set=variant_set)
 def setUp(self):
     super().setUp()
     variant_set = SmallVariantSetFactory()
     self.case = variant_set.case
     SampleVariantStatisticsFactory(variant_set=variant_set,
                                    sample_name=variant_set.case.index)