Skip to content

Commit

Permalink
Include the organ partonomy and not just the class hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
johardi committed May 3, 2024
1 parent c8161e1 commit 19db1ba
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 64 deletions.
49 changes: 20 additions & 29 deletions src/enrichment/enrich-2d-ftu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import { resolve } from 'path';
import { error, header, info, more } from '../utils/logging.js';
import { convert, filter, merge, query } from '../utils/robot.js';
import { throwOnError } from '../utils/sh-exec.js';
import {
cleanTemporaryFiles,
import {
cleanTemporaryFiles,
convertNormalizedMetadataToRdf,
convertNormalizedDataToOwl,
isFileEmpty,
collectEntities,
extractClassHierarchy,
extractOntologySubset,
excludeTerms,
logOutput
logOutput,
push
} from './utils.js';

export function enrich2dFtuMetadata(context) {
Expand All @@ -29,50 +31,39 @@ export function enrich2dFtuData(context) {
const normalizedPath = resolve(obj.path, 'normalized/normalized.yaml');
const baseInputPath = resolve(obj.path, 'enriched/base-input.ttl');
convertNormalizedDataToOwl(context, normalizedPath, baseInputPath);
logOutput(baseInputPath);

let inputPaths = []; // variable to hold input files for merging

const enrichedWithOntologyPath = resolve(obj.path, 'enriched/enriched-with-ontology.owl');

inputPaths.push(baseInputPath); // Set the enriched path as the initial

info('Getting concept details from reference ontologies...')
const uberonEntitiesPath = collectEntities(context, 'uberon', baseInputPath);
if (!isFileEmpty(uberonEntitiesPath)) {
info('Extracting UBERON.');
const uberonExtractPath = extractClassHierarchy(
context,
'uberon',
'http://purl.obolibrary.org/obo/UBERON_0001062',
uberonEntitiesPath
);
logOutput(uberonExtractPath);
inputPaths.push(uberonExtractPath);
}
push(inputPaths, baseInputPath); // Set the enriched path as the initial
push(inputPaths, extractOntologySubset(
context, 'uberon', baseInputPath,
["BFO:0000050", "RO:0001025"] // part of, located in
));

const fmaEntitiesPath = collectEntities(context, 'fma', baseInputPath);
if (!isFileEmpty(fmaEntitiesPath)) {
info('Extracting FMA.');
const fmaExtractPath = extractClassHierarchy(
context,
'fma',
'http://purl.org/sig/ont/fma/fma62955',
context,
'fma',
'http://purl.org/sig/ont/fma/fma62955',
fmaEntitiesPath);
logOutput(fmaExtractPath);
inputPaths.push(fmaExtractPath);
push(inputPaths, fmaExtractPath);
}

const clEntitiesPath = collectEntities(context, 'cl', baseInputPath);
if (!isFileEmpty(clEntitiesPath)) {
info('Extracting CL.');
const clExtractPath = extractClassHierarchy(
context,
'cl',
'http://purl.obolibrary.org/obo/CL_0000000',
context,
'cl',
'http://purl.obolibrary.org/obo/CL_0000000',
clEntitiesPath);
logOutput(clExtractPath);
inputPaths.push(clExtractPath);
push(inputPaths, clExtractPath);
}

const pclEntitiesPath = collectEntities(context, 'pcl', baseInputPath);
Expand All @@ -85,7 +76,7 @@ export function enrich2dFtuData(context) {
pclEntitiesPath
);
logOutput(pclExtractPath);
inputPaths.push(pclExtractPath);
push(inputPaths, pclExtractPath);
}

info('Merging files:');
Expand All @@ -109,7 +100,7 @@ export function enrich2dFtuData(context) {
// Clean up
info('Cleaning up temporary files...');
cleanTemporaryFiles(context);
more("Done.")
info('Done.');
}
}

23 changes: 9 additions & 14 deletions src/enrichment/enrich-landmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import {
convertNormalizedDataToOwl,
convertNormalizedMetadataToRdf,
extractClassHierarchy,
extractOntologySubset,
isFileEmpty,
logOutput,
push
} from './utils.js';

export function enrichLandmarkMetadata(context) {
Expand All @@ -33,21 +35,13 @@ export function enrichLandmarkData(context) {

const enrichedWithOntologyPath = resolve(obj.path, 'enriched/enriched-with-ontology.owl');

inputPaths.push(baseInputPath); // Set the enriched path as the initial
push(inputPaths, baseInputPath); // Set the enriched path as the initial

info('Getting concept details from reference ontologies...');
const uberonEntitiesPath = collectEntities(context, 'uberon', baseInputPath);
if (!isFileEmpty(uberonEntitiesPath)) {
info('Extracting UBERON.');
const uberonExtractPath = extractClassHierarchy(
context,
'uberon',
'http://purl.obolibrary.org/obo/UBERON_0001062',
uberonEntitiesPath
);
logOutput(uberonExtractPath);
inputPaths.push(uberonExtractPath);
}
push(inputPaths, extractOntologySubset(
context, 'uberon', baseInputPath,
["BFO:0000050", "RO:0001025"] // part of, located in
));

const fmaEntitiesPath = collectEntities(context, 'fma', baseInputPath);
if (!isFileEmpty(fmaEntitiesPath)) {
Expand All @@ -59,7 +53,7 @@ export function enrichLandmarkData(context) {
fmaEntitiesPath
);
logOutput(fmaExtractPath);
inputPaths.push(fmaExtractPath);
push(inputPaths, fmaExtractPath);
}

info(`Creating landmark: ${enrichedPath}`);
Expand All @@ -70,5 +64,6 @@ export function enrichLandmarkData(context) {
// Clean up
info('Cleaning up temporary files.');
cleanTemporaryFiles(context);
info('Done.');
}
}
34 changes: 13 additions & 21 deletions src/enrichment/enrich-ref-organ.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
isFileEmpty,
collectEntities,
extractClassHierarchy,
extractOntologySubset,
excludeTerms,
logOutput
logOutput,
push
} from './utils.js';

export function enrichRefOrganMetadata(context) {
Expand All @@ -24,7 +26,6 @@ export function enrichRefOrganMetadata(context) {
export function enrichRefOrganData(context) {
try {
const { selectedDigitalObject: obj } = context;

const normalizedPath = resolve(obj.path, 'normalized/normalized.yaml');
const ontologyPath = resolve(obj.path, 'enriched/ontology.ttl');
const baseInputPath = resolve(obj.path, 'enriched/base-input.ttl');
Expand All @@ -35,32 +36,22 @@ export function enrichRefOrganData(context) {

const enrichedWithOntologyPath = resolve(obj.path, 'enriched/enriched-with-ontology.owl');

inputPaths.push(baseInputPath); // Set the enriched path as the initial

info('Getting concept details from reference ontologies...')
const uberonEntitiesPath = collectEntities(context, 'uberon', baseInputPath);
if (!isFileEmpty(uberonEntitiesPath)) {
info('Extracting UBERON.');
const uberonExtractPath = extractClassHierarchy(
context,
'uberon',
'http://purl.obolibrary.org/obo/UBERON_0001062',
uberonEntitiesPath
);
logOutput(uberonExtractPath);
inputPaths.push(uberonExtractPath);
}
push(inputPaths, baseInputPath); // Set the enriched path as the initial
push(inputPaths, extractOntologySubset(
context, 'uberon', baseInputPath,
["BFO:0000050", "RO:0001025"] // part of, located in
));

const fmaEntitiesPath = collectEntities(context, 'fma', baseInputPath);
if (!isFileEmpty(fmaEntitiesPath)) {
info('Extracting FMA.');
const fmaExtractPath = extractClassHierarchy(
context,
'fma',
'http://purl.org/sig/ont/fma/fma62955',
context,
'fma',
'http://purl.org/sig/ont/fma/fma62955',
fmaEntitiesPath);
logOutput(fmaExtractPath);
inputPaths.push(fmaExtractPath);
push(inputPaths, fmaExtractPath);
}

info('Merging files:');
Expand All @@ -83,5 +74,6 @@ export function enrichRefOrganData(context) {
// Clean up
info('Cleaning up temporary files.');
cleanTemporaryFiles(context);
info('Done.');
}
}

0 comments on commit 19db1ba

Please sign in to comment.