-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8d9a85
commit d030cb6
Showing
6 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 26 additions & 5 deletions
31
chord_metadata_service/experiments/migrations/0009_v4_1_0.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,38 @@ | ||
from typing import List | ||
from django.db import migrations | ||
|
||
LIB_STRATEGY_CONVERSIONS: List[tuple[str, str]] = [ | ||
# Convert WES -> WXS ... | ||
("WES", "WXS"), | ||
("Other", "OTHER") | ||
] | ||
|
||
def set_experiment_library_strategy(apps, _schema_editor): | ||
LIB_SELECTION_CONVERIONS: List[tuple[str, str]] = [ | ||
("Random", "RANDOM"), | ||
("Random PCR", "RANDOM PCR"), | ||
("Exome capture", "other"), # 'Exome capture' no longer supported | ||
("Other", "other"), | ||
] | ||
|
||
def set_experiment_library(apps, _schema_editor): | ||
Experiment = apps.get_model("experiments", "Experiment") | ||
for exp in Experiment.objects.filter(library_strategy="WES"): | ||
exp.library_strategy = "WXS" | ||
exp.save() | ||
for (old_val, new_val) in LIB_STRATEGY_CONVERSIONS: | ||
# Modify library_strategy if necessary | ||
for exp in Experiment.objects.filter(library_strategy=old_val): | ||
exp.library_strategy = new_val | ||
exp.save() | ||
|
||
for (old_val, new_val) in LIB_SELECTION_CONVERIONS: | ||
# Modify library_selection if necessary | ||
for exp in Experiment.objects.filter(library_selection=old_val): | ||
exp.library_selection = new_val | ||
exp.save() | ||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('experiments', '0007_v4_0_0'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(set_experiment_library_strategy) | ||
migrations.RunPython(set_experiment_library) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .utils import read_xsd_simple_type_values | ||
from .utils import read_xsd_simple_type_values, SRA_EXPERIMENT_FILE_NAME | ||
|
||
__all__ = [ | ||
"read_xsd_simple_type_values", | ||
"SRA_EXPERIMENT_FILE_NAME", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters