Socket
Socket
Sign inDemoInstall

vsm-dictionary-uniprot

Package Overview
Dependencies
3
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.14 to 1.0.15

src/DictionaryUniProt.js

2

.eslintrc.js

@@ -9,3 +9,3 @@ module.exports = {

globals: {
VsmDictionaryUniprot: true,
VsmDictionaryUniProt: true,
},

@@ -12,0 +12,0 @@ parserOptions: {

{
"name": "vsm-dictionary-uniprot",
"version": "1.0.14",
"description": "Implementation of a VSM-dictionary that interfaces with the Uniprot REST API",
"main": "src/DictionaryUniprot.js",
"version": "1.0.15",
"description": "Implementation of a VSM-dictionary that interfaces with the UniProt REST API",
"main": "src/DictionaryUniProt.js",
"scripts": {

@@ -28,26 +28,26 @@ "lint": "eslint src test",

"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"clean-webpack-plugin": "^1.0.1",
"codecov": "^3.7.0",
"copy-webpack-plugin": "^5.1.1",
"codecov": "^3.7.2",
"copy-webpack-plugin": "^5.1.2",
"eslint": "^5.13.0",
"html-webpack-plugin": "^3.2.0",
"js-yaml": "^3.14.0",
"lodash": "^4.17.15",
"lodash": "^4.17.20",
"mocha": "^7.2.0",
"nock": "^9.6.1",
"nyc": "^15.1.0",
"terser-webpack-plugin": "^2.3.7",
"terser-webpack-plugin": "^2.3.8",
"text-transform-loader": "^2.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"vsm-dictionary": "^2.6.5",
"vsm-dictionary": "^2.6.6",
"xmlhttprequest": "^1.8.0"
}
}

@@ -15,3 +15,3 @@ # vsm-dictionary-uniprot

of the 'VsmDictionary' parent-class/interface (from the package
[`vsm-dictionary`](https://github.com/vsmjs/vsm-dictionary)), that
[`vsm-dictionary`](https://github.com/vsm/vsm-dictionary)), that
communicates with [UniProt's](https://www.uniprot.org)

@@ -26,7 +26,8 @@ REST API and translates the provided protein data into a VSM-specific format.

Create a `test.js` file and include this code:
Create a directory `test-dir` and inside run `npm install vsm-dictionary-uniprot`.
Then, create a `test.js` file and include this code:
```javascript
const DictionaryUniprot = require('./DictionaryUniprot');
const dict = new DictionaryUniprot({log: true});
const DictionaryUniProt = require('vsm-dictionary-uniprot');
const dict = new DictionaryUniProt({log: true});

@@ -44,6 +45,13 @@ dict.getEntryMatchesForString('tp53', { page: 1, perPage: 10 },

### Browsers
```html
<script src="https://unpkg.com/vsm-dictionary-uniprot@^1.0.0/dist/vsm-dictionary-uniprot.min.js"></script>
```
after which it is accessible as the global variable `VsmDictionaryUniProt`.
## Tests
Run `npm test`, which runs the source code tests with Mocha.
If you want to quickly live test the Uniprot API, go to the
If you want to quickly live test the UniProt API, go to the
`test` directory and run:

@@ -73,5 +81,5 @@ ```

the parent class
[specification](https://github.com/vsmjs/vsm-dictionary/blob/master/Dictionary.spec.md).
[specification](https://github.com/vsm/vsm-dictionary/blob/master/Dictionary.spec.md).
In the next sections we will explain the mapping between the data
offered by Uniprot's API and the corresponding VSM objects. Useful
offered by UniProt's API and the corresponding VSM objects. Useful
links for the API are:

@@ -84,3 +92,3 @@ - https://www.uniprot.org/help/query-fields

Note also that we implement **strict error handling** in the sense that whenever
we launch multiple parallel queries to Uniprot's REST API (see the functions
we launch multiple parallel queries to UniProt's REST API (see the functions
specifications below), if one of them returns an error (either a string or an

@@ -100,3 +108,3 @@ error JSON object response), then the result will be an error object (no matter

### Map Uniprot to DictInfo VSM object
### Map UniProt to DictInfo VSM object

@@ -116,3 +124,3 @@ This specification relates to the function:

### Map Uniprot to Entry VSM object
### Map UniProt to Entry VSM object

@@ -151,3 +159,3 @@ This specification relates to the function:

At July 2019, Uniprot offered the results from its REST API in various formats
At July 2019, UniProt offered the results from its REST API in various formats
but not JSON :( We chose thus the tab-separated format as shown in the above

@@ -157,5 +165,5 @@ queries (`&format=tab`). The returned tab-separated lines are mapped to VSM

Uniprot column | Type | Required | VSM entry/match object property | Notes
UniProt column | Type | Required | VSM entry/match object property | Notes
:---:|:---:|:---:|:---:|:---:
`Entry` | String | YES | `id` | the full URL of the Uniprot ID
`Entry` | String | YES | `id` | the full URL of the UniProt ID
`FUNCTION [CC]` | String | NO | `descr` | The protein's function

@@ -166,3 +174,3 @@ `Protein names` | String | NO? | `str`,`terms[i].str` | Recommended and alternative names for the protein

`Status` | String | NO | `z.status` | Is the protein information *reviewed*, *unreviewed*, *deleted* (obsolete), etc.
`Entry name` | String | YES | `z.entry` | A Uniprot-specific ID for the entry, e.g. `VPS73_YEAST`
`Entry name` | String | YES | `z.entry` | A UniProt-specific ID for the entry, e.g. `VPS73_YEAST`
`Annotation` | String | NO | `z.score` | Annotation score, a quality index for the protein information (e.g. '4 out of 5')

@@ -172,11 +180,11 @@

reasonable. There is though a global option `optimap` that you can pass to the
`DictionaryUniprot` object, which optimizes the above mapping for curator clarity
`DictionaryUniProt` object, which optimizes the above mapping for curator clarity
and use. The **default value is true** and what changes in the mapping table
above (which is the mapping for `optimap: false` actually) is that the VSM's `str`
entry/match object property takes the value of the `Entry name`. The reason behind
this is that the `Entry name` is always different for every returned result (Uniprot's
this is that the `Entry name` is always different for every returned result (UniProt's
internal id) and thus distinguishable, whereas in the original mapping the first
protein name (which was used as `str`) is not.
### Map Uniprot to Match VSM object
### Map UniProt to Match VSM object

@@ -190,3 +198,3 @@ This specification relates to the function:

Otherwise, an example of a URL string that is being built and send to Uniprot's
Otherwise, an example of a URL string that is being built and send to UniProt's
REST API when requesting for `tp53`, is:

@@ -199,11 +207,11 @@ ```

well as the mapping shown in the table above. Queries requesting for string
matches **always** return results sorted based on an internal, Uniprot-specific
matches **always** return results sorted based on an internal, UniProt-specific
score value (note the `sort=score` in the URL). This practically ensures that
the most requested and best-quality results will be the ones returned first and
they are the same as what you would expect when searching a term in the the main
search box of the Uniprot website: `https://www.uniprot.org/uniprot/?query=tp53&sort=score`.
search box of the UniProt website: `https://www.uniprot.org/uniprot/?query=tp53&sort=score`.
For the `limit` and `offset` parameters the same things apply as in
the `getEntries` specification. No sorting whatsoever is done on the client
after the results are returned from Uniprot's REST API.
after the results are returned from UniProt's REST API.

@@ -210,0 +218,0 @@ ## License

@@ -1,2 +0,2 @@

const DictionaryUniprot = require('./DictionaryUniprot');
const DictionaryUniProt = require('./DictionaryUniProt');
const chai = require('chai'); chai.should();

@@ -8,9 +8,9 @@ const expect = chai.expect;

describe('DictionaryUniprot.js', () => {
describe('DictionaryUniProt.js', () => {
const testURLBase = 'http://test';
const dict =
new DictionaryUniprot({ baseURL: testURLBase, log: true, optimap: false });
new DictionaryUniProt({ baseURL: testURLBase, log: true, optimap: false });
const dictOptimized =
new DictionaryUniprot({ baseURL: testURLBase, log: true }); // optimap: true
new DictionaryUniProt({ baseURL: testURLBase, log: true }); // optimap: true

@@ -140,3 +140,3 @@ const melanomaStr = 'melanoma';

describe('buildEntryURLs', () => {
it('returns proper array of URLs to send to Uniprot REST API', cb => {
it('returns proper array of URLs to send to UniProt REST API', cb => {
const options1 = {};

@@ -195,6 +195,6 @@ const options2 = { filter: {}, sort: 'str' };

describe('mapUniprotResToEntryObj', () => {
it('properly maps Uniprot\'s tab-seperated lines to VSM entry '
describe('mapUniProtResToEntryObj', () => {
it('properly maps UniProt\'s tab-seperated lines to VSM entry '
+ 'objects', cb => {
dict.mapUniprotResToEntryObj(getIDsStr).should.deep.equal(
dict.mapUniProtResToEntryObj(getIDsStr).should.deep.equal(
[{

@@ -246,3 +246,3 @@ id: 'https://www.uniprot.org/uniprot/P52413',

dictOptimized.mapUniprotResToEntryObj(getIDsStr).should.deep.equal(
dictOptimized.mapUniProtResToEntryObj(getIDsStr).should.deep.equal(
[{

@@ -304,6 +304,6 @@ id: 'https://www.uniprot.org/uniprot/P52413',

describe('mapUniprotResToMatchObj', () => {
it('properly maps Uniprot\'s tab-seperated lines to VSM match '
describe('mapUniProtResToMatchObj', () => {
it('properly maps UniProt\'s tab-seperated lines to VSM match '
+ 'objects', cb => {
dict.mapUniprotResToMatchObj(getMatchesForMelanomaStr, 'melanoma')
dict.mapUniProtResToMatchObj(getMatchesForMelanomaStr, 'melanoma')
.should.deep.equal([

@@ -383,3 +383,3 @@ {

dictOptimized.mapUniprotResToMatchObj(getMatchesForMelanomaStr, 'melanoma')
dictOptimized.mapUniProtResToMatchObj(getMatchesForMelanomaStr, 'melanoma')
.should.deep.equal([

@@ -476,3 +476,3 @@ {

const url5 = dict.prepareEntrySearchURL({ page: 1, perPage: 2 }, 'https://www.uniprot.org/uniprot/Q7T2N5');
const url6 = dict.prepareEntrySearchURL({}, 'notAUniprotID');
const url6 = dict.prepareEntrySearchURL({}, 'notAUniProtID');

@@ -490,3 +490,3 @@ const columnsURLPart = '&columns=id%2Ccomment%28FUNCTION%29%2Cprotein%20names%2Cgenes%2Corganism%2Creviewed%2Centry%20name%2Cannotation%20score';

+ '&format=tab';
const expectedURL6 = testURLBase + '/?query=id:notAUniprotID' + columnsURLPart
const expectedURL6 = testURLBase + '/?query=id:notAUniProtID' + columnsURLPart
+ '&format=tab';

@@ -493,0 +493,0 @@

/**
* File used to quick test the `getEntries` function of
* `DictionaryUniprot.js`
* `DictionaryUniProt.js`
*/
const DictionaryUniprot = require('../src/DictionaryUniprot');
const DictionaryUniProt = require('../src/DictionaryUniProt');
const dict = new DictionaryUniprot({log: true});
const dict = new DictionaryUniProt({log: true});

@@ -10,0 +10,0 @@ dict.getEntries({

/**
* File used to quick test the `getEntryMatchesForString` function of
* `DictionaryUniprot.js`
* `DictionaryUniProt.js`
*/
const DictionaryUniprot = require('../src/DictionaryUniprot');
const DictionaryUniProt = require('../src/DictionaryUniProt');
const dict = new DictionaryUniprot({log: true});
const dict = new DictionaryUniProt({log: true});

@@ -10,0 +10,0 @@ dict.getEntryMatchesForString('tp53', { page: 1, perPage: 20 },

/*
This Webpack-config builds a version of VsmDictionaryUniprot that can be
This Webpack-config builds a version of VsmDictionaryUniProt that can be
loaded in browsers, where it can be accessed as a global variable.

@@ -16,7 +16,7 @@ */

module.exports = (env = {}) => ({
module.exports = () => ({
mode: 'production',
entry: src + '/DictionaryUniprot.js',
entry: src + '/DictionaryUniProt.js',

@@ -58,5 +58,5 @@ devtool: addSourceMap ? 'hidden-source-map' : false,

filename: 'vsm-dictionary-uniprot.min.js',
library: 'VsmDictionaryUniprot',
library: 'VsmDictionaryUniProt',
libraryTarget: 'var'
}
});

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc