1 | bridgedb-6.0.0-2
|
2 | ===================
|
3 |
|
4 | JS client for the [BridgeDb](http://bridgedb.org) ID mapping framework [webservice](http://webservice.bridgedb.org/). If you want to use the version, see the `5x` branch.
|
5 |
|
6 | ~~##[API Documentation](https://bridgedb.github.io/bridgedbjs/docs/)~~
|
7 |
|
8 | ## Installation
|
9 |
|
10 | **Browser**
|
11 | ```html
|
12 | <script src="https://bridgedb.github.io/bridgedbjs/dist/bridgedb-5.0.13.min.js"></script>
|
13 | ```
|
14 |
|
15 | **Node.js**
|
16 | ```
|
17 | npm install --save bridgedb
|
18 | ```
|
19 |
|
20 | ## Simple Example
|
21 | ```js
|
22 | var BridgeDb = require('bridgedb').default; // Omit this line unless you're using Node.js
|
23 |
|
24 | var bridgeDbInstance = new BridgeDb();
|
25 | bridgeDbInstance.search('Mouse', 'Nfkb1')
|
26 | .subscribe(function(searchResult) {
|
27 | console.log('Result for Nfkb1');
|
28 | console.log(searchResult);
|
29 | });
|
30 | ```
|
31 |
|
32 | ## More Complex Example
|
33 | Use ES2015, options and error catching.
|
34 | ```js
|
35 | import BridgeDb from 'bridgedb';
|
36 |
|
37 | const bridgeDbInstance = new BridgeDb({
|
38 | baseIri: 'http://example.org/',
|
39 | dataSourcesHeadersIri: 'http://example.org/data-sources-headers.txt'
|
40 | dataSourcesMetadataIri 'http://example.org/data-sources.txt',
|
41 | });
|
42 | bridgeDbInstance.search('Mouse', 'Nfkb1')
|
43 | .subscribe(function(searchResult) {
|
44 | console.log('Result for Nfkb1');
|
45 | console.log(searchResult);
|
46 | }, function(err) {
|
47 | throw err;
|
48 | }, function() {
|
49 | console.log('complete');
|
50 | });
|
51 | ```
|
52 |
|
53 | The methods return [RxJS Observables](https://github.com/ReactiveX/rxjs), meaning can use `subscribe` as shown above to get the next values, catch errors and be notified when the observable is complete.
|
54 |
|
55 | For more examples, see the [test directory](https://github.com/bridgedb/bridgedbjs/tree/master/test).
|
56 |
|
57 | ## For Developers
|
58 |
|
59 | 1. Install [Node.js](https://nodejs.org/)
|
60 | 2. Fork this repo (if you don't have commit rights to it)
|
61 | 3. `git clone https://github.com/bridgedb/bridgedbjs.git` (or use your fork's URL)
|
62 | 4. `cd bridgedbjs`
|
63 | 5. `npm install`
|
64 | 6. Make sure the tests pass: [test documentation](./test/README.md).
|
65 | 7. Refactor the code. Add new tests for your changes if not already covered by the existing tests.
|
66 | 8. Make sure the tests all pass.
|
67 | 9. Send a pull request from your local repo to the master branch of this repo.
|
68 |
|
69 |
|
70 | ## Dependencies
|
71 |
|
72 | Each time this library is instantiated, it downloads the following files:
|
73 |
|
74 | * [datasources_headers.txt](https://github.com/bridgedb/BridgeDb/blob/master/org.bridgedb.bio/resources/org/bridgedb/bio/datasources_headers.txt)
|
75 | * [datasources.txt](https://github.com/bridgedb/BridgeDb/blob/master/org.bridgedb.bio/resources/org/bridgedb/bio/datasources.txt)
|
76 |
|
77 | These files are accessed via the [RawGit CDN](http://rawgit.com/). The desired version of the files to download is specified in `src/main.ts` as the commit hash of the latest release of `bridgedbjs`, e.g/, `24186142d05b5f811893970b9a5d61a06f241f68` to produce a URL like https://cdn.rawgit.com/bridgedb/BridgeDb/24186142d05b5f811893970b9a5d61a06f241f68/org.bridgedb.bio/resources/org/bridgedb/bio/datasources.txt
|
78 |
|
79 | ## TODOs
|
80 | * [ ] Set up mockserver so it "caches" the API response from an endpoint the first time it's called. Right now, we need to create new mocks for API endpoints manually. (I have the code for doing this already working somewhere.)
|
81 | * [ ] UI components
|
82 | * [ ] Use React without Redux.
|
83 | * [ ] Make it possible to use the UI components individually and in any combination.
|
84 | * [ ] Build tests. Current tests are not working.
|
85 | * [ ] Check handling of no results returned for `attributeSearch` for both the API client and the UI component.
|
86 | * [ ] Possibly require that inputs to `attributeSearch` be at least three characters in length.
|
87 |
|
88 | ## Troubleshooting
|
89 | `npm install` throws an error like `library not found for -lgcc_s.10.5`
|
90 | * This appears to be particular to certain Node and OS X versions and can be [fixed with a symlink](http://stackoverflow.com/questions/31936170/npm-the-ld-library-not-found-for-lgcc-s-10-5-on-on-os-x-el-capitain): >`cd /usr/local/lib` >`sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib`
|