Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ def get_assay_type_for_viz(doc):
# Check if the main entity can be visualized by portal-visualization.
doc['visualization'] = has_visualization(doc, get_assay_type_for_viz)

# Set the 'spatial' field for search based off of the presence of the 'spatial' hint
if ('spatial' in assay_details.get('vitessce-hints', [])):
doc['spatial'] = True

if not doc['visualization']:
# If an entity doesn't have a visualization,
# check its descendants for a supporting image pyramid.
Expand All @@ -225,9 +229,9 @@ def get_assay_type_for_descendants(descendant):
uuid = descendant
return _get_assay_details_by_uuid(uuid, transformation_resources)

# Filter any unpublished/non-QA descendants
# Filter any unpublished/non-QA descendants and multi-assay splits
descendants = [descendant for descendant in descendants if [
'Published', 'QA'].count(descendant.get('status')) > 0]
'Published', 'QA'].count(descendant.get('status')) > 0 and descendant.get('creation_action') != CreationAction.MULTI_ASSAY_SPLIT]
# Sort by the descendant's last modified timestamp, descending
descendants.sort(
key=lambda x: x['last_modified_timestamp'],
Expand All @@ -250,6 +254,6 @@ def get_assay_type_for_descendants(descendant):

_set_soft_assaytype(parent, parent_assay_info)

if has_visualization(parent, get_assay_type_for_viz):
if has_visualization(doc, get_assay_type_for_viz, parent):
doc['visualization'] = True
break
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,57 @@ def test_processed_dataset_type(mocker):
assert input_processed_doc == output_processed_doc


def mock_spatial_soft_assay(uuid=None, headers=None):
return mock_response({
"assaytype": "salmon_rnaseq_sciseq",
"contains-pii": True,
"pipeline-shorthand": "Salmon",
"description": "sciRNA-seq [Salmon]",
"primary": False,
"vitessce-hints": [
"is_sc",
"rna",
"spatial"
]
})


def test_spatial_dataset_type(mocker):
mocker.patch('requests.get', side_effect=[
mock_spatial_soft_assay(),
mock_empty_descendants()])
input_processed_doc = {
'uuid': '22684b9011fc5aea5cb3f89670a461e8',
'dataset_type': 'RNAseq [Salmon]',
'entity_type': 'Dataset',
'creation_action': 'Central Process'
}

output_processed_doc = {
'assay_display_name': ['sciRNA-seq [Salmon]'],
'dataset_type': 'RNAseq [Salmon]',
'entity_type': 'Dataset',
'mapped_data_types': ['sciRNA-seq [Salmon]'],
'pipeline': 'Salmon',
'raw_dataset_type': 'RNAseq',
'assay_modality': 'single',
'creation_action': 'Central Process',
'processing': 'processed',
'processing_type': 'hubmap',
'uuid': '22684b9011fc5aea5cb3f89670a461e8',
'soft_assaytype': 'salmon_rnaseq_sciseq',
'vitessce-hints': [
"is_sc",
"rna",
"spatial"
],
'visualization': True,
'spatial': True,
}
add_assay_details(input_processed_doc, mock_transformation_resources)
assert input_processed_doc == output_processed_doc


def mock_empty_soft_assay(uuid=None, headers=None):
return mock_response({})

Expand Down
2 changes: 1 addition & 1 deletion src/search-adaptor
Submodule search-adaptor updated 1 files
+1 −1 VERSION
Loading