From cfe43383f5ff7883d4e9d977ae2c7a8fdef42760 Mon Sep 17 00:00:00 2001 From: Josef Hardi Date: Sat, 3 Aug 2024 15:41:39 -0700 Subject: [PATCH] Combine together CL and PCL to simplify the process --- scripts/download-ontologies.sh | 15 +++++++++------ src/enrichment/enrich-2d-ftu.js | 13 ------------- src/enrichment/enrich-asct-b.js | 13 ------------- src/utils/get-cl-terms.sparql | 6 ++++-- src/utils/get-pcl-terms.sparql | 16 ---------------- 5 files changed, 13 insertions(+), 50 deletions(-) delete mode 100644 src/utils/get-pcl-terms.sparql diff --git a/scripts/download-ontologies.sh b/scripts/download-ontologies.sh index d76960c..b523d3e 100755 --- a/scripts/download-ontologies.sh +++ b/scripts/download-ontologies.sh @@ -36,21 +36,24 @@ rm -rf $MIRROR_DIR/fma.zip echo "Downloading the latest CL ontology..." curl -L "$OBO_BASE_URL/cl/cl-base.owl" \ - --create-dirs -o "$MIRROR_DIR/cl.owl" \ + --create-dirs -o "$MIRROR_DIR/cl-base.owl" \ --retry 4 \ --max-time 200 && \ -robot convert -i "$MIRROR_DIR/cl.owl" \ +robot convert -i "$MIRROR_DIR/cl-base.owl" \ --format owl \ - -o "$MIRROR_DIR/cl.owl" + -o "$MIRROR_DIR/cl-base.owl" echo "Downloading the latest PCL ontology..." curl -L "$OBO_BASE_URL/pcl/pcl-base.owl" \ - --create-dirs -o "$MIRROR_DIR/pcl.owl" \ + --create-dirs -o "$MIRROR_DIR/pcl-base.owl" \ --retry 4 \ --max-time 200 && \ -robot convert -i "$MIRROR_DIR/pcl.owl" \ +robot convert -i "$MIRROR_DIR/pcl-base.owl" \ --format owl \ - -o "$MIRROR_DIR/pcl.owl" + -o "$MIRROR_DIR/pcl-base.owl" + +echo "Merging CL and PCL ontologies to create a full CL ontology..." +robot merge --input "$MIRROR_DIR/cl-base.owl" --input "$MIRROR_DIR/pcl-base.owl" -o "$MIRROR_DIR/cl.owl" echo "Downloading the latest LHMA ontology..." curl -L "https://data.bioontology.org/ontologies/LUNGMAP_H_CELL/submissions/6/download?apikey=8b5b7825-538d-40e0-9e9e-5ab9274a9aeb" \ diff --git a/src/enrichment/enrich-2d-ftu.js b/src/enrichment/enrich-2d-ftu.js index 89987a7..5075e93 100644 --- a/src/enrichment/enrich-2d-ftu.js +++ b/src/enrichment/enrich-2d-ftu.js @@ -66,19 +66,6 @@ export function enrich2dFtuData(context) { push(inputPaths, clExtractPath); } - const pclEntitiesPath = collectEntities(context, 'pcl', baseInputPath); - if (!isFileEmpty(pclEntitiesPath)) { - info('Extracting PCL.'); - const pclExtractPath = extractClassHierarchy( - context, - 'pcl', - 'http://purl.obolibrary.org/obo/CL_0000000', - pclEntitiesPath - ); - logOutput(pclExtractPath); - push(inputPaths, pclExtractPath); - } - info('Merging files:'); for (const inputPath of inputPaths) { more(` -> ${inputPath}`); diff --git a/src/enrichment/enrich-asct-b.js b/src/enrichment/enrich-asct-b.js index 2c32b24..c77b21f 100644 --- a/src/enrichment/enrich-asct-b.js +++ b/src/enrichment/enrich-asct-b.js @@ -93,19 +93,6 @@ export function enrichAsctbData(context) { inputPaths.push(clExtractPath); } - const pclEntitiesPath = collectEntities(context, 'pcl', enrichedWithValidationPath); - if (!isFileEmpty(pclEntitiesPath)) { - info('Extracting PCL.'); - const pclExtractPath = extractClassHierarchy( - context, - 'pcl', - 'http://purl.obolibrary.org/obo/CL_0000000', - pclEntitiesPath - ); - logOutput(pclExtractPath); - inputPaths.push(pclExtractPath); - } - const lmhaEntitiesPath = collectEntities(context, 'lmha', enrichedWithValidationPath); if (!isFileEmpty(lmhaEntitiesPath)) { info('Extracting LMHA.'); diff --git a/src/utils/get-cl-terms.sparql b/src/utils/get-cl-terms.sparql index 9d3951d..f32cc28 100644 --- a/src/utils/get-cl-terms.sparql +++ b/src/utils/get-cl-terms.sparql @@ -3,14 +3,16 @@ WHERE { { SELECT (?s AS ?entity) WHERE { ?s ?p ?o . - FILTER(STRSTARTS(STR(?s),"http://purl.obolibrary.org/obo/CL_")) + FILTER(STRSTARTS(STR(?s),"http://purl.obolibrary.org/obo/CL_") + || STRSTARTS(STR(?s),"http://purl.obolibrary.org/obo/PCL_")) } } UNION { SELECT (?o AS ?entity) WHERE { ?s ?p ?o . - FILTER(STRSTARTS(STR(?o),"http://purl.obolibrary.org/obo/CL_")) + FILTER(STRSTARTS(STR(?o),"http://purl.obolibrary.org/obo/CL_") + || STRSTARTS(STR(?o),"http://purl.obolibrary.org/obo/PCL_")) } } } \ No newline at end of file diff --git a/src/utils/get-pcl-terms.sparql b/src/utils/get-pcl-terms.sparql deleted file mode 100644 index ce915be..0000000 --- a/src/utils/get-pcl-terms.sparql +++ /dev/null @@ -1,16 +0,0 @@ -SELECT DISTINCT ?entity -WHERE { - { - SELECT (?s AS ?entity) WHERE { - ?s ?p ?o . - FILTER(STRSTARTS(STR(?s),"http://purl.obolibrary.org/obo/PCL_")) - } - } - UNION - { - SELECT (?o AS ?entity) WHERE { - ?s ?p ?o . - FILTER(STRSTARTS(STR(?o),"http://purl.obolibrary.org/obo/PCL_")) - } - } -} \ No newline at end of file