curtain-web-api 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,8 +19,8 @@ export declare class CurtainWebAPI {
19
19
  ORCIDLogin(authorizationCode: string, redirectURI: string): Promise<User>;
20
20
  checkIfRefreshTokenExpired(): boolean;
21
21
  deleteCurtainLink(curtainLinkID: string): Promise<import("axios").AxiosResponse<any, any>>;
22
- putSettings(settings: any, enable?: boolean, description?: string, sessionType?: string): Promise<import("axios").AxiosResponse<any, any>>;
23
- postSettings(id: string, token: string): Promise<import("axios").AxiosResponse<any, any>>;
22
+ putSettings(settings: any, enable?: boolean, description?: string, sessionType?: string, onUploadProgress?: any): Promise<import("axios").AxiosResponse<any, any>>;
23
+ postSettings(id: string, token: string, onDownloadProgress?: any): Promise<import("axios").AxiosResponse<any, any>>;
24
24
  getPrideData(accession: string): Promise<import("axios").AxiosResponse<any, any>>;
25
25
  generateTemporarySession(linkId: string, lifetime: number): Promise<import("axios").AxiosResponse<any, any>>;
26
26
  updateSession(sessionData: any, linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
@@ -30,10 +30,11 @@ export declare class CurtainWebAPI {
30
30
  addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any>>;
31
31
  getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any>>;
32
32
  getSiteProperties(): Promise<import("axios").AxiosResponse<any, any>>;
33
- saveDataFilterList(name: string, data: string): Promise<import("axios").AxiosResponse<any, any>>;
33
+ saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any>>;
34
34
  getDataFilterListByID(id: number): Promise<import("axios").AxiosResponse<any, any>>;
35
- getDataFilterList(categoryName?: string, searchTerm?: string, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
35
+ getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
36
36
  deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any>>;
37
37
  downloadStats(): Promise<import("axios").AxiosResponse<any, any>>;
38
- postInteractomeAtlasProxy(data: any): Promise<import("axios").AxiosResponse<any, any>>;
38
+ postInteractomeAtlasProxy(genes: string[], filterParameter: string): Promise<import("axios").AxiosResponse<any, any>>;
39
+ postPrimitiveStatsTest(data: any, type?: string): Promise<import("axios").AxiosResponse<any, any>>;
39
40
  }
@@ -204,7 +204,7 @@ class CurtainWebAPI {
204
204
  return response;
205
205
  });
206
206
  }
207
- putSettings(settings, enable = true, description = "", sessionType = "TP") {
207
+ putSettings(settings, enable = true, description = "", sessionType = "TP", onUploadProgress = undefined) {
208
208
  let form = new FormData();
209
209
  form.append("file", new Blob([JSON.stringify(settings, exports.replacer)], { type: 'text/json' }), "curtain-settings.json");
210
210
  if (enable) {
@@ -218,13 +218,23 @@ class CurtainWebAPI {
218
218
  let headers = new axios_1.AxiosHeaders();
219
219
  headers["Accept"] = "application/json";
220
220
  headers["Content-Type"] = "multipart/form-data";
221
+ if (onUploadProgress !== undefined) {
222
+ return this.axiosInstance.post(this.baseURL + "curtain/", form, { headers: headers, responseType: "json", onUploadProgress: onUploadProgress }).then((response) => {
223
+ return response;
224
+ });
225
+ }
221
226
  return this.axiosInstance.post(this.baseURL + "curtain/", form, { headers: headers, responseType: "json" }).then((response) => {
222
227
  return response;
223
228
  });
224
229
  }
225
- postSettings(id, token) {
230
+ postSettings(id, token, onDownloadProgress = undefined) {
226
231
  let headers = new axios_1.AxiosHeaders();
227
232
  headers["Accept"] = "application/json";
233
+ if (onDownloadProgress !== undefined) {
234
+ return this.axiosInstance.get(this.baseURL + "curtain/" + id + "/download/token=" + token + "/", { responseType: "json", onDownloadProgress: onDownloadProgress }).then((response) => {
235
+ return response;
236
+ });
237
+ }
228
238
  return this.axiosInstance.get(this.baseURL + "curtain/" + id + "/download/token=" + token + "/", { responseType: "json" }).then((response) => {
229
239
  return response;
230
240
  });
@@ -316,11 +326,11 @@ class CurtainWebAPI {
316
326
  return response;
317
327
  });
318
328
  }
319
- saveDataFilterList(name, data) {
329
+ saveDataFilterList(name, data, category = "") {
320
330
  let headers = new axios_1.AxiosHeaders();
321
331
  headers["Accept"] = "application/json";
322
332
  headers["Content-Type"] = "application/json";
323
- return this.axiosInstance.post(this.baseURL + "data_filter_list/", { name: name, data: data }, { headers: headers, responseType: "json" }).then((response) => {
333
+ return this.axiosInstance.post(this.baseURL + "data_filter_list/", { name: name, data: data, category: category }, { headers: headers, responseType: "json" }).then((response) => {
324
334
  return response;
325
335
  });
326
336
  }
@@ -331,14 +341,17 @@ class CurtainWebAPI {
331
341
  return response;
332
342
  });
333
343
  }
334
- getDataFilterList(categoryName = "", searchTerm = "", limit = 99999999) {
344
+ getDataFilterList(title = "", searchTerm = "", category = "", limit = 99999999) {
335
345
  let params = new URLSearchParams();
336
- if (categoryName != "") {
337
- params.append("name", categoryName);
346
+ if (title != "") {
347
+ params.append("name", title);
338
348
  }
339
349
  if (searchTerm != "" && searchTerm != undefined) {
340
350
  params.append("data", searchTerm);
341
351
  }
352
+ if (category != "" && category != undefined) {
353
+ params.append("category", category);
354
+ }
342
355
  params.append("limit", limit.toString());
343
356
  return this.axiosInstance.get(this.baseURL + "data_filter_list/", { responseType: "json", params });
344
357
  }
@@ -356,11 +369,29 @@ class CurtainWebAPI {
356
369
  return response;
357
370
  });
358
371
  }
359
- postInteractomeAtlasProxy(data) {
372
+ postInteractomeAtlasProxy(genes, filterParameter) {
373
+ let params = new URLSearchParams();
374
+ params.append("query_interactors", "query");
375
+ params.append("query_id_array", genes.join("%2C"));
376
+ params.append("search_term_parameter", genes.join("%2C"));
377
+ params.append("filter_parameter", filterParameter);
378
+ let searchTermArray = [];
379
+ for (const g of genes) {
380
+ searchTermArray.push("search_term_array%5B%5D=" + g);
381
+ }
382
+ const data = "http://www.interactome-atlas.org/search_results_interactions?" + params.toString() + "&" + searchTermArray.join("&");
383
+ let headers = new axios_1.AxiosHeaders();
384
+ headers["Accept"] = "application/json";
385
+ headers["Content-Type"] = "application/json";
386
+ return axios_1.default.post(this.baseURL + "interactome-atlas-proxy/", { link: data }, { headers: headers, responseType: "json" }).then((response) => {
387
+ return response;
388
+ });
389
+ }
390
+ postPrimitiveStatsTest(data, type = "t-test") {
360
391
  let headers = new axios_1.AxiosHeaders();
361
392
  headers["Accept"] = "application/json";
362
393
  headers["Content-Type"] = "application/json";
363
- return axios_1.default.post(this.baseURL + "interactome-atlas-proxy/", data, { headers: headers, responseType: "json" }).then((response) => {
394
+ return axios_1.default.post(this.baseURL + "primitive-stats-test/", { data, type }, { headers: headers, responseType: "json" }).then((response) => {
364
395
  return response;
365
396
  });
366
397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -192,7 +192,7 @@ export class CurtainWebAPI {
192
192
  }
193
193
 
194
194
 
195
- putSettings(settings: any, enable: boolean = true, description: string = "", sessionType: string = "TP") {
195
+ putSettings(settings: any, enable: boolean = true, description: string = "", sessionType: string = "TP", onUploadProgress: any = undefined) {
196
196
  let form: FormData = new FormData();
197
197
  form.append("file", new Blob([JSON.stringify(settings, replacer)], {type: 'text/json'}), "curtain-settings.json")
198
198
  if (enable) {
@@ -205,14 +205,24 @@ export class CurtainWebAPI {
205
205
  let headers = new AxiosHeaders();
206
206
  headers["Accept"] = "application/json";
207
207
  headers["Content-Type"] = "multipart/form-data";
208
+ if (onUploadProgress !== undefined) {
209
+ return this.axiosInstance.post(this.baseURL + "curtain/", form, {headers: headers, responseType:"json", onUploadProgress: onUploadProgress}).then((response) => {
210
+ return response;
211
+ });
212
+ }
208
213
  return this.axiosInstance.post(this.baseURL + "curtain/", form, {headers: headers, responseType:"json"}).then((response) => {
209
214
  return response;
210
215
  });
211
216
  }
212
217
 
213
- postSettings(id: string, token: string) {
218
+ postSettings(id: string, token: string, onDownloadProgress: any = undefined) {
214
219
  let headers = new AxiosHeaders();
215
220
  headers["Accept"] = "application/json";
221
+ if (onDownloadProgress !== undefined) {
222
+ return this.axiosInstance.get(this.baseURL + "curtain/" + id + "/download/token=" + token + "/", {responseType:"json", onDownloadProgress: onDownloadProgress}).then((response) => {
223
+ return response;
224
+ })
225
+ }
216
226
  return this.axiosInstance.get(this.baseURL + "curtain/" + id + "/download/token=" + token + "/", {responseType:"json"}).then((response) => {
217
227
  return response;
218
228
  })
@@ -318,11 +328,11 @@ export class CurtainWebAPI {
318
328
  });
319
329
  }
320
330
 
321
- saveDataFilterList(name: string, data: string) {
331
+ saveDataFilterList(name: string, data: string, category: string = "") {
322
332
  let headers = new AxiosHeaders();
323
333
  headers["Accept"] = "application/json";
324
334
  headers["Content-Type"] = "application/json";
325
- return this.axiosInstance.post(this.baseURL + "data_filter_list/", {name: name, data: data}, {headers: headers, responseType:"json"}).then((response) => {
335
+ return this.axiosInstance.post(this.baseURL + "data_filter_list/", {name: name, data: data, category: category}, {headers: headers, responseType:"json"}).then((response) => {
326
336
  return response;
327
337
  });
328
338
  }
@@ -335,14 +345,17 @@ export class CurtainWebAPI {
335
345
  });
336
346
  }
337
347
 
338
- getDataFilterList(categoryName: string = "", searchTerm: string = "", limit: number = 99999999) {
348
+ getDataFilterList(title: string = "", searchTerm: string = "", category: string = "", limit: number = 99999999) {
339
349
  let params = new URLSearchParams();
340
- if (categoryName != "") {
341
- params.append("name", categoryName)
350
+ if (title != "") {
351
+ params.append("name", title)
342
352
  }
343
353
  if (searchTerm != "" && searchTerm != undefined) {
344
354
  params.append("data", searchTerm)
345
355
  }
356
+ if (category != "" && category != undefined) {
357
+ params.append("category", category)
358
+ }
346
359
 
347
360
  params.append("limit", limit.toString())
348
361
  return this.axiosInstance.get(this.baseURL + "data_filter_list/", {responseType:"json", params})
@@ -364,11 +377,30 @@ export class CurtainWebAPI {
364
377
  });
365
378
  }
366
379
 
367
- postInteractomeAtlasProxy(data: any) {
380
+ postInteractomeAtlasProxy(genes: string[], filterParameter: string) {
381
+ let params = new URLSearchParams();
382
+ params.append("query_interactors", "query");
383
+ params.append("query_id_array", genes.join("%2C"));
384
+ params.append("search_term_parameter", genes.join("%2C"));
385
+ params.append("filter_parameter", filterParameter);
386
+ let searchTermArray: string[] = []
387
+ for (const g of genes) {
388
+ searchTermArray.push("search_term_array%5B%5D="+g)
389
+ }
390
+ const data = "http://www.interactome-atlas.org/search_results_interactions?" + params.toString() + "&" + searchTermArray.join("&")
391
+ let headers = new AxiosHeaders();
392
+ headers["Accept"] = "application/json";
393
+ headers["Content-Type"] = "application/json";
394
+ return axios.post(this.baseURL + "interactome-atlas-proxy/", {link: data}, {headers: headers, responseType: "json"}).then((response) => {
395
+ return response;
396
+ });
397
+ }
398
+
399
+ postPrimitiveStatsTest(data: any, type: string = "t-test") {
368
400
  let headers = new AxiosHeaders();
369
401
  headers["Accept"] = "application/json";
370
402
  headers["Content-Type"] = "application/json";
371
- return axios.post(this.baseURL + "interactome-atlas-proxy/", data, {headers: headers, responseType: "json"}).then((response) => {
403
+ return axios.post(this.baseURL + "primitive-stats-test/", {data,type}, {headers: headers, responseType: "json"}).then((response) => {
372
404
  return response;
373
405
  });
374
406
  }