diff --git a/src/encoded/audit/experiment.py b/src/encoded/audit/experiment.py index aca262eb760..25a5201f403 100644 --- a/src/encoded/audit/experiment.py +++ b/src/encoded/audit/experiment.py @@ -2514,19 +2514,18 @@ def audit_experiment_ChIP_control(value, system, files_structure): return num_IgG_controls = 0 - - for control_dataset in value['possible_controls']: - if not is_control_dataset(control_dataset): + for control in value['possible_controls']: + if ('target' not in control) or ('control' not in control['target']['investigated_as']): detail = 'Experiment {} is ChIP-seq but its control {} is not linked to a target with investigated.as = control'.format( value['@id'], - control_dataset['@id']) + control['@id']) yield AuditFailure('invalid possible_control', detail, level='ERROR') return - if not control_dataset.get('replicates'): + if not control.get('replicates'): continue - if 'antibody' in control_dataset.get('replicates')[0]: + if 'antibody' in control.get('replicates')[0]: num_IgG_controls += 1 # If all of the possible_control experiments are mock IP control experiments @@ -2535,23 +2534,11 @@ def audit_experiment_ChIP_control(value, system, files_structure): # The binding group agreed that ChIP-seqs all should have an input control. detail = 'Experiment {} is ChIP-seq and requires at least one input control, as agreed upon by the binding group. {} is not an input control'.format( value['@id'], - control_dataset['@id']) + control['@id']) yield AuditFailure('missing input control', detail, level='NOT_COMPLIANT') return -def is_control_dataset(dataset): - if 'target' not in dataset: - return False - if (dataset['@type'][0] == 'Experiment'): - return 'control' in dataset['target']['investigated_as'] - else: - for target_of_related_dataset in dataset['target']: - if 'control' not in target_of_related_dataset['investigated_as']: - return False - return True - - def audit_experiment_spikeins(value, system, excluded_types): if not check_award_condition(value, [ "ENCODE3", diff --git a/src/encoded/schemas/changelogs/experiment.md b/src/encoded/schemas/changelogs/experiment.md index 34f29bc7bce..bf156b77e61 100644 --- a/src/encoded/schemas/changelogs/experiment.md +++ b/src/encoded/schemas/changelogs/experiment.md @@ -1,9 +1,5 @@ ## Changelog for experiment.json -### Minor changes since schema version 20 - -* *possible_controls* property allows specification of any type of Dataset as possible control - ### Schema version 20 * Added *organoid* to biosample_type enums. diff --git a/src/encoded/schemas/experiment.json b/src/encoded/schemas/experiment.json index 0e792860b27..00b956a60b0 100644 --- a/src/encoded/schemas/experiment.json +++ b/src/encoded/schemas/experiment.json @@ -254,16 +254,16 @@ }, "possible_controls": { "title": "Controls", - "description": "Dataset that contain files that can serve as scientific controls for this experiment.", + "description": "Experiments that contain files that can serve as scientific controls for this experiment.", "type": "array", "default": [], "uniqueItems": true, "items": { "title": "Control", - "description": "A dataset that contains files that can serve as a scientific control for this experiment.", - "comment": "See dataset.json for a list of available identifiers. Exact pairing of data files with their controls is done using file relationships.", + "description": "An experiment that contains files that can serve as a scientific control for this experiment.", + "comment": "See experiment.json for a list of available identifiers. Exact pairing of data files with their controls is done using file relationships.", "type": "string", - "linkTo": "Dataset" + "linkTo": "Experiment" } }, "supersedes": { diff --git a/src/encoded/tests/test_schema_experiment.py b/src/encoded/tests/test_schema_experiment.py index e9f48c6fc7d..07924136503 100644 --- a/src/encoded/tests/test_schema_experiment.py +++ b/src/encoded/tests/test_schema_experiment.py @@ -29,13 +29,6 @@ def experiment_no_error(testapp, lab, award): } return item -@pytest.fixture -def matched_set(testapp, lab, award): - item = { - 'lab': lab['@id'], - 'award': award['@id'] - } - return item def test_not_pipeline_error_without_message_ok(testapp, experiment_no_error): # internal_status != pipeline error, so an error detail message is not required. @@ -130,10 +123,3 @@ def test_experiment_submission_date_dependency(testapp, experiment_no_error): 'date_submitted': '2000-10-10'}, status=200) -def test_experiment_possible_controls(testapp, experiment_no_error, matched_set): - exp = testapp.post_json('/experiment', experiment_no_error).json['@graph'][0] - matched_set_control = testapp.post_json('/matched_set', matched_set).json['@graph'][0] - testapp.patch_json( - exp['@id'], - {'possible_controls': [matched_set_control['@id']]}, - status=200) \ No newline at end of file diff --git a/src/encoded/types/dataset.py b/src/encoded/types/dataset.py index 758b414197e..3b04c9d2949 100644 --- a/src/encoded/types/dataset.py +++ b/src/encoded/types/dataset.py @@ -468,6 +468,7 @@ class Series(Dataset, CalculatedSeriesAssay, CalculatedSeriesBiosample, Calculat 'related_datasets.replicates.library.spikeins_used', 'related_datasets.replicates.library.treatments', 'related_datasets.possible_controls', + 'related_datasets.possible_controls.target', 'related_datasets.possible_controls.lab', 'related_datasets.target.organism', 'related_datasets.references',