Commit e8365124 authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Renaming the global scheme from lysis to infection, closing #109

parent f45feda2
......@@ -5,6 +5,6 @@ r3,0,2.0,0.0,0.5
,,,,
,,,,
,Legend,,,
0,No lysis,,,
1,Weak,,,
2,Lysis,,,
0,No infection,,,
1,Intermediate,,,
2,Infection,,,
......@@ -6,6 +6,6 @@ r3,25,0.0,2.0,0.0,0.5
,,,,,
,,,,,
,Legend,,,,
0,No lysis,,,,
1,Weak,,,,
2,Lysis,,,,
0,No infection,,,,
1,Intermediate,,,,
2,Infection,,,,
......@@ -6,9 +6,9 @@ r3,25,0.0,2.0,0.0,0.5
,,,,,
,,,,,
,Legend,,,,
0,No lysis,,,,
1,Weak,,,,
2,Lysis,,,,
0,No infection,,,,
1,Intermediate,,,,
2,Infection,,,,
,,,,,
,,,,,
Infection ratio settings,,,,,
......
......@@ -6,9 +6,9 @@ r3,50,0.0,2.0,0.0,0.5
,,,,,
,,,,,
,Legend,,,,
0,No lysis,,,,
1,Weak,,,,
2,Lysis,,,,
0,No infection,,,,
1,Intermediate,,,,
2,Infection,,,,
,,,,,
,,,,,
Infection ratio settings,,,,,
......
......@@ -6,9 +6,9 @@ r3,25,0.0,2.0,0.0,0.5
,,,,,
,,,,,
,Legend,,,,
0,No lysis,,,,
1,Weak,,,,
2,Lysis,,,,
0,No infection,,,,
1,Intermediate,,,,
2,Infection,,,,
,,,,,
,,,,,
Infection ratio settings,,,,,
......
......@@ -6,6 +6,6 @@ r3,0,2.0,0.0,0.5
,,,,
,,,,
,Legend,,,
0,No lysis,,,
1,Weak,,,
2,Lysis,,,
0,No infection,,,
1,Intermediate,,,
2,Infection,,,
......@@ -4,6 +4,6 @@ r2,0,0.5,1.5
,,,
,,,
,Legend,,
0,No lysis,,
1,Weak,,
2,Lysis,,
0,No infection,,
1,Intermediate,,
2,Infection,,
......@@ -5,6 +5,6 @@ r3,2,0.0,0.5
,,,
,,,
,Legend,,
0,No lysis,,
1,Weak,,
2,Lysis,,
0,No infection,,
1,Intermediate,,
2,Infection,,
......@@ -4,6 +4,6 @@ r3,0,2.0,0.0,0.5
,,,,
,,,,
,Legend,,,
0,No lysis,,,
1,Weak,,,
2,Lysis,,,
0,No infection,,,
1,Intermediate,,,
2,Infection,,,
......@@ -5,6 +5,6 @@ r3,25,0.0,2.0,0.0,0.5
,,,,,
,,,,,
,Legend,,,,
0,No lysis,,,,
1,Weak,,,,
2,Lysis,,,,
0,No infection,,,,
1,Intermediate,,,,
2,Infection,,,,
......@@ -5,6 +5,6 @@ r3,0,2.0,0.0,1.0
,,,,
,,,,
,Legend,,,
0,No lysis,,,
1,Weak,,,
2,Lysis,,,
0,No infection,,,
1,Intermediate,,,
2,Infection,,,
......@@ -5,6 +5,6 @@ r1,1,0.0,1.0,1.0
,,,,
,,,,
,Legend,,,
0,No lysis,,,
1,Weak,,,
2,Lysis,,,
0,No infection,,,
1,Intermediate,,,
2,Infection,,,
......@@ -8,6 +8,6 @@ r3,0,0,0,0,0,0
,,,,,,
,,,,,,
,Legend,,,,,
0,No lysis,,,,,
1,Weak,,,,,
2,Lysis,,,,,
0,No infection,,,,,
1,Intermediate,,,,,
2,Infection,,,,,
......@@ -8,9 +8,9 @@ r3,0,0,0,0,0,0
,,,,,,
,,,,,,
,Legend,,,,,
0,No lysis,,,,,
1,Weak,,,,,
2,Lysis,,,,,
0,No infection,,,,,
1,Intermediate,,,,,
2,Infection,,,,,
,,,,,,
,,,,,,
Infection ratio settings,,,,,,
......
......@@ -7,6 +7,6 @@ r3,0,0,0,0
,,,,
,,,,
,Legend,,,
0,No lysis,,,
1,Weak,,,
2,Lysis,,,
0,No infection,,,
1,Intermediate,,,
2,Infection,,,
......@@ -7,6 +7,6 @@ r3,0,0,0,0,0
,,,,,
,,,,,
,Legend,,,,
0,No lysis,,,,
1,Weak,,,,
2,Lysis,,,,
0,No infection,,,,
1,Intermediate,,,,
2,Infection,,,,
......@@ -8,6 +8,6 @@ r3,0,0,1,0,0,1
,,,,,,
,,,,,,
,Legend,,,,,
0,No lysis,,,,,
1,Weak,,,,,
2,Lysis,,,,,
0,No infection,,,,,
1,Intermediate,,,,,
2,Infection,,,,,
......@@ -8,6 +8,6 @@ C4,2,,,1,,2,2,1
,,,,,,,,
,,,,,,,,
,Legend,,,,,,,
0,No lysis,,,,,,,
1,Weak,,,,,,,
2,Lysis,,,,,,,
0,No infection,,,,,,,
1,Intermediate,,,,,,,
2,Infection,,,,,,,
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def migration_code(apps, schema_editor):
GlobalViralStrainResponseValue = apps.get_model("viralhostrangedb", "GlobalViralHostResponseValue")
GlobalViralStrainResponseValue.objects.filter(name="No lysis").update(name="No infection")
GlobalViralStrainResponseValue.objects.filter(name="Weak").update(name="Intermediate")
GlobalViralStrainResponseValue.objects.filter(name="Lysis").update(name="Infection")
def reverse_code(apps, schema_editor):
GlobalViralStrainResponseValue = apps.get_model("viralhostrangedb", "GlobalViralHostResponseValue")
GlobalViralStrainResponseValue.objects.filter(name="No infection").update(name="No lysis")
GlobalViralStrainResponseValue.objects.filter(name="Intermediate").update(name="Weak")
GlobalViralStrainResponseValue.objects.filter(name="Infection").update(name="Lysis")
class Migration(migrations.Migration):
dependencies = [
('viralhostrangedb', '0021_auto_20190926_2307'),
]
operations = [
migrations.RunPython(migration_code, reverse_code=reverse_code),
]
......@@ -67,9 +67,9 @@ class ViewTestCase(TestCase):
self.toto.save()
################################################################################
self.lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="Lysis")
self.weak = models.GlobalViralHostResponseValue.objects_mappable().get(name="Weak")
self.no_lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="No lysis")
self.lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="Infection")
self.weak = models.GlobalViralHostResponseValue.objects_mappable().get(name="Intermediate")
self.no_lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="No infection")
self.not_mapped_yet = models.GlobalViralHostResponseValue.get_not_mapped_yet()
################################################################################
......@@ -124,19 +124,17 @@ class ViewTestCase(TestCase):
self.assertFalse(self.public_data_source_of_user_mapped.is_mapping_done)
lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="Lysis").pk
no_lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="No lysis").pk
form_data = {
"form-TOTAL_FORMS": 3,
"form-INITIAL_FORMS": 3,
"form-MIN_NUM_FORMS": 0,
"form-MAX_NUM_FORMS": 1000,
"form-0-raw_response": 0.0,
"form-0-mapping": no_lysis,
"form-0-mapping": self.no_lysis.pk,
"form-1-raw_response": 1.0,
"form-1-mapping": no_lysis,
"form-1-mapping": self.no_lysis.pk,
"form-2-raw_response": 2.0,
"form-2-mapping": lysis,
"form-2-mapping": self.lysis.pk,
}
self.client.post(url, form_data)
......@@ -164,20 +162,17 @@ class ViewTestCase(TestCase):
self.assertFalse(self.private_data_source_of_user_mapped.is_mapping_done)
lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="Lysis").pk
weak = models.GlobalViralHostResponseValue.objects_mappable().get(name="Weak").pk
no_lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="No lysis").pk
form_data = {
"form-TOTAL_FORMS": 3,
"form-INITIAL_FORMS": 3,
"form-MIN_NUM_FORMS": 0,
"form-MAX_NUM_FORMS": 1000,
"form-0-raw_response": 0.0,
"form-0-mapping": no_lysis,
"form-0-mapping": self.no_lysis.pk,
"form-1-raw_response": 1.0,
"form-1-mapping": weak,
"form-1-mapping": self.weak.pk,
"form-2-raw_response": 2.0,
"form-2-mapping": lysis,
"form-2-mapping": self.lysis.pk,
}
self.client.post(url, form_data)
......@@ -231,20 +226,17 @@ class ViewTestCase(TestCase):
self.assertFalse(self.three_reponse_simple.is_mapping_done)
lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="Lysis").pk
weak = models.GlobalViralHostResponseValue.objects_mappable().get(name="Weak").pk
no_lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="No lysis").pk
form_data = {
"form-TOTAL_FORMS": 3,
"form-INITIAL_FORMS": 3,
"form-MIN_NUM_FORMS": 0,
"form-MAX_NUM_FORMS": 1000,
"form-0-raw_response": 0.0,
"form-0-mapping": no_lysis,
"form-0-mapping": self.no_lysis.pk,
"form-1-raw_response": 1.0,
"form-1-mapping": weak,
"form-1-mapping": self.weak.pk,
"form-2-raw_response": 2.0,
"form-2-mapping": lysis,
"form-2-mapping": self.lysis.pk,
}
self.client.post(url, form_data)
......@@ -269,20 +261,17 @@ class ViewTestCase(TestCase):
self.assertFalse(self.three_reponse_simple_2.is_mapping_done)
lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="Lysis").pk
weak = models.GlobalViralHostResponseValue.objects_mappable().get(name="Weak").pk
no_lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="No lysis").pk
form_data = {
"form-TOTAL_FORMS": 3,
"form-INITIAL_FORMS": 3,
"form-MIN_NUM_FORMS": 0,
"form-MAX_NUM_FORMS": 1000,
"form-0-raw_response": 0.0,
"form-0-mapping": no_lysis,
"form-0-mapping": self.no_lysis.pk,
"form-1-raw_response": 1.0,
"form-1-mapping": weak,
"form-1-mapping": self.weak.pk,
"form-2-raw_response": 2.0,
"form-2-mapping": lysis,
"form-2-mapping": self.lysis.pk,
}
self.client.post(url, form_data)
......@@ -307,22 +296,19 @@ class ViewTestCase(TestCase):
self.assertFalse(self.four_reponse_simple.is_mapping_done)
lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="Lysis").pk
weak = models.GlobalViralHostResponseValue.objects_mappable().get(name="Weak").pk
no_lysis = models.GlobalViralHostResponseValue.objects_mappable().get(name="No lysis").pk
form_data = {
"form-TOTAL_FORMS": 4,
"form-INITIAL_FORMS": 4,
"form-MIN_NUM_FORMS": 0,
"form-MAX_NUM_FORMS": 1000,
"form-0-raw_response": 0.0,
"form-0-mapping": no_lysis,
"form-0-mapping": self.no_lysis.pk,
"form-1-raw_response": 1.0,
"form-1-mapping": weak,
"form-1-mapping": self.weak.pk,
"form-2-raw_response": 3.2,
"form-2-mapping": lysis,
"form-2-mapping": self.lysis.pk,
"form-3-raw_response": 4.0,
"form-3-mapping": lysis,
"form-3-mapping": self.lysis.pk,
}
self.client.post(url, form_data)
......@@ -1372,11 +1358,11 @@ class DataSourceMappingEditTestCase(ViewTestCase):
"form-MIN_NUM_FORMS": 0,
"form-MAX_NUM_FORMS": 1000,
"form-0-raw_response": 0.0,
"form-0-mapping": 3,
"form-0-mapping": self.no_lysis.pk,
"form-1-raw_response": 1.0,
"form-1-mapping": 3,
"form-1-mapping": self.no_lysis.pk,
"form-2-raw_response": 2.0,
"form-2-mapping": 2
"form-2-mapping": self.lysis.pk,
}
response = self.client.post(url, form_data)
......@@ -1389,9 +1375,9 @@ class DataSourceMappingEditTestCase(ViewTestCase):
raw_to_response = {}
for raw_response, response in self.public_data_source_of_user.get_mapping():
raw_to_response[raw_response] = response
self.assertEqual(raw_to_response.pop(0.0), models.GlobalViralHostResponseValue.objects.get(name="No lysis"))
self.assertEqual(raw_to_response.pop(1.0), models.GlobalViralHostResponseValue.objects.get(name="No lysis"))
self.assertEqual(raw_to_response.pop(2.0), models.GlobalViralHostResponseValue.objects.get(name="Lysis"))
self.assertEqual(raw_to_response.pop(0.0), self.no_lysis)
self.assertEqual(raw_to_response.pop(1.0), self.no_lysis)
self.assertEqual(raw_to_response.pop(2.0), self.lysis)
self.assertEqual(len(raw_to_response), 0)
def test_mapping_form_incomplet(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment