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() self.maxDiff = None # show full diff # setup users # setup super user self.superuser = self.make_user("superuser") self.superuser.is_staff = True self.superuser.is_superuser = True self.superuser.save() # setup contributor user self.contributor = self.make_user("contributor") # setup owner for projects, not used in tests owner = self.make_user("owner") # setup cases & projects & roles # project 1 case 1 self.project1 = ProjectFactory() self.project1_case1, variant_set_1, _ = CaseWithVariantSetFactory.get( "small", project=self.project1) self.project1_case1_smallvars = SmallVariantFactory.create_batch( 1, variant_set=variant_set_1) # project 1 case 2 self.project1_case2, variant_set_2, _ = CaseWithVariantSetFactory.get( "small", project=self.project1) self.project1_case2_smallvars = SmallVariantFactory.create_batch( 2, variant_set=variant_set_2) # project 2 case 1 self.project2 = ProjectFactory() self.project2_case1, variant_set_3, _ = CaseWithVariantSetFactory.get( "small", project=self.project2) self.project2_case1_smallvars = SmallVariantFactory.create_batch( 4, variant_set=variant_set_3) # project 2 case 2 self.project2_case2, variant_set_4, _ = CaseWithVariantSetFactory.get( "small", project=self.project2) self.project2_case2_smallvars = SmallVariantFactory.create_batch( 8, variant_set=variant_set_4) # init roles role_owner = Role.objects.get_or_create(name=PROJECT_ROLE_OWNER)[0] role_contributor = Role.objects.get_or_create( name=PROJECT_ROLE_CONTRIBUTOR)[0] # owner owns project1 and project2 (all projects) self._make_assignment(self.project1, owner, role_owner) self._make_assignment(self.project2, owner, role_owner) # contributor gets access to project2 self._make_assignment(self.project2, self.contributor, role_contributor)
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): super().setUp() self.project = ProjectFactory() variant_sets = [None, None] _, variant_sets[0], _ = CaseWithVariantSetFactory.get( "small", project=self.project) _, variant_sets[1], _ = CaseWithVariantSetFactory.get( "small", 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): self.data_dir = tempfile.mkdtemp() self.small_var = SmallVariantFactory() self.case = Case.objects.first() write_test_files(self.data_dir, self.case.name, [m["patient"] for m in self.case.pedigree]) self.admin = self.make_user("admin")
def setUp(self): super().setUp() self.case, self.variant_set, _ = CaseWithVariantSetFactory.get("small") self.hpo_id = "HP:0000001" 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)
def setUp(self): self.user = self.make_user("kiosk_user") self.category = ProjectFactory( title=settings.KIOSK_CAT, type=SODAR_CONSTANTS["PROJECT_TYPE_CATEGORY"]) self.project_above_thres = ProjectFactory( title=settings.KIOSK_PROJ_PREFIX + str(uuid.uuid4()), parent=self.category) self.project_below_thres = ProjectFactory( title=settings.KIOSK_PROJ_PREFIX + str(uuid.uuid4()), parent=self.category) self.case_above_thres, self.variant_set_above_thres, _ = CaseWithVariantSetFactory.get( "small", project=self.project_above_thres) self.case_below_thres, self.variant_set_below_thres, _ = CaseWithVariantSetFactory.get( "small", project=self.project_below_thres) self.case_below_thres.date_created = datetime.now() - timedelta( weeks=9) self.case_below_thres.save() self.small_vars_above_thres = SmallVariantFactory.create_batch( 3, variant_set=self.variant_set_above_thres) self.small_vars_below_thres = SmallVariantFactory.create_batch( 3, variant_set=self.variant_set_below_thres)
def setUp(self): self.user = self.make_user("superuser") self.case1, self.variant_set1, _ = CaseWithVariantSetFactory.get( "small") self.project = CaseAwareProject.objects.get( pk=Project.objects.first().pk) self.case2, self.variant_set2, _ = CaseWithVariantSetFactory.get( "small", project=self.project) self.small_vars1 = [ SmallVariantFactory(chromosome="1", variant_set=self.variant_set1), SmallVariantFactory(chromosome="2", variant_set=self.variant_set1), SmallVariantFactory(chromosome="3", variant_set=self.variant_set1), ] self.small_vars2 = [ SmallVariantFactory( chromosome=self.small_vars1[0].chromosome, start=self.small_vars1[0].start, reference=self.small_vars1[0].reference, alternative=self.small_vars1[0].alternative, variant_set=self.variant_set2, ), ] 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 = ExportProjectCasesFileBgJob.objects.create( project=self.bg_job.project, bg_job=self.bg_job, query_args=vars( ResubmitFormDataFactory(submit="download", names=self.project.get_members())), file_type="xlsx", )
def setUp(self): super().setUp() self.case = CaseFactory(project=self.project) self.small_variant = SmallVariantFactory(case_id=self.case.id) kwargs = { key: getattr(self.small_variant, key) for key in ("release", "chromosome", "start", "end", "bin", "reference", "alternative") } self.comment = SmallVariantCommentFactory(user=self.superuser, case=self.case, **kwargs) self.flags = SmallVariantFlagsFactory(case=self.case, **kwargs) self.rating = AcmgCriteriaRatingFactory(user=self.superuser, case=self.case, **kwargs)
def setUp(self): super().setUp() self.consortium = ConsortiumWithLocalAndRemoteSiteFactory() self.remote_site = Site.objects.get(role=Site.REMOTE) ConsortiumAssignmentFactory( consortium=self.consortium, project=self.project, ) self.small_variant = SmallVariantFactory(case__project=self.project) self.beacon_allele_request = BeaconAlleleRequest( assemblyId=self.small_variant.release, referenceName=self.small_variant.chromosome, start=self.small_variant.start, referenceBases=self.small_variant.reference, alternateBases=self.small_variant.alternative, )
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.case, variant_set, _ = CaseWithVariantSetFactory.get("small") small_var = SmallVariantFactory(variant_set=variant_set)
def setUp(self): super().setUp() variant_set = SmallVariantSetFactory() self.case = variant_set.case small_var = SmallVariantFactory(variant_set=variant_set)