From d6014a65752afca8f4bec63273173103623b769e Mon Sep 17 00:00:00 2001 From: Jackson Callaghan <43009413+tokebe@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:21:55 -0400 Subject: [PATCH] Revert "semmed sentence edge attributes" --- data/jq/pair/semmed.jq | 23 ----------------------- data/jq/wrap/semmed.jq | 29 ----------------------------- src/index.ts | 2 -- 3 files changed, 54 deletions(-) delete mode 100644 data/jq/pair/semmed.jq delete mode 100644 data/jq/wrap/semmed.jq diff --git a/data/jq/pair/semmed.jq b/data/jq/pair/semmed.jq deleted file mode 100644 index 1b61745..0000000 --- a/data/jq/pair/semmed.jq +++ /dev/null @@ -1,23 +0,0 @@ -if $edge.query.method == "post" then - # if response is not an array, then use response.hits - if (.response | type) == "array" then .response else .response.hits end | - reduce .[] as $item ({}; - # if the item is notfound, then proceed to next item & keep current object - if ($item | keys | contains(["notfound"])) then - . - else - generateCurieWithInputs( - $edge.input.id; - $item.query; - $edge.input.curies - | toArray - | map(. | split(":") | last) - ) as $curie | .[$curie] += [$item] - end - ) -else - .response as $res | generateCurie( - $edge.input.id; - ($edge.input.curies | toArray | map(. | split(":") | last) | first) - ) as $curie | {} | .[$curie] = [$res] -end diff --git a/data/jq/wrap/semmed.jq b/data/jq/wrap/semmed.jq deleted file mode 100644 index 8ee6b68..0000000 --- a/data/jq/wrap/semmed.jq +++ /dev/null @@ -1,29 +0,0 @@ -# finds start/end index of sub in main string -# ie. "ab" in "12abcd" will return "2|3" -def index_text(main; sub): (main|index(sub)|tostring)+"|"+((main|index(sub)) + (sub|length) | tostring); - - -.["edge-attributes"] = ([.predication | group_by(.pmid) | .[] | .[0] | -# create edge attributes for each publication -{ - "attribute_type_id": "biolink:has_supporting_study_result", - "attributes": [ - { - "attribute_type_id": "biolink:supporting_text", - "value": .sentence, - }, - { - "attribute_type_id": "biolink:publications", - "value": ( "PMID:"+(.pmid|tostring) ), - }, - { - "attribute_type_id": "biolink:subject_location_in_text", - "value": ( .subject_text as $text | index_text(.sentence; $text) ), - }, - { - "attribute_type_id": "biolink:object_location_in_text", - "value": ( .object_text as $text | index_text(.sentence; $text) ), - } - ], - "value": ( .predication_id | tostring ), -}] | .[:50]) diff --git a/src/index.ts b/src/index.ts index cde90e7..68b99fd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -50,8 +50,6 @@ export default class Transformer { } else if (api === "EBI Proteins API") { // this.tf = new EBIProteinTransformer(this.data, this.config) this.tf = new JQTransformer(this.data, { ...this.config, type: "ebi" }); - } else if (api === "BioThings SEMMEDDB API") { - this.tf = new JQTransformer(this.data, { ...this.config, type: "semmed" }); } else if (tags.includes("biothings")) { this.tf = new JQTransformer(this.data, { ...this.config, type: "biothings" }); } else if (tags.includes("ctd")) {