Esempio n. 1
0
    def setUp(self) -> None:
        # create 2 phenopackets for 2 individuals; each individual has 1 biosample;
        # one of phenopackets has 1 phenotypic feature and 1 disease
        self.individual_1 = ph_m.Individual.objects.create(**ph_c.VALID_INDIVIDUAL_1)
        self.individual_2 = ph_m.Individual.objects.create(**ph_c.VALID_INDIVIDUAL_2)
        self.metadata_1 = ph_m.MetaData.objects.create(**ph_c.VALID_META_DATA_1)
        self.metadata_2 = ph_m.MetaData.objects.create(**ph_c.VALID_META_DATA_2)
        self.phenopacket_1 = ph_m.Phenopacket.objects.create(
            **ph_c.valid_phenopacket(subject=self.individual_1, meta_data=self.metadata_1)
        )
        self.phenopacket_2 = ph_m.Phenopacket.objects.create(
            id='phenopacket:2', subject=self.individual_2, meta_data=self.metadata_2
        )
        self.disease = ph_m.Disease.objects.create(**ph_c.VALID_DISEASE_1)
        self.procedure = ph_m.Procedure.objects.create(**ph_c.VALID_PROCEDURE_1)
        self.biosample_1 = ph_m.Biosample.objects.create(**ph_c.valid_biosample_1(self.individual_1, self.procedure))
        self.biosample_2 = ph_m.Biosample.objects.create(**ph_c.valid_biosample_2(self.individual_2, self.procedure))
        self.phenotypic_feature = ph_m.PhenotypicFeature.objects.create(
            **ph_c.valid_phenotypic_feature(self.biosample_1, self.phenopacket_1)
        )
        self.phenopacket_1.biosamples.set([self.biosample_1])
        self.phenopacket_2.biosamples.set([self.biosample_2])
        self.phenopacket_1.diseases.set([self.disease])

        # experiments
        self.instrument = exp_m.Instrument.objects.create(**exp_c.valid_instrument())
        self.experiment = exp_m.Experiment.objects.create(**exp_c.valid_experiment(self.biosample_1, self.instrument))
        self.experiment_result = exp_m.ExperimentResult.objects.create(**exp_c.valid_experiment_result())
        self.experiment.experiment_results.set([self.experiment_result])
Esempio n. 2
0
    def setUp(self) -> None:
        self.project = Project.objects.create(**VALID_PROJECT_1)
        self.dataset = Dataset.objects.create(**valid_dataset_1(self.project))
        to, tr = valid_table_1(self.dataset.identifier, model_compatible=True)
        TableOwnership.objects.create(**to)
        self.table = Table.objects.create(**tr)

        # Set up a dummy phenopacket

        self.individual, _ = Individual.objects.get_or_create(
            id='patient:1', sex='FEMALE', age={"age": "P25Y3M2D"})

        self.procedure = Procedure.objects.create(**VALID_PROCEDURE_1)

        self.biosample_1 = Biosample.objects.create(
            **valid_biosample_1(self.individual, self.procedure))
        self.biosample_2 = Biosample.objects.create(
            **valid_biosample_2(None, self.procedure))

        self.meta_data = MetaData.objects.create(**VALID_META_DATA_1)

        self.phenopacket = Phenopacket.objects.create(id="phenopacket_id:1",
                                                      subject=self.individual,
                                                      meta_data=self.meta_data,
                                                      table=self.table)

        self.phenopacket.biosamples.set([self.biosample_1, self.biosample_2])
Esempio n. 3
0
 def setUp(self) -> None:
     # individuals (count 8)
     individuals = {
         f"individual_{i}": ph_m.Individual.objects.create(**ind)
         for i, ind in enumerate(VALID_INDIVIDUALS, start=1)
     }
     # biosamples
     self.procedure = ph_m.Procedure.objects.create(
         **ph_c.VALID_PROCEDURE_1)
     self.biosample_1 = ph_m.Biosample.objects.create(
         **ph_c.valid_biosample_1(individuals["individual_1"],
                                  self.procedure))
     self.biosample_2 = ph_m.Biosample.objects.create(
         **ph_c.valid_biosample_2(individuals["individual_2"],
                                  self.procedure))
     # experiments
     self.instrument = exp_m.Instrument.objects.create(
         **exp_c.valid_instrument())
     self.experiment = exp_m.Experiment.objects.create(
         **exp_c.valid_experiment(self.biosample_1, self.instrument))
     self.experiment_result = exp_m.ExperimentResult.objects.create(
         **exp_c.valid_experiment_result())
     self.experiment.experiment_results.set([self.experiment_result])
     # make a copy and create experiment 2
     experiment_2 = deepcopy(
         exp_c.valid_experiment(self.biosample_2, self.instrument))
     experiment_2["id"] = "experiment:2"
     self.experiment = exp_m.Experiment.objects.create(**experiment_2)
Esempio n. 4
0
 def setUp(self):
     self.individual_1 = Individual.objects.create(**VALID_INDIVIDUAL_1)
     self.individual_2 = Individual.objects.create(**VALID_INDIVIDUAL_2)
     self.procedure = Procedure.objects.create(**VALID_PROCEDURE_1)
     self.biosample_1 = Biosample.objects.create(
         **valid_biosample_1(self.individual_1, self.procedure))
     self.biosample_2 = Biosample.objects.create(
         **valid_biosample_2(self.individual_2, self.procedure))
     self.phenotypic_feature_1 = PhenotypicFeature.objects.create(
         **valid_phenotypic_feature(biosample=self.biosample_1))
     self.phenotypic_feature_2 = PhenotypicFeature.objects.create(
         **valid_phenotypic_feature(biosample=self.biosample_2))
Esempio n. 5
0
 def setUp(self):
     self.subject = Individual.objects.create(**VALID_INDIVIDUAL_1)
     self.metadata = MetaData.objects.create(**VALID_META_DATA_2)
     self.procedure = Procedure.objects.create(**VALID_PROCEDURE_1)
     self.biosample_1 = Biosample.objects.create(
         **valid_biosample_1(self.subject, self.procedure))
     self.biosample_2 = Biosample.objects.create(
         **valid_biosample_2(None, self.procedure))
     self.phenopacket = Phenopacket.objects.create(
         id="phenopacket_id:1",
         subject=self.subject,
         meta_data=self.metadata,
     )
     self.phenopacket.biosamples.set([self.biosample_1, self.biosample_2])
Esempio n. 6
0
    def setUp(self) -> None:
        self.project = Project.objects.create(**VALID_PROJECT_1)
        self.dataset = Dataset.objects.create(**valid_dataset_1(self.project))
        to, tr = valid_table_1(self.dataset.identifier, model_compatible=True)
        TableOwnership.objects.create(**to)
        self.table = Table.objects.create(**tr)

        # Set up a dummy phenopacket

        self.individual, _ = Individual.objects.get_or_create(
            id='patient:1', sex='FEMALE', age={"age": "P25Y3M2D"})

        self.procedure = Procedure.objects.create(**VALID_PROCEDURE_1)

        self.biosample_1 = Biosample.objects.create(**valid_biosample_1(self.individual, self.procedure))
        self.biosample_2 = Biosample.objects.create(**valid_biosample_2(None, self.procedure))

        self.meta_data = MetaData.objects.create(**VALID_META_DATA_1)

        self.phenopacket = Phenopacket.objects.create(
            id="phenopacket_id:1",
            subject=self.individual,
            meta_data=self.meta_data,
            table=self.table
        )

        self.phenopacket.biosamples.set([self.biosample_1, self.biosample_2])

        self.phenotypic_feature = PhenotypicFeature.objects.create(
            **valid_phenotypic_feature(phenopacket=self.phenopacket)
        )

        # table for experiments metadata
        to_exp = TableOwnership.objects.create(table_id=uuid.uuid4(), service_id=uuid.uuid4(),
                                               service_artifact="experiments", dataset=self.dataset)
        self.t_exp = Table.objects.create(ownership_record=to_exp, name="Table 2", data_type=DATA_TYPE_EXPERIMENT)

        # add Experiments metadata and link to self.biosample_1
        self.instrument = Instrument.objects.create(**valid_instrument())
        self.experiment_result = ExperimentResult.objects.create(**valid_experiment_result())
        self.experiment = Experiment.objects.create(**valid_experiment(
            biosample=self.biosample_1, instrument=self.instrument, table=self.t_exp))
        self.experiment.experiment_results.set([self.experiment_result])