@geneontology/go-exporter
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -25,5 +25,8 @@ const axios = require('axios'); | ||
async get(url) { | ||
/* console.log("url: ", url);*/ | ||
return await axios.get(url); | ||
} | ||
async post(url, payload) { | ||
return await axios.post(url, payload); | ||
} | ||
@@ -37,6 +40,18 @@ /** | ||
createPayload(url) { | ||
let params = url.substring(url.indexOf("?") + 1); | ||
let json = { }; | ||
let array = params.split("&"); | ||
for(let param of array) { | ||
let split = param.split("="); | ||
json[split[0]] = split[1].trim(); | ||
} | ||
return json; | ||
} | ||
async getAnnotations(ids) { | ||
let url = this.golrBaseUrl + this.service + this.params + this.docAnnotations + this.docAnnotationsFilter + "&fq=bioentity:(\"" + ids.join("\" \"") + "\")"; | ||
let payload = this.createPayload(url); | ||
return this.get(url) | ||
return this.post(url, payload) | ||
.then(response => { | ||
@@ -52,4 +67,5 @@ return response.data.response.docs; | ||
let url = this.golrBaseUrl + this.service + this.params + this.docBioentities + this.docBioentitiesFilter + "&fq=bioentity:(\"" + ids.join("\" \"") + "\")"; | ||
let payload = this.createPayload(url); | ||
return this.get(url) | ||
return this.post(url, payload) | ||
.then(response => { | ||
@@ -173,7 +189,7 @@ return response.data.response.docs; | ||
let gaf = goe.toGAF(docs); | ||
console.log("GAF file:\n", gaf); | ||
console.log("GAF file:\n" + gaf); | ||
let docs2 = await goe.getBioentities(ids); | ||
let gpi = goe.toGPI(docs2); | ||
console.log("GPI file:\n", gpi); | ||
console.log("GPI file:\n" + gpi); | ||
@@ -180,0 +196,0 @@ } |
{ | ||
"name": "@geneontology/go-exporter", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Export GO annotations from a GOLr instance to GPAD/GPI/GAF files", | ||
@@ -5,0 +5,0 @@ "main": "go-exporter.js", |
Sorry, the diff of this file is not supported yet
153
68937