Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "IGVF-1903-missing-MPRA-design" #1197

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 12 additions & 25 deletions src/igvfd/audit/construct_library_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def audit_construct_library_set_associated_phenotypes(value, system):
f'has phenotype-associated variants listed in its `selection_criteria`, '
f'but no phenotype term specified in `associated_phenotypes`.'
)
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")}', level=audit_message.get('audit_level', ''))
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")})', level=audit_message.get('audit_level', ''))


@audit_checker('ConstructLibrarySet', frame='object')
Expand All @@ -55,7 +55,7 @@ def audit_construct_library_set_plasmid_map(value, system):
)
documents = value.get('documents', [])
if documents == []:
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")}', level=audit_message.get('audit_level', ''))
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")})', level=audit_message.get('audit_level', ''))
else:
for document in documents:
document_obj = system.get('request').embed(document, '@@object?skip_calculated=true')
Expand All @@ -65,7 +65,7 @@ def audit_construct_library_set_plasmid_map(value, system):
else:
continue
if map_counter == 0:
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")}', level=audit_message.get('audit_level', ''))
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")})', level=audit_message.get('audit_level', ''))


@audit_checker('ConstructLibrarySet', frame='object')
Expand Down Expand Up @@ -93,43 +93,30 @@ def audit_construct_library_set_scope(value, system):


@audit_checker('ConstructLibrarySet', frame='object')
def audit_integrated_content_files(value, system):
def audit_construct_library_set_guide_design(value, system):
'''
[
{
"audit_description": "Guide libraries are expected to link to an integrated content file of guide RNA sequences.",
"audit_category": "missing guide RNA sequences",
"audit_level": "NOT_COMPLIANT"
},
{
"audit_description": "Reporter libraries are expected to link to an integrated content file of MPRA sequence designs.",
"audit_category": "missing MPRA sequence designs",
"audit_level": "NOT_COMPLIANT"
}
]
'''
audit_message_guide = get_audit_message(audit_integrated_content_files, index=0)
audit_message_reporter = get_audit_message(audit_integrated_content_files, index=1)
library_expectation = {
'guide library': ('guide RNA sequences', audit_message_guide),
'reporter library': ('MPRA sequence designs', audit_message_reporter),
}
integrated_content_files = value.get('integrated_content_files', '')
library_type = value.get('file_set_type', '')
if library_type in library_expectation:
file_expectation = library_expectation[library_type][0]
audit_message = library_expectation[library_type][1]
audit_message = get_audit_message(audit_construct_library_set_guide_design)
if value.get('file_set_type', '') == 'guide library':
integrated_content_files = value.get('integrated_content_files', '')
if integrated_content_files:
files = [system.get('request').embed(file, '@@object?skip_calculated=true')
for file in integrated_content_files]
if not ([file for file in files if file['content_type'] == file_expectation]):
if not ([file for file in files if file['content_type'] == 'guide RNA sequences']):
detail = (f'Construct library set {audit_link(path_to_text(value["@id"]), value["@id"])} has no '
f'linked files in `integrated_content_files` with `content_type` {file_expectation}.')
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")}', level=audit_message.get('audit_level', ''))
f'linked files in `integrated_content_files` with `content_type` "guide RNA sequences".')
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")})', level=audit_message.get('audit_level', ''))
else:
detail = (f'Construct library set {audit_link(path_to_text(value["@id"]), value["@id"])} has no '
f'`integrated_content_files`.')
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")}', level=audit_message.get('audit_level', ''))
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")})', level=audit_message.get('audit_level', ''))


@audit_checker('ConstructLibrarySet', frame='object')
Expand Down Expand Up @@ -160,4 +147,4 @@ def audit_construct_library_set_orf_gene(value, system):
f'Construct library set {audit_link(path_to_text(value["@id"]), value["@id"])} '
f'has a `small_scale_gene_list` which does not match the genes of its associated `orf_list`.'
)
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")}', level=audit_message.get('audit_level', ''))
yield AuditFailure(audit_message.get('audit_category', ''), f'{detail} {audit_message.get("audit_description", "")})', level=audit_message.get('audit_level', ''))
4 changes: 2 additions & 2 deletions src/igvfd/mappings/construct_library_set.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hash": "b8a3872fe50e49f54571b421dade990c",
"index_name": "construct_library_set_b8a3872f",
"hash": "589aee3185664ed4d88efdd4ecb42d57",
"index_name": "construct_library_set_589aee31",
"item_type": "construct_library_set",
"mapping": {
"dynamic_templates": [
Expand Down
29 changes: 0 additions & 29 deletions src/igvfd/tests/test_audit_construct_library_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,35 +210,6 @@ def test_audit_construct_library_set_guide_library_guide_rna_sequences(
for error in res.json['audit'].get('NOT_COMPLIANT', []))


def test_audit_construct_library_set_mpra_sequence_designs(
testapp,
construct_library_set_reporter,
tabular_file
):
res = testapp.get(construct_library_set_reporter['@id'] + '@@audit')
assert any(
error['category'] == 'missing MPRA sequence designs'
for error in res.json['audit'].get('NOT_COMPLIANT', [])
)
testapp.patch_json(
construct_library_set_reporter['@id'],
{'integrated_content_files': [tabular_file['@id']]}
)
res = testapp.get(construct_library_set_reporter['@id'] + '@@audit')
assert any(
error['category'] == 'missing MPRA sequence designs'
for error in res.json['audit'].get('NOT_COMPLIANT', [])
)
testapp.patch_json(
tabular_file['@id'],
{'content_type': 'MPRA sequence designs'}
)
res = testapp.get(construct_library_set_reporter['@id'] + '@@audit')
assert all(
error['category'] != 'missing MPRA sequence designs'
for error in res.json['audit'].get('NOT_COMPLIANT', []))


def test_audit_unexpected_virtual_sample(
testapp,
construct_library_set_genome_wide,
Expand Down
1 change: 0 additions & 1 deletion src/igvfd/types/file_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class FileSet(Item):
'samples.disease_terms',
'samples.treatments',
'samples.modifications',
'samples.construct_library_sets',
'donors',
]

Expand Down
8 changes: 6 additions & 2 deletions src/igvfd/types/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Sample(Item):
'lab',
'sources',
'sample_terms',
'construct_library_sets',
'treatments'
]

set_status_up = [
Expand Down Expand Up @@ -772,7 +772,11 @@ class WholeOrganism(Biosample):
item_type = 'whole_organism'
schema = load_schema('igvfd:schemas/whole_organism.json')
embedded_with_frame = Biosample.embedded_with_frame
audit_inherit = Biosample.audit_inherit
audit_inherit = Biosample.audit_inherit + [
'disease_terms',
'treatments',
'modifications',
]
set_status_up = Biosample.set_status_up + []
set_status_down = Biosample.set_status_down + []

Expand Down