New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@geneontology/dbxrefs

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@geneontology/dbxrefs - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

32

go-dbxrefs.js
const axios = require('axios');
const yaml = require('js-yaml');
let URL = "https://raw.githubusercontent.com/geneontology/go-site/09eb2dbdc4c71565528a2802d0591ba6b8f45fcc/metadata/db-xrefs.yaml"
// let URL = "https://raw.githubusercontent.com/geneontology/go-site/09eb2dbdc4c71565528a2802d0591ba6b8f45fcc/metadata/db-xrefs.yaml"
let URL = "http://current.geneontology.org/metadata/db-xrefs.yaml";

@@ -19,9 +20,5 @@ let dbxrefs;

function getURL(database, entityType, id) {
if(database == "FlyBase") database = "FB"; // This is required as for instance the GO API Autocomplete / search return ids like FlyBase:FBgn0032821
let db = dbxrefs.filter(elt => (elt.database.toLowerCase() == database.toLowerCase()) || (elt.synonyms && elt.synonyms.includes(database)) );
if(!db || db.length == 0) { console.log("database " , database , " not found"); return undefined; }
if(database == "WormBase") database = "WB"; // This is required as for instance the GO API Autocomplete / search return ids like WormBase:WBGene00000409
let db = dbxrefs.filter(elt => elt.database.toLowerCase() == database.toLowerCase());
if(!db) { console.log("database " , database , " not found"); return undefined; }
let entity;

@@ -35,4 +32,5 @@ if(entityType) {

let url = entity[0].url_syntax.replace("[example_id]", "");
return url + id;
entity = entity[0];
let url = entity.url_syntax.replace("[example_id]", id);
return url;
}

@@ -59,2 +57,3 @@

dbError = false;
return dbxrefs;
})

@@ -65,4 +64,4 @@ .catch(error => {

dbError = true;
return undefined
})
return dbxrefs;
}

@@ -73,2 +72,13 @@

init, getURL, isReady, hasError, getDBXrefs
}
}
// For testing
// init()
// .then(() => {
// // console.log(getURL("GO_REF", undefined, "0000037"));
// // console.log(getURL("PAINT_REF", undefined, "24356"));
// // console.log(getURL("FlyBase", undefined, "FBgn0032821"))
// // console.log(getURL("WormBase", undefined, "WBGene00000409"));
// console.log(getURL("NCBITaxon", undefined, "6239"));
// })
{
"name": "@geneontology/dbxrefs",
"version": "1.0.9",
"version": "1.0.10",
"description": "basic library to resolve link outs from database name and ID",

@@ -5,0 +5,0 @@ "main": "go-dbxrefs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc