UNPKG

hra-api

Version:

The Human Reference Atlas (HRA) API deployed to https://apps.humanatlas.io/api/

675 lines (662 loc) 24 kB
// src/library/ds-graph/operations/atlas-d2k.js import { convertToJsonLd } from "hra-rui-locations-processor/src/core/main.js"; import { normalizeRegistration } from "hra-rui-locations-processor/src/core/normalizer.js"; // src/library/ds-graph/utils/atlas-d2k-fetch.js async function fetchAllRows(url, pageLimit, afterRIDValue) { try { let usedURL = url + "@sort(RID)"; if (afterRIDValue) { usedURL += `@after(${afterRIDValue})`; } usedURL += "?limit=" + (pageLimit + 1); const response = await fetch(usedURL); if (response.status !== 200) { console.error("did not recieve a 200 response"); console.log(await response.text()); return []; } let responseRows = await response.json(); if (responseRows.length > pageLimit) { responseRows.pop(); const lastRowRID = responseRows[responseRows.length - 1].RID; const nextRows = await fetchAllRows(url, pageLimit, lastRowRID); return responseRows.concat(nextRows); } else { return responseRows; } } catch (err) { console.error("error while fetching data"); console.log(err); return []; } } // src/library/ds-graph/operations/atlas-d2k.js var ENDPOINT = "https://www.atlas-d2k.org"; var EXTRACTION_SITES = `${ENDPOINT}/ermrest/catalog/2/attribute/Gene_Expression:HRA_3D_Coordinate/RID,File_URL`; var ENTITIES = `${ENDPOINT}/ermrest/catalog/2/entity/Gene_Expression:Specimen/!(HRA_3D_Coordinate::null::)`; var ENTITY_LINK = `${ENDPOINT}/chaise/record/#2/Gene_Expression:Specimen/RID=`; var ENTITY_ID_PREFIX = `${ENDPOINT}/id/`; var EXTRACTION_SITE_FILE_PATH = "File_URL"; var ENTITY_EXTRACTION_SITE_RID = "HRA_3D_Coordinate"; var CONSORTIUM = "Consortium"; var CONSORTIUM_LOOKUP = { GUDMAP: "d7ea2910-7857-4f98-841b-895e7cd71897" }; async function reformatResponse(entries) { const registrations = entries.map((entry) => { const ageStr = entry.Stage_Detail?.split(" ")[0] ?? void 0; return { consortium_name: entry[CONSORTIUM], provider_name: entry[CONSORTIUM], provider_uuid: CONSORTIUM_LOOKUP[entry[CONSORTIUM]] ?? entry[CONSORTIUM], defaults: { id: ENTITY_ID_PREFIX, link: ENDPOINT }, donors: [ { id: `${ENTITY_ID_PREFIX}${entry.RID}#Donor`, sex: entry.Sex, age: ageStr ? Number(ageStr) : void 0, link: `${ENTITY_LINK}${entry.RID}`, samples: [ { id: `${ENTITY_ID_PREFIX}${entry.RID}`, rui_location: entry.rui_location } ] } ] }; }); return convertToJsonLd(await normalizeRegistration(registrations), "", ""); } async function atlasD2kRegistrations() { const rows = await fetchAllRows(EXTRACTION_SITES, 500); const coordLookup = {}; for (const row of rows) { const registryFileURL = row[EXTRACTION_SITE_FILE_PATH]; if (registryFileURL) { const response = await fetch(`${ENDPOINT}${registryFileURL}`); if (response.status === 200) { coordLookup[row.RID] = await response.json(); } } } const entries = await fetchAllRows(ENTITIES, 500); for (const entry of entries) { if (entry[ENTITY_EXTRACTION_SITE_RID]) { entry.rui_location = coordLookup[entry[ENTITY_EXTRACTION_SITE_RID]] ?? void 0; } } return await reformatResponse(entries); } // src/library/ds-graph/operations/gtex.js var DEFAULT_GTEX_RUI_LOCATIONS = "https://hubmapconsortium.github.io/hra-registrations/gtex-pan-eraslan-2022/rui_locatio\ ns.jsonld"; var GTEX_API_URL = "https://gtexportal.org/api/v2/dataset/tissueSiteDetail"; function updateEntry(resultsList, tissueInfo, sex) { const matchingEntry = resultsList.find( (entry) => entry["@id"]?.includes(tissueInfo.tissueSiteDetailId) && entry.label.includes(sex) ); if (matchingEntry) { const index = resultsList.indexOf(matchingEntry); const sexStats = sex === "Male" ? tissueInfo.rnaSeqSampleSummary.male : tissueInfo.rnaSeqSampleSummary.female; resultsList[index].label = `${sex}s (n=${sexStats.count}) Mean Age ${sexStats.ageMean} (range ${sexStats.ageMin} - ${sexStats. ageMax})`; resultsList[index].sex = sex; } } async function gtexRegistrations() { try { const [jsonld, response] = await Promise.all([ fetch(DEFAULT_GTEX_RUI_LOCATIONS).then((r) => r.json()), fetch(GTEX_API_URL).then((r) => r.json()) ]); const results = jsonld["@graph"]; const mappedEntries = response?.data?.filter((entry) => entry.mappedInHubmap) ?? []; for (const tissue of mappedEntries) { updateEntry(results, tissue, "Female"); updateEntry(results, tissue, "Male"); } return jsonld; } catch (_error) { return void 0; } } // src/library/ds-graph/utils/xconsortia/entities/blocks.js import lodash from "lodash"; // src/library/ds-graph/utils/xconsortia/common.js var BASE_FIELDS = [ "uuid", "entity_type", "hubmap_id", "sennet_id", "group_uuid", "group_name", "last_modified_timestamp", "created_by_user_displayname" ]; var GROUP_UUID_MAPPING = { "03b3d854-ed44-11e8-8bce-0e368f3075e8": "TMC-UCSD", "07a29e4c-ed43-11e8-b56a-0e8017bdda58": "TMC-Florida", "308f5ffc-ed43-11e8-b56a-0e8017bdda58": "TMC-CalTech", "5bd084c8-edc2-11e8-802f-0e368f3075e8": "HBM-TestingGroup", "73bb26e4-ed43-11e8-8f19-0a7c1eab007a": "TMC-Vanderbilt", "def5fd76-ed43-11e8-b56a-0e8017bdda58": "TMC-Stanford", "5c106f29-ea2d-11e9-85e8-0efb3ba9a670": "RTI-General Electric", "301615f9-c870-11eb-a8dc-35ce3d8786fe": "TMC-UConn" }; var HUBMAP = { idPrefix: "https://entity.api.hubmapconsortium.org/entities/", portal: "https://portal.hubmapconsortium.org/browse/", consortium_name: "HuBMAP", portalParams: "/", donorName: "donor", assets: "https://assets.hubmapconsortium.org" }; var SENNET = { idPrefix: "https://entity.api.sennetconsortium.org/entities/", portal: "https://data.sennetconsortium.org/", consortium_name: "SenNet", portalParams: "?uuid=", donorName: "source", assets: "https://assets.sennetconsortium.org" }; function getPortalConfig(data) { return data.hubmap_id ? HUBMAP : data.sennet_id ? SENNET : void 0; } // src/library/ds-graph/utils/xconsortia/search.js var PER_API_SEARCH_REQUEST_COUNT = 1e4; function getApiSearchHeaders(token) { const headers = new Headers(); headers.append("Content-type", "application/json"); if (token) { headers.append("Authorization", `Bearer ${token}`); } return headers; } function getApiSearchBody(from, size, query, fields) { const bodyObj = { version: true, from, size, stored_fields: ["*"], script_fields: {}, docvalue_fields: [], query, _source: { includes: fields } }; return JSON.stringify(bodyObj); } async function doSearchRequest(url, init) { try { const res = await fetch(url, init); const text = await res.text(); const validResponse = res.ok || text.startsWith("https"); if (validResponse) { if (text.startsWith("https")) { return await fetch(text).then((r) => r.json()); } else { return JSON.parse(text); } } console.log(init, res); return void 0; } catch (_error) { console.log(_error); return void 0; } } async function doApiSearchWork(endpoint, token, query, fields) { const perReqCount = PER_API_SEARCH_REQUEST_COUNT; const headers = getApiSearchHeaders(token); const body = getApiSearchBody(0, perReqCount, query, fields); const firstResult = await doSearchRequest(endpoint, { method: "POST", headers, body }); if (!firstResult) { return void 0; } const totalCount = firstResult.hits.total.value; if (totalCount <= perReqCount) { return firstResult; } const requests = []; for (let from = perReqCount; from < totalCount; from += perReqCount) { requests.push( doSearchRequest(endpoint, { method: "POST", headers, body: getApiSearchBody(from, perReqCount, query) }) ); } const results = await Promise.all(requests); if (results.some((res) => !res)) { return void 0; } const items = results.map((res) => res.hits.hits); return { ...firstResult, hits: { ...firstResult.hits, hits: firstResult.hits.hits.concat(...items) } }; } async function doApiSearch(endpoint, token, query, fields) { const response = await doApiSearchWork(endpoint, token, query, fields); const entries = (response?.hits?.hits ?? []).map((e) => e?._source ?? {}).map((e) => ({ ...e, portal: getPortalConfig( e) })).filter((e) => e.portal).sort((a, b) => a["uuid"].localeCompare(b["uuid"])); return entries; } // src/library/ds-graph/utils/xconsortia/entities/blocks.js var { get, set, toNumber } = lodash; var FIELDS = [...BASE_FIELDS, "donor", "source", "rui_location", "sample_category"]; var QUERY = { bool: { must: [ { term: { "entity_type.keyword": "Sample" } }, { exists: { field: "rui_location" } } ] } }; function formatDonor(donor, portal) { const donorDescription = (donor.description || "").toLowerCase(); let sex; if (donorDescription.includes("female")) { sex = "Female"; } else if (donorDescription.includes("male")) { sex = "Male"; } const ageMatch = donorDescription.match(/age ([0-9]+)/) ?? donorDescription.match(/ ([0-9]+) years/); let age; if (ageMatch) { age = toNumber(ageMatch[1]); } let bmi; let race; const metadata = donor.mapped_metadata ?? donor.source_mapped_metadata ?? {}; if (!sex && metadata.sex?.length > 0) { sex = metadata.sex[0]; } if (!race && metadata.race?.length > 0) { race = metadata.race[0]; } if (!age && metadata.age_value?.length > 0) { age = metadata.age_value[0]; } if (!bmi && metadata.body_mass_index_value?.length > 0) { bmi = metadata.body_mass_index_value[0]; } if (typeof donor.metadata === "string") { donor.metadata = new Function("return " + donor.metadata)(); } const donor_data = donor?.metadata?.organ_donor_data ?? donor?.metadata?.living_donor_data ?? []; for (const md of donor_data) { if (md.preferred_term === "Feminine gender" || md.preferred_term === "Female") { sex = "Female"; } else if (md.preferred_term === "Masculine gender" || md.preferred_term === "Male") { sex = "Male"; } else if (md.preferred_term === "Current chronological age" || md.preferred_term === "Age") { age = toNumber(md.data_value); } else if (md.preferred_term === "Body mass index") { bmi = toNumber(md.data_value); } else if (md.grouping_concept_preferred_term === "Race") { race = md.preferred_term; } } let label = ""; if (sex && age) { label += `${sex}, Age ${age}`; if (bmi) { label += `, BMI ${bmi.toFixed(1)}`; } } else if (sex) { label = sex; } const dateEntered = new Date(donor.last_modified_timestamp).toLocaleDateString(); const groupName = GROUP_UUID_MAPPING[donor.group_uuid] || donor.group_name; const creator = donor.created_by_user_displayname; return { "@id": portal.idPrefix + donor.uuid, "@type": "Donor", uuid: donor.uuid, label, description: `Entered ${dateEntered}, ${creator}, ${groupName}`, link: `${portal.portal}${portal.donorName}${portal.portalParams}${donor.uuid}`, age, sex, bmi, race, consortium_name: portal.consortium_name, provider_name: groupName, provider_uuid: donor.group_uuid, samples: [] }; } function formatRuiLocation(data, donor) { let spatialEntity; let ruiLocation = data.rui_location; if (ruiLocation) { if (typeof ruiLocation === "string") { ruiLocation = JSON.parse(ruiLocation); } if (ruiLocation.alignment_id) { console.log("Detected a deprecated rui_location", data.uuid); } else if (ruiLocation["@id"]) { spatialEntity = ruiLocation; } ruiLocation["@context"] = "https://hubmapconsortium.github.io/ccf-ontology/ccf-context.jsonld"; } if (spatialEntity) { const target = get(spatialEntity, ["placement", "target"]) ?? ""; if (!donor.sex) { if (target.includes("#VHF") || target.includes("-female")) { donor.sex = "Female"; donor.label = donor.sex; } else if (target.includes("#VHM") || target.includes("-male")) { donor.sex = "Male"; donor.label = donor.sex; } } if (target.startsWith("http://purl.org/ccf/latest/ccf.owl#VHSpleenCC")) { if (donor.sex === "Male") { set(spatialEntity, ["placement", "target"], target.replace("#VHSpleenCC", "#VHMSpleenCC")); } else { set(spatialEntity, ["placement", "target"], target.replace("#VHSpleenCC", "#VHFSpleenCC")); } } else if (target === "http://purl.org/ccf/latest/ccf.owl#VHLeftKidney" || target === "http://purl.org/ccf/latest/cc\ f.owl#VHRightKidney") { if (donor.sex === "Male") { set(spatialEntity, ["placement", "target"], target.replace("#VH", "#VHM") + "_Patch"); } else { set(spatialEntity, ["placement", "target"], target.replace("#VH", "#VHF") + "_Patch"); } } } return spatialEntity; } function formatBlock(data) { const dateEntered = new Date(data.last_modified_timestamp).toLocaleDateString(); const groupName = GROUP_UUID_MAPPING[data.group_uuid] || data.group_name; const creator = data.created_by_user_displayname; const donor = formatDonor(data.donor ?? data.source, data.portal); return { "@id": data.portal.idPrefix + data.uuid, "@type": "Sample", label: `Registered ${dateEntered}, ${creator}, ${groupName}`, link: `${data.portal.portal}sample${data.portal.portalParams}${data.uuid}`, description: "", sample_type: "Tissue Block", donor, rui_location: formatRuiLocation(data, donor), sections: [], datasets: [], uuid: data.uuid }; } function updateBlockDescription(block) { const loc = block.rui_location ?? {}; const sections = block.sections; const dims = `${loc.x_dimension} x ${loc.y_dimension} x ${loc.z_dimension} ${loc.dimension_units}`; block.section_count = loc.slice_count || sections.length; const sSize = parseFloat( (loc.slice_thickness || (loc.z_dimension || 0) / Math.max(block.section_count, 1)).toFixed(1) ); block.section_size = sSize; const sUnits = loc.dimension_units || "millimeter"; block.section_units = sUnits; block.description = `${dims}, ${sSize} ${sUnits}, ${block.section_count} Sections`; sections.forEach((section, index) => { section.description = `${loc.x_dimension} x ${loc.y_dimension} x ${sSize} ${sUnits}, ${sSize} ${sUnits}`; section.section_number = index + 1; }); return block; } function reformatResponse2(response) { return response.map(formatBlock); } async function getBlocks(endpoint, token) { return reformatResponse2(await doApiSearch(endpoint, token, QUERY, FIELDS)); } // src/library/ds-graph/utils/xconsortia/entities/datasets.js var FIELDS2 = [ ...BASE_FIELDS, "dataset_type", "thumbnail_file", "source_samples.uuid", "source_samples.sample_category" ]; var QUERY2 = { bool: { must: [ { term: { "entity_type.keyword": "Dataset" } }, { exists: { field: "ancestors.rui_location" } } ] } }; var UFL_THUMBS = { "HBM558.SRZG.629": "HBM558.SRZG.629_UFL0002-SP-3-4-1.jpg", "HBM562.NTMH.548": "HBM562.NTMH.548_UFL0006-SP-1-2-1.jpg", "HBM685.KHRQ.684": "HBM685.KHRQ.684_UFL0008-LY07-1-1.jpg", "HBM278.SFQW.627": "HBM278.SFQW.627_UFL0008-LY09-1-1.jpg", "HBM427.SMGB.866": "HBM427.SMGB.866_UFL0004-SP-1-4-1.jpg", "HBM432.LLCF.677": "HBM432.LLCF.677_UFL0001-SP-2-5-1.jpg", "HBM586.ZSVS.996": "HBM586.ZSVS.996_UFL0008-SP-1-1-1.jpg", "HBM285.XMBT.542": "HBM285.XMBT.542_UFL0006-TH-1-3-1.jpg", "HBM289.BWJW.663": "HBM289.BWJW.663_UFL0006-TH-1-2-1.jpg", "HBM255.SRPR.985": "HBM255.SRPR.985_UFL0005-TH-2-2-1.jpg", "HBM799.WXHD.535": "HBM799.WXHD.535_UFL0009-LY02-1-1.jpg", "HBM294.RZFN.624": "HBM294.RZFN.624_UFL0005-TH-1-1-1.jpg", "HBM383.TRQG.424": "HBM383.TRQG.424_UFL0006-SP-1-3-1.jpg", "HBM647.MFQB.496": "HBM647.MFQB.496_UFL0001-SP-1-2-1.jpg", "HBM237.GGPR.739": "HBM237.GGPR.739_UFL0006-LY01-1-1.jpg", "HBM288.TPBD.654": "HBM288.TPBD.654_UFL0003-SP-2-2-1.jpg", "HBM974.NDXT.675": "HBM974.NDXT.675_UFL0008-TH-2-2-1.jpg", "HBM589.SLVV.423": "HBM589.SLVV.423_UFL0008-LY10-1-1.jpg", "HBM794.RLFN.358": "HBM794.RLFN.358_UFL0006-LY03-1-1.jpg", "HBM372.BQSR.778": "HBM372.BQSR.778_UFL0007-SP-1-1-1.jpg", "HBM499.TKDW.458": "HBM499.TKDW.458_UFL0009-LY03-1-1.jpg", "HBM342.PRQB.739": "HBM342.PRQB.739_UFL0003-LY06-1-1.jpg", "HBM633.CLVN.674": "HBM633.CLVN.674_UFL0003-SP-3-6-1.jpg", "HBM343.JQKM.578": "HBM343.JQKM.578_UFL0009-LY01-1-1.jpg", "HBM987.XGTH.368": "HBM987.XGTH.368_UFL0002-SP-2-4-1.jpg", "HBM964.CWCP.788": "HBM964.CWCP.788_UFL0006-LY02-2-1.jpg", "HBM244.TJLK.223": "HBM244.TJLK.223_UFL0003-SP-1-4-1.jpg", "HBM646.FSBQ.966": "HBM646.FSBQ.966_UFL0007-SP-2-2-1.jpg", "HBM572.GXSB.234": "HBM572.GXSB.234_UFL0003-SP-3-2-1.jpg", "HBM772.TKGJ.794": "HBM772.TKGJ.794_UFL0008-SP-2-1-1.jpg", "HBM239.CBWR.263": "HBM239.CBWR.263_UFL0008-SP-1-2-1.jpg", "HBM992.NRTT.383": "HBM992.NRTT.383_UFL0006-SP-1-1-1.jpg", "HBM283.DQXD.546": "HBM283.DQXD.546_UFL0003-SP-1-2-1.jpg", "HBM795.JHND.856": "HBM795.JHND.856_UFL0007-SP-1-2-1.jpg", "HBM267.BZKT.867": "HBM267.BZKT.867_UFL0003-SP-2-6-1.jpg", "HBM838.DLMJ.782": "HBM838.DLMJ.782_UFL0008-TH-1-1-1.jpg", "HBM337.FSXL.564": "HBM337.FSXL.564_UFL0001-SP-3-8-2.jpg", "HBM355.JDLK.244": "HBM355.JDLK.244_UFL0004-SP-2-4-1.jpg", "HBM599.PSZG.737": "HBM599.PSZG.737_UFL0006-LY02-1-1.jpg" }; function formatDataset(dataset, token = void 0) { const dateEntered = new Date(dataset.last_modified_timestamp).toLocaleDateString(); const groupName = GROUP_UUID_MAPPING[dataset.group_uuid] || dataset.group_name; const creator = dataset.created_by_user_displayname; const types = dataset.dataset_type ?? ""; const typesSearch = types.toLowerCase(); let technology; let thumbnail = "https://cdn.humanatlas.io/ui/ccf-eui/assets/icons/ico-unknown.svg"; if (typesSearch.indexOf("10x") !== -1) { technology = "10x"; thumbnail = "https://cdn.humanatlas.io/ui/ccf-eui/assets/icons/ico-bulk-10x.svg"; } else if (typesSearch.indexOf("af") !== -1 || typesSearch.indexOf("auto-fluorescence") !== -1) { technology = "AF"; thumbnail = "https://cdn.humanatlas.io/ui/ccf-eui/assets/icons/ico-spatial-af.svg"; } else if (typesSearch.indexOf("codex") !== -1) { technology = "CODEX"; thumbnail = "https://cdn.humanatlas.io/ui/ccf-eui/assets/icons/ico-spatial-codex.svg"; } else if (typesSearch.indexOf("imc") !== -1 || typesSearch.indexOf("imaging mass cytometry") !== -1) { technology = "IMC"; thumbnail = "https://cdn.humanatlas.io/ui/ccf-eui/assets/icons/ico-spatial-imc.svg"; } else if (typesSearch.indexOf("lc") !== -1 && typesSearch.indexOf("af") === -1) { technology = "LC"; thumbnail = "https://cdn.humanatlas.io/ui/ccf-eui/assets/icons/ico-bulk-lc.svg"; } else if (typesSearch.indexOf("maldi") !== -1) { technology = "MALDI"; } else if (typesSearch.indexOf("pas") !== -1) { technology = "PAS"; } else { technology = types.split(/ \[/)[0]; } thumbnail = formatDatasetThumbnail(dataset, token) ?? thumbnail; return { "@id": dataset.portal.idPrefix + dataset.uuid, "@type": "Dataset", label: `Registered ${dateEntered}, ${creator}, ${groupName}`, link: `${dataset.portal.portal}dataset${dataset.portal.portalParams}${dataset.uuid}`, description: `Dataset Type: ${types}`, technology, thumbnail, __ancestors: dataset.source_samples.map((s) => s.uuid) }; } function formatDatasetThumbnail(dataset, token = void 0) { if (dataset.thumbnail_file) { const thumbnailFile = dataset.thumbnail_file; return `${dataset.portal.assets}/${thumbnailFile.file_uuid}/${thumbnailFile.filename}` + (token ? `?token=${token}` : ""); } else if (dataset.group_uuid === "07a29e4c-ed43-11e8-b56a-0e8017bdda58") { const thumb = UFL_THUMBS[dataset.hubmap_id]; if (thumb) { return `https://hubmapconsortium.github.io/ccf-ui/assets/thumbnails/TMC-Florida/${thumb}`; } } return void 0; } function reformatResponse3(response, token = void 0) { return response.map((data) => formatDataset(data, token)); } async function getDatasets(endpoint, token = void 0) { return reformatResponse3(await doApiSearch(endpoint, token, QUERY2, FIELDS2)); } // src/library/ds-graph/utils/xconsortia/entities/sections.js var FIELDS3 = [...BASE_FIELDS, "sample_category", "ancestors.uuid"]; var QUERY3 = { bool: { must: [ { term: { "entity_type.keyword": "Sample" } }, { exists: { field: "ancestors.rui_location" } }, { exists: { field: "descendants.dataset_type" } } ] } }; function formatSection(section) { const dateEntered = new Date(section.last_modified_timestamp).toLocaleDateString(); const groupName = GROUP_UUID_MAPPING[section.group_uuid] || section.group_name; const creator = section.created_by_user_displayname; return { "@id": section.portal.idPrefix + section.uuid, "@type": "Sample", label: `Registered ${dateEntered}, ${creator}, ${groupName}`, link: `${section.portal.portal}sample${section.portal.portalParams}${section.uuid}`, description: "", sample_type: "Tissue Section", section_number: 1, samples: [], datasets: [], uuid: section.uuid, __ancestors: section.ancestors.map((a) => a.uuid) }; } function reformatResponse4(response) { return response.map(formatSection); } async function getSections(endpoint, token) { return reformatResponse4(await doApiSearch(endpoint, token, QUERY3, FIELDS3)); } // src/library/ds-graph/utils/xconsortia/graph.js async function getDatasetGraph(endpoint, token) { const [blocks, sections, datasets] = await Promise.all([ getBlocks(endpoint, token), getSections(endpoint, token), getDatasets(endpoint, token) ]); const donors = {}; const blockLookup = {}; for (const block of blocks) { const donor = donors[block.donor.uuid] = donors[block.donor.uuid] ?? block.donor; blockLookup[block.uuid] = block; donor.samples.push(block); delete donor.uuid; delete block.donor; delete block.uuid; } const sectionLookup = {}; for (const section of sections) { for (const uuid of section.__ancestors) { if (blockLookup[uuid]) { blockLookup[uuid].sections.push(section); sectionLookup[section.uuid] = section; } } delete section.__ancestors; delete section.uuid; } for (const block of blocks) { updateBlockDescription(block); } for (const dataset of datasets) { for (const uuid of dataset.__ancestors) { if (sectionLookup[uuid]) { sectionLookup[uuid].datasets.push(dataset); } if (blockLookup[uuid]) { blockLookup[uuid].datasets.push(dataset); } } delete dataset.__ancestors; delete dataset.uuid; } return { "@context": "https://hubmapconsortium.github.io/ccf-ontology/ccf-context.jsonld", "@graph": Object.values(donors) }; } // src/library/ds-graph/operations/hubmap.js var HUBMAP_SEARCH_API_ENDPOINT = "https://search.api.hubmapconsortium.org/v3/entities/search"; async function hubmapRegistrations(token = void 0) { return await getDatasetGraph(HUBMAP_SEARCH_API_ENDPOINT, token); } // src/library/ds-graph/operations/sennet.js var SENNET_SEARCH_API_ENDPOINT = "https://search.api.sennetconsortium.org/entities/search"; async function sennetRegistrations(token = void 0) { return await getDatasetGraph(SENNET_SEARCH_API_ENDPOINT, token); } export { atlasD2kRegistrations, gtexRegistrations, hubmapRegistrations, sennetRegistrations };