Commit fcf88503 authored by David Mendez's avatar David Mendez
Browse files

Entities Join: finish adding all cases until now

parent c6370ec1
...@@ -46,11 +46,12 @@ class SelectionModes(Enum): ...@@ -46,11 +46,12 @@ class SelectionModes(Enum):
NO_ITEMS_EXCEPT = 'noItemsExcept' NO_ITEMS_EXCEPT = 'noItemsExcept'
INDEX_NAMES_FOR_FROM_ENTITIES = { INDEX_NAMES_FOR_ORIGIN_ENTITIES = {
PossibleOriginEntities.CHEMBL_ACTIVITIES: 'chembl_activity', PossibleOriginEntities.CHEMBL_ACTIVITIES: 'chembl_activity',
PossibleOriginEntities.CHEMBL_COMPOUNDS: 'chembl_molecule', PossibleOriginEntities.CHEMBL_COMPOUNDS: 'chembl_molecule',
PossibleOriginEntities.CHEMBL_DRUGS: 'chembl_molecule', PossibleOriginEntities.CHEMBL_DRUGS: 'chembl_molecule',
PossibleOriginEntities.CHEMBL_DRUG_MECHANISMS: 'chembl_mechanism_by_parent_target', PossibleOriginEntities.CHEMBL_DRUG_MECHANISMS: 'chembl_mechanism_by_parent_target',
PossibleOriginEntities.CHEMBL_DRUG_INDICATIONS: 'chembl_drug_indication_by_parent',
PossibleOriginEntities.CHEMBL_TARGETS: 'chembl_target', PossibleOriginEntities.CHEMBL_TARGETS: 'chembl_target',
PossibleOriginEntities.CHEMBL_ASSAYS: 'chembl_assay', PossibleOriginEntities.CHEMBL_ASSAYS: 'chembl_assay',
PossibleOriginEntities.CHEMBL_DOCUMENTS: 'chembl_document', PossibleOriginEntities.CHEMBL_DOCUMENTS: 'chembl_document',
...@@ -65,7 +66,7 @@ def get_index_name_for_origin_entity(parsed_origin_entity): ...@@ -65,7 +66,7 @@ def get_index_name_for_origin_entity(parsed_origin_entity):
:param parsed_origin_entity: entity 'from' parsed by the PossibleEntitiesFrom enum :param parsed_origin_entity: entity 'from' parsed by the PossibleEntitiesFrom enum
:return: the index name corresponding to the from entity :return: the index name corresponding to the from entity
""" """
index_name = INDEX_NAMES_FOR_FROM_ENTITIES.get(parsed_origin_entity) index_name = INDEX_NAMES_FOR_ORIGIN_ENTITIES.get(parsed_origin_entity)
return index_name return index_name
...@@ -145,9 +146,103 @@ JOIN_PROPERTIES = { ...@@ -145,9 +146,103 @@ JOIN_PROPERTIES = {
PossibleDestinationEntities.CHEMBL_DRUGS: { PossibleDestinationEntities.CHEMBL_DRUGS: {
'origin_property': 'parent_molecule.molecule_chembl_id', 'origin_property': 'parent_molecule.molecule_chembl_id',
'destination_query_generator': create_simple_query_generator(['molecule_chembl_id']) 'destination_query_generator': create_simple_query_generator(['molecule_chembl_id'])
},
PossibleDestinationEntities.CHEMBL_COMPOUNDS: {
'origin_property': 'parent_molecule.molecule_chembl_id',
'destination_query_generator': create_simple_query_generator(
['molecule_chembl_id', 'molecule_hierarchy.parent_chembl_id']
)
},
PossibleDestinationEntities.CHEMBL_TARGETS: {
'origin_property': 'target.target_chembl_id',
'destination_query_generator': create_simple_query_generator(
['target_chembl_id']
)
}
}
},
PossibleOriginEntities.CHEMBL_DRUG_INDICATIONS: {
'to': {
PossibleDestinationEntities.CHEMBL_DRUGS: {
'origin_property': 'parent_molecule.molecule_chembl_id',
'destination_query_generator': create_simple_query_generator(['molecule_chembl_id'])
},
PossibleDestinationEntities.CHEMBL_COMPOUNDS: {
'origin_property': 'parent_molecule.molecule_chembl_id',
'destination_query_generator': create_simple_query_generator(
['molecule_chembl_id', 'molecule_hierarchy.parent_chembl_id']
)
} }
} }
}, },
PossibleOriginEntities.CHEMBL_ACTIVITIES: {
'to': {
PossibleDestinationEntities.CHEMBL_COMPOUNDS: {
'origin_property': 'molecule_chembl_id',
'destination_query_generator': create_simple_query_generator(['molecule_chembl_id'])
},
PossibleDestinationEntities.CHEMBL_TARGETS: {
'origin_property': 'target_chembl_id',
'destination_query_generator': create_simple_query_generator(['target_chembl_id'])
},
PossibleDestinationEntities.CHEMBL_ASSAYS: {
'origin_property': 'assay_chembl_id',
'destination_query_generator': create_simple_query_generator(['assay_chembl_id'])
},
PossibleDestinationEntities.CHEMBL_DOCUMENTS: {
'origin_property': 'document_chembl_id',
'destination_query_generator': create_simple_query_generator(['document_chembl_id'])
},
}
},
PossibleOriginEntities.CHEMBL_TARGETS: {
'to': {
PossibleDestinationEntities.CHEMBL_ACTIVITIES: {
'origin_property': 'target_chembl_id',
'destination_query_generator': create_simple_query_generator(['target_chembl_id'])
},
PossibleDestinationEntities.CHEMBL_DRUG_MECHANISMS: {
'origin_property': 'target_chembl_id',
'destination_query_generator': create_simple_query_generator(['target.target_chembl_id'])
},
}
},
PossibleOriginEntities.CHEMBL_ASSAYS: {
'to': {
PossibleDestinationEntities.CHEMBL_ACTIVITIES: {
'origin_property': 'assay_chembl_id',
'destination_query_generator': create_simple_query_generator(['assay_chembl_id'])
},
},
},
PossibleOriginEntities.CHEMBL_DOCUMENTS: {
'to': {
PossibleDestinationEntities.CHEMBL_ACTIVITIES: {
'origin_property': 'document_chembl_id',
'destination_query_generator': create_simple_query_generator(['document_chembl_id'])
},
},
},
PossibleOriginEntities.CHEMBL_CELL_LINES: {
'to': {
PossibleDestinationEntities.CHEMBL_ACTIVITIES: {
'origin_property': 'cell_chembl_id',
'destination_query_generator': create_simple_query_generator(
['_metadata.assay_data.cell_chembl_id']
)
},
}
},
PossibleOriginEntities.CHEMBL_TISSUES: {
'to': {
PossibleDestinationEntities.CHEMBL_ACTIVITIES: {
'origin_property': 'tissue_chembl_id',
'destination_query_generator': create_simple_query_generator(
['_metadata.assay_data.tissue_chembl_id']
)
},
}
},
PossibleOriginEntities.CHEMBL_DRUG_WARNINGS: { PossibleOriginEntities.CHEMBL_DRUG_WARNINGS: {
'to': { 'to': {
PossibleDestinationEntities.CHEMBL_ACTIVITIES: { PossibleDestinationEntities.CHEMBL_ACTIVITIES: {
...@@ -181,7 +276,10 @@ SETTINGS_PATHS_FOR_DESTINATION_ENTITIES = { ...@@ -181,7 +276,10 @@ SETTINGS_PATHS_FOR_DESTINATION_ENTITIES = {
PossibleDestinationEntities.CHEMBL_COMPOUNDS: 'ES_INDEXES_NO_MAIN_SEARCH.COMPOUND_COOL_CARDS', PossibleDestinationEntities.CHEMBL_COMPOUNDS: 'ES_INDEXES_NO_MAIN_SEARCH.COMPOUND_COOL_CARDS',
PossibleDestinationEntities.CHEMBL_DRUGS: 'ES_INDEXES_NO_MAIN_SEARCH.DRUGS_LIST', PossibleDestinationEntities.CHEMBL_DRUGS: 'ES_INDEXES_NO_MAIN_SEARCH.DRUGS_LIST',
PossibleDestinationEntities.CHEMBL_DRUG_MECHANISMS: 'ES_INDEXES_NO_MAIN_SEARCH.MECHANISMS_OF_ACTION', PossibleDestinationEntities.CHEMBL_DRUG_MECHANISMS: 'ES_INDEXES_NO_MAIN_SEARCH.MECHANISMS_OF_ACTION',
PossibleDestinationEntities.CHEMBL_DRUG_INDICATIONS: 'ES_INDEXES_NO_MAIN_SEARCH.DRUG_INDICATIONS' PossibleDestinationEntities.CHEMBL_DRUG_INDICATIONS: 'ES_INDEXES_NO_MAIN_SEARCH.DRUG_INDICATIONS',
PossibleDestinationEntities.CHEMBL_TARGETS: 'ES_INDEXES.TARGET',
PossibleDestinationEntities.CHEMBL_ASSAYS: 'ES_INDEXES.ASSAY',
PossibleDestinationEntities.CHEMBL_DOCUMENTS: 'ES_INDEXES.DOCUMENT',
} }
BROWSER_NAMES_FOR_DESTINATION_ENTITIES = { BROWSER_NAMES_FOR_DESTINATION_ENTITIES = {
...@@ -189,7 +287,10 @@ BROWSER_NAMES_FOR_DESTINATION_ENTITIES = { ...@@ -189,7 +287,10 @@ BROWSER_NAMES_FOR_DESTINATION_ENTITIES = {
PossibleDestinationEntities.CHEMBL_COMPOUNDS: 'compounds', PossibleDestinationEntities.CHEMBL_COMPOUNDS: 'compounds',
PossibleDestinationEntities.CHEMBL_DRUGS: 'drugs', PossibleDestinationEntities.CHEMBL_DRUGS: 'drugs',
PossibleDestinationEntities.CHEMBL_DRUG_MECHANISMS: 'mechanisms_of_action', PossibleDestinationEntities.CHEMBL_DRUG_MECHANISMS: 'mechanisms_of_action',
PossibleDestinationEntities.CHEMBL_DRUG_INDICATIONS: 'drug_indications' PossibleDestinationEntities.CHEMBL_DRUG_INDICATIONS: 'drug_indications',
PossibleDestinationEntities.CHEMBL_TARGETS: 'targets',
PossibleDestinationEntities.CHEMBL_ASSAYS: 'assays',
PossibleDestinationEntities.CHEMBL_DOCUMENTS: 'documents',
} }
......
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "*"
}
}
],
"filter": []
}
}
}
\ No newline at end of file
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "*"
}
}
],
"filter": [
[
{
"bool": {
"should": [
{
"term": {
"drug_indication.mesh_heading": "Melanoma"
}
}
]
}
}
]
]
}
}
}
\ No newline at end of file
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "*"
}
}
],
"filter": [
[
{
"bool": {
"should": [
{
"term": {
"_metadata.target_data.target_type": "MACROMOLECULE"
}
}
]
}
}
]
]
}
}
}
\ No newline at end of file
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "*"
}
}
],
"filter": [
[
{
"bool": {
"should": [
{
"term": {
"_metadata.organism_taxonomy.l1": "Fungi"
}
}
]
}
}
]
]
}
}
}
\ No newline at end of file
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "*"
}
}
],
"filter": [
[
{
"bool": {
"should": [
{
"term": {
"bao_label": "biochemical format"
}
}
]
}
}
]
]
}
}
}
\ No newline at end of file
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "*"
}
}
],
"filter": [
[
{
"bool": {
"should": [
{
"term": {
"doc_type": "DATASET"
}
}
]
}
}
]
]
}
}
}
\ No newline at end of file
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "*"
}
}
],
"filter": [
[
{
"bool": {
"should": [
{
"term": {
"cell_source_tissue": "Blood"
}
}
]
}
}
]
]
}
}
}
\ No newline at end of file
...@@ -95,6 +95,90 @@ TESTS_TO_RUN = [ ...@@ -95,6 +95,90 @@ TESTS_TO_RUN = [
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_3.json', 'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_3.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []} 'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
}, },
{
'entity_from': 'CHEMBL_DRUG_MECHANISMS',
'entity_to': 'CHEMBL_COMPOUNDS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_3.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_DRUG_MECHANISMS',
'entity_to': 'CHEMBL_TARGETS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_3.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_DRUG_INDICATIONS',
'entity_to': 'CHEMBL_DRUGS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_4.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_DRUG_INDICATIONS',
'entity_to': 'CHEMBL_COMPOUNDS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_4.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_ACTIVITIES',
'entity_to': 'CHEMBL_COMPOUNDS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_5.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_ACTIVITIES',
'entity_to': 'CHEMBL_TARGETS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_5.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_ACTIVITIES',
'entity_to': 'CHEMBL_ASSAYS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_5.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_ACTIVITIES',
'entity_to': 'CHEMBL_DOCUMENTS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_5.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_TARGETS',
'entity_to': 'CHEMBL_ACTIVITIES',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_6.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_TARGETS',
'entity_to': 'CHEMBL_DRUG_MECHANISMS',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_6.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_ASSAYS',
'entity_to': 'CHEMBL_ACTIVITIES',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_7.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_DOCUMENTS',
'entity_to': 'CHEMBL_ACTIVITIES',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_8.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_CELL_LINES',
'entity_to': 'CHEMBL_ACTIVITIES',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_9.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
{
'entity_from': 'CHEMBL_TISSUES',
'entity_to': 'CHEMBL_ACTIVITIES',
'dataset_query_path': 'functional_tests/specific_tests/data/entities_join_query_10.json',
'selection_description': {"selectionMode": "allItemsExcept", "exceptions": []}
},
] ]
......
Markdown is supported
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