Skip to content

Commit

Permalink
add string/:ac protion route;; modify and re-run build.js
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyao committed Sep 30, 2022
1 parent 30b20f4 commit 5f6fbc6
Show file tree
Hide file tree
Showing 1,321 changed files with 461,312 additions and 316,565 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#public/images/datasets/**svg
public/images/scatter/**svg
public/images/datasets/*svg
public/images/scatter/*svg

# Created by .gitignore support plugin (hsz.mobi)
### Emacs template
Expand Down
28 changes: 22 additions & 6 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const PAYLOAD_VERSION = 22;
const uniprotMappingFile = './data/paxdb_uniprot_linkins_ids.tsv';
const PAXDB_URL = 'https://pax-db.org/';
const PAXDB_API_URL = 'https://beta-api.pax-db.org/';
const PAXDB_API_URL = 'https://api.pax-db.org/';
const fs = require('fs');
const async = require('async');
const pg = require('pg');
Expand Down Expand Up @@ -75,6 +75,7 @@ function loadProteins(cb, createProteinModules = false) {
const paxdbUniprotIdsMap = loadUniprotMapping();
const uniprotPaxdbIdsMap = {};
const speciesForProtein = {};
const externalToInternalMap = {};

async.eachSeries(speciesIds, function (speciesId, callback) {
console.log(`loading proteins for ${speciesId}`);
Expand All @@ -93,6 +94,7 @@ function loadProteins(cb, createProteinModules = false) {
if (Object.prototype.hasOwnProperty.call(paxdbUniprotIdsMap, r.protein_external_id)) {
const ac = paxdbUniprotIdsMap[r.protein_external_id];
proteins[r.protein_id].uniprotId = ac;
externalToInternalMap[r.protein_external_id] = r.protein_id
if (!Object.prototype.hasOwnProperty.call(uniprotPaxdbIdsMap, ac)) {
uniprotPaxdbIdsMap[ac] = r.protein_id;
} else {
Expand Down Expand Up @@ -121,7 +123,7 @@ function loadProteins(cb, createProteinModules = false) {
}, function (err) {
console.log(`loading proteins DONE`);
if (err) throw err;
cb(speciesForProtein, uniprotPaxdbIdsMap);
cb(speciesForProtein, uniprotPaxdbIdsMap, externalToInternalMap);
});
}

Expand Down Expand Up @@ -305,7 +307,7 @@ function buildSpecies() {
}

function buildProteins() {
loadProteins(function(speciesForProtein, uniprotIdsMap) {
loadProteins(function(speciesForProtein, uniprotIdsMap, externalToInternalMap) {
var writeStream = fs.createWriteStream('./lib/proteins_index.js');
writeStream.write(`//FILE GENERATED BY build.js on ${new Date()}, DO NOT MODIFY!\n`);
writeStream.write("const speciesForProtein = ");
Expand All @@ -319,6 +321,16 @@ function buildProteins() {
writeStream.write('module.exports.uniprotIdsMap = uniprotIdsMap;\n');
writeStream.end();
console.log('./lib/proteins_index.js generated');

var writeStream = fs.createWriteStream('./lib/proteins_stringId_map.js');
writeStream.write(`//FILE GENERATED BY build.js on ${new Date()}, DO NOT MODIFY!\n`);
writeStream.write("const externalToInternalMap = ");
writeStream.write(JSON.stringify(externalToInternalMap));
writeStream.write(';\n');
writeStream.write('module.exports.externalToInternalMap = externalToInternalMap;\n');
writeStream.end();

console.log('./lib/proteins_stringId_map.js generated');
client.on('drain', client.end.bind(client));
client.end();
}, true);
Expand Down Expand Up @@ -441,6 +453,9 @@ function build_proteins_index(){
writeStream.write("const uniprotIdsMap = ");
writeStream.write(JSON.stringify(uniprotIdsMap));
writeStream.write(';\n');
writeStream.write("const externalToInternalMap = ");
writeStream.write(JSON.stringify(externalToInternalMap));
writeStream.write(';\n');
writeStream.write('module.exports.speciesForProtein = speciesForProtein;');
writeStream.write('module.exports.uniprotIdsMap = uniprotIdsMap;');
writeStream.end();
Expand Down Expand Up @@ -480,6 +495,9 @@ function buildHistograms() {
});
});
console.log('histograms generated');

client.on('drain', client.end.bind(client));
client.end();
}


Expand Down Expand Up @@ -530,8 +548,6 @@ function buildPayload() {
buildSpecies();
buildDatasets();
buildProteins();
//TODO FIXME writing streams is async, so lib/species.js won' show up before buildPayload is called
// TODO FIXME writing streams is async, so lib/species.js won' show up before buildPayload is called
buildPayload();
buildHistograms();


2 changes: 1 addition & 1 deletion lib/proteins/10090.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/10116.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/1148.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/122586.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/169963.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/192222.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/198214.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/208964.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/211586.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/214092.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/214684.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/224308.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/226186.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/243159.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/260799.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/272623.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/272624.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/283166.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/3055.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/353153.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/3702.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/39947.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/4081.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/44689.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/449447.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/4577.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/4896.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/4932.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/5061.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/511145.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/546414.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/5691.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/5833.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/593117.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/6239.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/proteins/64091.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5f6fbc6

Please sign in to comment.