Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjerse committed Apr 3, 2024
1 parent 2f149a3 commit e97b6ee
Show file tree
Hide file tree
Showing 6 changed files with 833 additions and 159 deletions.
146 changes: 1 addition & 145 deletions resolwe_bio/tests/unit/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from rest_framework import status
from rest_framework.test import APIRequestFactory, force_authenticate

from resolwe.flow.models import Collection, Data, DescriptorSchema, Entity, Process
from resolwe.flow.models import Collection, Data, Entity, Process
from resolwe.flow.views import CollectionViewSet, DataViewSet, EntityViewSet
from resolwe.test import ProcessTestCase, TestCase

Expand Down Expand Up @@ -50,41 +50,6 @@ def setUpTestData(cls):
last_name="Miller",
)

cls.descriptor_schema = DescriptorSchema.objects.create(
slug="test-schema",
version="1.0.0",
contributor=cls.contributor,
schema=[
{
"name": "general",
"group": [
{"name": "species", "type": "basic:string:", "required": False},
{"name": "organ", "type": "basic:string:", "required": False},
{
"name": "biosample_treatment",
"type": "basic:string:",
"required": False,
},
{
"name": "biosample_source",
"type": "basic:string:",
"required": False,
},
],
},
{
"name": "response_and_survival_analysis",
"group": [
{
"name": "confirmed_bor",
"type": "basic:string:",
"required": False,
}
],
},
],
)

cls.collections = [
Collection.objects.create(
contributor=cls.contributor,
Expand All @@ -101,58 +66,21 @@ def setUpTestData(cls):
name="Test entity 0",
collection=cls.collections[0],
contributor=cls.contributor,
descriptor_schema=cls.descriptor_schema,
descriptor={
"general": {
"species": "Homo sapiens",
"organ": "CRC",
"biosample_source": "CRC",
"biosample_treatment": "koh",
},
"response_and_survival_analysis": {
"confirmed_bor": "pd",
},
},
),
Entity.objects.create(
name="Test entity 1",
collection=cls.collections[1],
contributor=cls.contributor,
descriptor_schema=cls.descriptor_schema,
descriptor={
"general": {"species": "Homo sapiens", "organ": "CRC"},
"response_and_survival_analysis": {
"confirmed_bor": "sd",
},
},
),
Entity.objects.create(
name="Test entity 2",
collection=cls.collections[0],
contributor=cls.contributor,
descriptor_schema=cls.descriptor_schema,
descriptor={
"general": {
"species": "Mus musculus",
"organ": "CRC",
"biosample_treatment": "dmso",
},
},
),
Entity.objects.create(
name="Test entity 3",
collection=cls.collections[2],
contributor=cls.contributor,
descriptor_schema=cls.descriptor_schema,
descriptor={
"general": {
"species": "Mus musculus",
"biosample_treatment": "dmso",
},
"response_and_survival_analysis": {
"confirmed_bor": "pd",
},
},
),
]
cls.collections[0].save()
Expand Down Expand Up @@ -205,7 +133,6 @@ def setUp(self):
version="1.0.0",
contributor=self.contributor,
entity_type="test-schema",
entity_descriptor_schema="test-schema",
input_schema=[
{"name": "input_data", "type": "data:test:", "required": False}
],
Expand All @@ -217,12 +144,6 @@ def setUp(self):
],
)

self.descriptor_schema = DescriptorSchema.objects.create(
slug="test-schema",
version="1.0.0",
contributor=self.contributor,
)

self.data = []
for index in range(10):
data = Data.objects.create(
Expand Down Expand Up @@ -288,87 +209,22 @@ def setUp(self):
}
)

clinical_schema = DescriptorSchema.objects.get(slug="general-clinical")
sample_schema = DescriptorSchema.objects.get(slug="sample")

self.entities = [
Entity.objects.create(
name="Test entity 1",
contributor=self.contributor,
descriptor_schema=clinical_schema,
descriptor={
"general": {"species": "Homo sapiens"},
"disease_information": {
"disease_type": "Colorectal cancer",
"disease_status": "Progresive",
},
"subject_information": {
"batch": 1,
"group": "Pre",
"subject_id": "P-006",
"sample_label": "CRC",
},
"immuno_oncology_treatment_type": {
"io_drug": "D-00A",
"io_treatment": "single",
},
"response_and_survival_analysis": {
"pfs_event": "no",
"confirmed_bor": "pd",
},
},
),
Entity.objects.create(
name="Test entity 2",
contributor=self.contributor,
descriptor_schema=clinical_schema,
descriptor={
"general": {"species": "Homo sapiens"},
"disease_information": {
"disease_type": "Mesothelioma",
"disease_status": "Regresive",
},
"subject_information": {
"batch": 2,
"group": "Post",
"subject_id": "P-019",
"sample_label": "Meso",
},
"immuno_oncology_treatment_type": {
"io_drug": "D-12A",
"io_treatment": "combo",
},
"response_and_survival_analysis": {
"pfs_event": "yes",
"confirmed_bor": "sd",
},
},
),
Entity.objects.create(
name="Test entity 3",
contributor=self.contributor,
descriptor_schema=sample_schema,
descriptor={
"general": {
"species": "Mus musculus",
"description": "First sample",
"biosample_source": "lung",
"biosample_treatment": "dmso",
}
},
),
Entity.objects.create(
name="Test entity 4",
contributor=self.contributor,
descriptor_schema=sample_schema,
descriptor={
"general": {
"species": "Mus musculus",
"description": "Second sample",
"biosample_source": "liver",
"biosample_treatment": "koh",
}
},
),
]

Expand Down
1 change: 1 addition & 0 deletions resolwe_bio/variants/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Make this folder a Python package.
Loading

0 comments on commit e97b6ee

Please sign in to comment.