grnsight 6.0.7 → 7.2.0
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.
- package/.eslintrc.yml +4 -4
- package/.github/workflows/node.js.yml +35 -0
- package/README.md +1 -1
- package/database/README.md +218 -97
- package/database/constants.py +42 -0
- package/database/filter_update.py +168 -0
- package/database/grnsettings-database/README.md +52 -0
- package/database/grnsettings-database/schema.sql +4 -0
- package/database/loader.py +30 -0
- package/database/loader_update.py +36 -0
- package/database/network-database/scripts/generate_network.py +15 -23
- package/database/network-database/scripts/generate_new_network_version.py +17 -24
- package/database/protein-protein-database/README.md +71 -0
- package/database/protein-protein-database/schema.sql +37 -0
- package/database/protein-protein-database/scripts/generate_protein_network.py +227 -0
- package/database/protein-protein-database/scripts/remove_duplicates.sh +4 -0
- package/database/utils.py +418 -0
- package/package.json +3 -2
- package/server/app.js +2 -0
- package/server/config/config.js +4 -4
- package/server/controllers/additional-sheet-parser.js +2 -1
- package/server/controllers/constants.js +5 -0
- package/server/controllers/custom-workbook-controller.js +4 -3
- package/server/controllers/demo-workbooks.js +1462 -6
- package/server/controllers/export-constants.js +3 -2
- package/server/controllers/exporters/sif.js +6 -1
- package/server/controllers/exporters/xlsx.js +8 -3
- package/server/controllers/expression-sheet-parser.js +0 -6
- package/server/controllers/grnsettings-database-controller.js +17 -0
- package/server/controllers/importers/sif.js +30 -11
- package/server/controllers/network-database-controller.js +2 -2
- package/server/controllers/network-sheet-parser.js +54 -12
- package/server/controllers/protein-database-controller.js +18 -0
- package/server/controllers/sif-constants.js +11 -4
- package/server/controllers/spreadsheet-controller.js +44 -1
- package/server/controllers/workbook-constants.js +21 -4
- package/server/dals/expression-dal.js +4 -4
- package/server/dals/grnsetting-dal.js +49 -0
- package/server/dals/network-dal.js +14 -15
- package/server/dals/protein-dal.js +106 -0
- package/test/additional-sheet-parser-tests.js +1 -1
- package/test/export-tests.js +136 -9
- package/test/import-sif-tests.js +67 -13
- package/test/test.js +1 -1
- package/test-files/additional-sheet-test-files/optimization-parameters-default.xlsx +0 -0
- package/test-files/demo-files/18_proteins_81_edges_PPI.xlsx +0 -0
- package/test-files/expression-data-test-sheets/expression_sheet_missing_data_ok_export_exact.xlsx +0 -0
- package/web-client/config/config.js +4 -4
- package/web-client/public/js/api/grnsight-api.js +18 -3
- package/web-client/public/js/constants.js +27 -12
- package/web-client/public/js/generateNetwork.js +170 -72
- package/web-client/public/js/graph.js +424 -161
- package/web-client/public/js/grnsight.js +25 -4
- package/web-client/public/js/grnstate.js +4 -1
- package/web-client/public/js/iframe-coordination.js +3 -3
- package/web-client/public/js/setup-handlers.js +76 -61
- package/web-client/public/js/setup-load-and-import-handlers.js +32 -7
- package/web-client/public/js/update-app.js +119 -28
- package/web-client/public/js/upload.js +142 -85
- package/web-client/public/js/warnings.js +25 -0
- package/web-client/public/lib/bootstrap.file-input/bootstrap.file-input.js +0 -1
- package/web-client/public/stylesheets/grnsight.styl +40 -16
- package/web-client/views/components/demo.pug +7 -5
- package/web-client/views/upload.pug +64 -50
- package/database/network-database/scripts/filter_genes.py +0 -76
- package/database/network-database/scripts/loader.py +0 -79
- package/database/network-database/scripts/loader_updates.py +0 -99
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const Sequelize = require("sequelize");
|
|
2
|
+
require("dotenv").config();
|
|
3
|
+
var env = process.env.NODE_ENV || "development";
|
|
4
|
+
var config = require("../config/config")[env];
|
|
5
|
+
var sequelize = new Sequelize(
|
|
6
|
+
config.databaseName,
|
|
7
|
+
process.env.DB_USERNAME,
|
|
8
|
+
process.env.DB_PASSWORD,
|
|
9
|
+
{
|
|
10
|
+
host: config.databaseHost,
|
|
11
|
+
dialect: config.databaseDialect,
|
|
12
|
+
pool: {
|
|
13
|
+
max: 5,
|
|
14
|
+
min: 0,
|
|
15
|
+
idle: 10000
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const buildNetworkSourceQuery = function () {
|
|
21
|
+
return "SELECT * FROM protein_protein_interactions.source ORDER BY time_stamp DESC;";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const buildNetworkFromGeneProteinQuery = function (geneProtein) {
|
|
25
|
+
return `SELECT DISTINCT gene_id, display_gene_id, standard_name, length, molecular_weight, PI FROM
|
|
26
|
+
protein_protein_interactions.gene, protein_protein_interactions.protein WHERE
|
|
27
|
+
(LOWER(gene.gene_id)=LOWER('${geneProtein}') OR LOWER(gene.display_gene_id)=LOWER('${geneProtein}')
|
|
28
|
+
OR LOWER(protein.standard_name) =LOWER('${geneProtein}')) AND
|
|
29
|
+
LOWER(gene.gene_id) = LOWER(protein.gene_systematic_name);`;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const buildNetworkProteinsQuery = function (proteinString) {
|
|
33
|
+
let proteins = "(";
|
|
34
|
+
let proteinList = proteinString.split(",");
|
|
35
|
+
proteinList.forEach(x => proteins += ( `(physical_interactions.protein1 =\'${x}\') OR `));
|
|
36
|
+
proteins = `${proteins.substring(0, proteins.length - 4)}) AND (`;
|
|
37
|
+
proteinList.forEach(x => proteins += ( `(physical_interactions.protein2 =\'${x}\') OR `));
|
|
38
|
+
return `${proteins.substring(0, proteins.length - 4)})`;
|
|
39
|
+
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const buildGenerateProteinNetworkQuery = function (proteins, timestamp, source) {
|
|
43
|
+
return `SELECT DISTINCT protein1, protein2 FROM
|
|
44
|
+
protein_protein_interactions.physical_interactions WHERE
|
|
45
|
+
physical_interactions.time_stamp='${timestamp}' AND physical_interactions.source='${source}' AND
|
|
46
|
+
${buildNetworkProteinsQuery(proteins)} ORDER BY protein1 DESC;`;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const buildQueryByType = function (query) {
|
|
50
|
+
const networkQueries = {
|
|
51
|
+
"NetworkSource": () => buildNetworkSourceQuery(),
|
|
52
|
+
"NetworkFromGeneProtein": () => buildNetworkFromGeneProteinQuery(query.geneProtein),
|
|
53
|
+
"GenerateProteinNetwork": () => buildGenerateProteinNetworkQuery(query.proteins, query.timestamp, query.source)
|
|
54
|
+
};
|
|
55
|
+
if (Object.keys(networkQueries).includes(query.type)) {
|
|
56
|
+
return networkQueries[query.type]();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const convertResponseToJSON = function (queryType, totalOutput) {
|
|
61
|
+
let JSONOutput = {};
|
|
62
|
+
switch (queryType) {
|
|
63
|
+
case "NetworkSource":
|
|
64
|
+
JSONOutput.sources = {};
|
|
65
|
+
totalOutput.forEach(function (x) {
|
|
66
|
+
const timestamp = x.time_stamp;
|
|
67
|
+
const source = x.source;
|
|
68
|
+
const displayName = x.display_name;
|
|
69
|
+
JSONOutput.sources[`${displayName}: ${timestamp.toISOString().split("T")[0]}`] = {timestamp, source};
|
|
70
|
+
});
|
|
71
|
+
return JSONOutput;
|
|
72
|
+
case "NetworkFromGeneProtein":
|
|
73
|
+
if (totalOutput.length > 0) {
|
|
74
|
+
JSONOutput.standardName = totalOutput[0].standard_name;
|
|
75
|
+
JSONOutput.displayGeneId = totalOutput[0].display_gene_id;
|
|
76
|
+
JSONOutput.geneId = totalOutput[0].gene_id;
|
|
77
|
+
JSONOutput.length = totalOutput[0].length;
|
|
78
|
+
JSONOutput.molecularWeight = totalOutput[0].molecular_weight;
|
|
79
|
+
JSONOutput.PI = totalOutput[0].PI;
|
|
80
|
+
}
|
|
81
|
+
return JSONOutput;
|
|
82
|
+
case "GenerateProteinNetwork":
|
|
83
|
+
JSONOutput.links = {};
|
|
84
|
+
for (let connection of totalOutput) {
|
|
85
|
+
if (JSONOutput.links[connection.protein1] === undefined) {
|
|
86
|
+
JSONOutput.links[connection.protein1] = [connection.protein2];
|
|
87
|
+
} else {
|
|
88
|
+
JSONOutput.links[connection.protein1].push(connection.protein2);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return JSONOutput;
|
|
92
|
+
default:
|
|
93
|
+
return JSONOutput;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
module.exports = {
|
|
99
|
+
queryProteinDatabase: function (req, res) {
|
|
100
|
+
sequelize.query(buildQueryByType(req.query), { type: sequelize.QueryTypes.SELECT })
|
|
101
|
+
.then(function (stdname) {
|
|
102
|
+
const response = convertResponseToJSON(req.query.type, stdname);
|
|
103
|
+
return res.send(response);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
package/test/export-tests.js
CHANGED
|
@@ -2,6 +2,7 @@ var expect = require("chai").expect;
|
|
|
2
2
|
var extend = require("jquery-extend");
|
|
3
3
|
var xlsx = require("node-xlsx");
|
|
4
4
|
var test = require("./test");
|
|
5
|
+
const { CELL_A1_PPI, CELL_A1_GRN } = require("../server/controllers/constants");
|
|
5
6
|
|
|
6
7
|
var exportController = require(__dirname + "/../server/controllers/export-controller")();
|
|
7
8
|
var constants = require(__dirname + "/../server/controllers/constants");
|
|
@@ -20,7 +21,8 @@ var unweightedTestWorkbook = {
|
|
|
20
21
|
],
|
|
21
22
|
errors: [],
|
|
22
23
|
warnings: [],
|
|
23
|
-
sheetType: "unweighted"
|
|
24
|
+
sheetType: "unweighted",
|
|
25
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
var weightedTestWorkbook = {
|
|
@@ -37,7 +39,8 @@ var weightedTestWorkbook = {
|
|
|
37
39
|
],
|
|
38
40
|
errors: [],
|
|
39
41
|
warnings: [],
|
|
40
|
-
sheetType: "weighted"
|
|
42
|
+
sheetType: "weighted",
|
|
43
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
var unweightedTestWorkbookWithCycle = {
|
|
@@ -57,7 +60,8 @@ var unweightedTestWorkbookWithCycle = {
|
|
|
57
60
|
],
|
|
58
61
|
errors: [],
|
|
59
62
|
warnings: [],
|
|
60
|
-
sheetType: "unweighted"
|
|
63
|
+
sheetType: "unweighted",
|
|
64
|
+
workbookType: "constants.NETWORK_GRN_MODE"
|
|
61
65
|
};
|
|
62
66
|
|
|
63
67
|
var weightedTestWorkbookWithCycle = {
|
|
@@ -77,7 +81,8 @@ var weightedTestWorkbookWithCycle = {
|
|
|
77
81
|
],
|
|
78
82
|
errors: [],
|
|
79
83
|
warnings: [],
|
|
80
|
-
sheetType: "weighted"
|
|
84
|
+
sheetType: "weighted",
|
|
85
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
81
86
|
};
|
|
82
87
|
|
|
83
88
|
describe("Export to SIF", function () {
|
|
@@ -407,6 +412,100 @@ describe("Export to GraphML", function () {
|
|
|
407
412
|
});
|
|
408
413
|
});
|
|
409
414
|
|
|
415
|
+
const inputPPIWorkbook = {
|
|
416
|
+
"genes": [
|
|
417
|
+
{ "name": "Aim32p" },
|
|
418
|
+
{ "name": "Ccr4p" },
|
|
419
|
+
{ "name": "Erv1p" }
|
|
420
|
+
],
|
|
421
|
+
|
|
422
|
+
"links": [
|
|
423
|
+
{
|
|
424
|
+
"source": 0,
|
|
425
|
+
"target": 1,
|
|
426
|
+
"value": 1,
|
|
427
|
+
"type": "arrowhead",
|
|
428
|
+
"stroke": "black"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"source": 1,
|
|
432
|
+
"target": 1,
|
|
433
|
+
"value": 1,
|
|
434
|
+
"type": "arrowhead",
|
|
435
|
+
"stroke": "black",
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"source": 0,
|
|
439
|
+
"target": 2,
|
|
440
|
+
"value": 1,
|
|
441
|
+
"type": "arrowhead",
|
|
442
|
+
"stroke": "black",
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"source": 2,
|
|
446
|
+
"target": 2,
|
|
447
|
+
"value": 1,
|
|
448
|
+
"type": "arrowhead",
|
|
449
|
+
"stroke": "black",
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
|
|
453
|
+
network: {
|
|
454
|
+
"genes": [
|
|
455
|
+
{ "name": "Aim32p" },
|
|
456
|
+
{ "name": "Ccr4p" },
|
|
457
|
+
{ "name": "Erv1p" }
|
|
458
|
+
],
|
|
459
|
+
|
|
460
|
+
"links": [
|
|
461
|
+
{
|
|
462
|
+
"source": 0,
|
|
463
|
+
"target": 1,
|
|
464
|
+
"value": 1,
|
|
465
|
+
"type": "arrowhead",
|
|
466
|
+
"stroke": "black"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"source": 1,
|
|
470
|
+
"target": 1,
|
|
471
|
+
"value": 1,
|
|
472
|
+
"type": "arrowhead",
|
|
473
|
+
"stroke": "black",
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"source": 0,
|
|
477
|
+
"target": 2,
|
|
478
|
+
"value": 1,
|
|
479
|
+
"type": "arrowhead",
|
|
480
|
+
"stroke": "black",
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"source": 2,
|
|
484
|
+
"target": 2,
|
|
485
|
+
"value": 1,
|
|
486
|
+
"type": "arrowhead",
|
|
487
|
+
"stroke": "black",
|
|
488
|
+
}
|
|
489
|
+
],
|
|
490
|
+
},
|
|
491
|
+
networkWeights: {},
|
|
492
|
+
|
|
493
|
+
"meta": {
|
|
494
|
+
data: {
|
|
495
|
+
"workbookType": "protein-protein-physical-interaction",
|
|
496
|
+
"species": "Saccharomyces cerevisiae",
|
|
497
|
+
"taxon_id": "559292",
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
inputPPIWorkbook.exportSheets = {
|
|
503
|
+
networks: {
|
|
504
|
+
"network": inputPPIWorkbook.network
|
|
505
|
+
},
|
|
506
|
+
"optimization_parameters": inputPPIWorkbook.meta
|
|
507
|
+
};
|
|
508
|
+
|
|
410
509
|
const inputWorkbook = {
|
|
411
510
|
"genes": [
|
|
412
511
|
{ "name": "ACE2" },
|
|
@@ -550,7 +649,8 @@ const inputWorkbook = {
|
|
|
550
649
|
"production_function": "testMM",
|
|
551
650
|
"simulation_timepoints": [0, 0.1, 0.2],
|
|
552
651
|
"species": "Saccharomyces cerevisiae",
|
|
553
|
-
"taxon_id": 559292
|
|
652
|
+
"taxon_id": 559292,
|
|
653
|
+
"workbookType": constants.NETWORK_GRN_MODE
|
|
554
654
|
}
|
|
555
655
|
},
|
|
556
656
|
|
|
@@ -659,12 +759,12 @@ inputWorkbook.exportSheets = {
|
|
|
659
759
|
};
|
|
660
760
|
|
|
661
761
|
describe("Export to spreadsheet", function () {
|
|
662
|
-
it("should export a workbook to a spreadsheet object properly", function () {
|
|
762
|
+
it("should export a workbook of gene regulatory network to a spreadsheet object properly", function () {
|
|
663
763
|
const expectedSheet = [
|
|
664
764
|
{
|
|
665
765
|
name: "network",
|
|
666
766
|
data: [
|
|
667
|
-
[
|
|
767
|
+
[CELL_A1_GRN, "ACE2", "AFT2", "CIN5"],
|
|
668
768
|
["ACE2", 1, 0, 0],
|
|
669
769
|
["AFT2", 0, 1, 1],
|
|
670
770
|
["CIN5", 0, 0, 1]
|
|
@@ -674,7 +774,7 @@ describe("Export to spreadsheet", function () {
|
|
|
674
774
|
{
|
|
675
775
|
name: "network_weights",
|
|
676
776
|
data: [
|
|
677
|
-
[
|
|
777
|
+
[CELL_A1_GRN, "ACE2", "AFT2", "CIN5"],
|
|
678
778
|
["ACE2", 1, 0, 0],
|
|
679
779
|
["AFT2", 0, 1, 1],
|
|
680
780
|
["CIN5", 0, 0, 1]
|
|
@@ -701,7 +801,8 @@ describe("Export to spreadsheet", function () {
|
|
|
701
801
|
["production_function", "testMM"],
|
|
702
802
|
["simulation_timepoints", 0, 0.1, 0.2],
|
|
703
803
|
["species", "Saccharomyces cerevisiae"],
|
|
704
|
-
["taxon_id", 559292]
|
|
804
|
+
["taxon_id", 559292],
|
|
805
|
+
["workbookType", constants.NETWORK_GRN_MODE]
|
|
705
806
|
]
|
|
706
807
|
},
|
|
707
808
|
|
|
@@ -791,6 +892,32 @@ describe("Export to spreadsheet", function () {
|
|
|
791
892
|
expect(actualSheet).to.deep.equal(xlsx.build(expectedSheet));
|
|
792
893
|
});
|
|
793
894
|
|
|
895
|
+
it("should export a workbook of ppi to a spreadsheet object properly", function () {
|
|
896
|
+
const expectedSheet = [
|
|
897
|
+
{
|
|
898
|
+
name: "network",
|
|
899
|
+
data: [
|
|
900
|
+
[CELL_A1_PPI, "Aim32p", "Ccr4p", "Erv1p"],
|
|
901
|
+
["Aim32p", 0, 0, 0],
|
|
902
|
+
["Ccr4p", 1, 1, 0],
|
|
903
|
+
["Erv1p", 1, 0, 1]
|
|
904
|
+
]
|
|
905
|
+
},
|
|
906
|
+
|
|
907
|
+
{
|
|
908
|
+
name: "optimization_parameters",
|
|
909
|
+
data: [
|
|
910
|
+
["optimization_parameter", "value"],
|
|
911
|
+
["workbookType", constants.NETWORK_PPI_MODE],
|
|
912
|
+
["species", "Saccharomyces cerevisiae"],
|
|
913
|
+
["taxon_id", "559292"]
|
|
914
|
+
]
|
|
915
|
+
}
|
|
916
|
+
];
|
|
917
|
+
const actualSheet = exportController.grnsightToXlsx(inputPPIWorkbook);
|
|
918
|
+
expect(actualSheet).to.deep.equal(xlsx.build(expectedSheet));
|
|
919
|
+
});
|
|
920
|
+
|
|
794
921
|
it("should export a workbook exactly as the import",
|
|
795
922
|
function () {
|
|
796
923
|
// Commented out temporarily while reworking the export of the optimization diagnostics sheet
|
package/test/import-sif-tests.js
CHANGED
|
@@ -7,7 +7,7 @@ var importController = require(__dirname + "/../server/controllers" + "/import-c
|
|
|
7
7
|
var constants = require(__dirname + "/../server/controllers" + "/constants");
|
|
8
8
|
var initWorkbook = require(__dirname + "/../server/controllers" + "/helpers.js").initWorkbook;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
let expectedUnweightedGRNWorkbook = initWorkbook({
|
|
11
11
|
genes: [
|
|
12
12
|
{ name: "A" },
|
|
13
13
|
{ name: "B" },
|
|
@@ -27,9 +27,35 @@ var expectedUnweightedWorkbook = initWorkbook({
|
|
|
27
27
|
negativeWeights: [],
|
|
28
28
|
sheetType: "unweighted",
|
|
29
29
|
meta: {},
|
|
30
|
-
expression:{}
|
|
30
|
+
expression:{},
|
|
31
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
let expectedUnweightedPPIWorkbook = initWorkbook({
|
|
35
|
+
genes: [
|
|
36
|
+
{ name: "A" },
|
|
37
|
+
{ name: "B" },
|
|
38
|
+
{ name: "C" },
|
|
39
|
+
{ name: "D" }
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
links: [
|
|
43
|
+
{ source: 1, target: 0 },
|
|
44
|
+
{ source: 1, target: 2 },
|
|
45
|
+
{ source: 2, target: 1 }
|
|
46
|
+
],
|
|
47
|
+
|
|
48
|
+
errors: [],
|
|
49
|
+
warnings: [],
|
|
50
|
+
positiveWeights: [],
|
|
51
|
+
negativeWeights: [],
|
|
52
|
+
sheetType: "unweighted",
|
|
53
|
+
meta: {},
|
|
54
|
+
expression:{},
|
|
55
|
+
workbookType: constants.NETWORK_PPI_MODE
|
|
31
56
|
});
|
|
32
57
|
|
|
58
|
+
|
|
33
59
|
var expectedWeightedWorkbook = initWorkbook({
|
|
34
60
|
genes: [
|
|
35
61
|
{ name: "A" },
|
|
@@ -50,6 +76,7 @@ var expectedWeightedWorkbook = initWorkbook({
|
|
|
50
76
|
negativeWeights: [],
|
|
51
77
|
sheetType: "weighted",
|
|
52
78
|
meta: {},
|
|
79
|
+
workbookType: constants.NETWORK_GRN_MODE,
|
|
53
80
|
expression:{}
|
|
54
81
|
});
|
|
55
82
|
|
|
@@ -76,7 +103,8 @@ var expectedUnweightedWorkbookWithCycle = initWorkbook({
|
|
|
76
103
|
negativeWeights: [],
|
|
77
104
|
sheetType: "unweighted",
|
|
78
105
|
meta: {},
|
|
79
|
-
expression:{}
|
|
106
|
+
expression:{},
|
|
107
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
80
108
|
});
|
|
81
109
|
|
|
82
110
|
var expectedWeightedWorkbookWithCycle = initWorkbook({
|
|
@@ -102,18 +130,26 @@ var expectedWeightedWorkbookWithCycle = initWorkbook({
|
|
|
102
130
|
negativeWeights: [],
|
|
103
131
|
sheetType: "weighted",
|
|
104
132
|
meta: {},
|
|
105
|
-
expression:{}
|
|
133
|
+
expression:{},
|
|
134
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
106
135
|
});
|
|
107
136
|
|
|
108
137
|
// Unweighted SIF
|
|
109
138
|
|
|
110
|
-
var
|
|
139
|
+
var unweightedGRNTestSif = [
|
|
111
140
|
"A",
|
|
112
141
|
[ "B", "pd", "A", "C" ].join("\t"),
|
|
113
142
|
[ "C", "pd", "B" ].join("\t"),
|
|
114
143
|
"D"
|
|
115
144
|
].join("\r\n"); // Mix up linebreak types to test normalization.
|
|
116
145
|
|
|
146
|
+
var unweightedPPITestSif = [
|
|
147
|
+
"A",
|
|
148
|
+
[ "B", "pp", "A", "C" ].join("\t"),
|
|
149
|
+
[ "C", "pp", "B" ].join("\t"),
|
|
150
|
+
"D"
|
|
151
|
+
].join("\r\n"); // Mix up linebreak types to test normalization.
|
|
152
|
+
|
|
117
153
|
var unweightedTestSifWithCycle = [
|
|
118
154
|
[ "A", "pd", "A" ].join("\t"),
|
|
119
155
|
[ "B", "pd", "A", "C" ].join("\t"),
|
|
@@ -280,11 +316,21 @@ var sifWithSemanticErrorOnly = [
|
|
|
280
316
|
"E"
|
|
281
317
|
].join("\r\n");
|
|
282
318
|
|
|
319
|
+
var sifWithMixedRelationshipTypes = [
|
|
320
|
+
[ "A", "pd", "A" ].join("\t"),
|
|
321
|
+
[ "B", "pd", "A", "C" ].join("\t"),
|
|
322
|
+
[ "C", "pd", "B" ].join("\t"),
|
|
323
|
+
[ "D", "pp", "D" ].join("\t"),
|
|
324
|
+
].join("\r\n");
|
|
325
|
+
|
|
283
326
|
describe("Import from SIF", function () {
|
|
284
327
|
it("should import unweighted workbooks from SIF correctly", function () {
|
|
285
328
|
expect(
|
|
286
|
-
importController.sifToGrnsight(
|
|
287
|
-
).to.deep.equal(
|
|
329
|
+
importController.sifToGrnsight(unweightedGRNTestSif)
|
|
330
|
+
).to.deep.equal(expectedUnweightedGRNWorkbook);
|
|
331
|
+
expect(
|
|
332
|
+
importController.sifToGrnsight(unweightedPPITestSif)
|
|
333
|
+
).to.deep.equal(expectedUnweightedPPIWorkbook);
|
|
288
334
|
});
|
|
289
335
|
|
|
290
336
|
it("should import weighted workbooks from SIF correctly", function () {
|
|
@@ -296,7 +342,7 @@ describe("Import from SIF", function () {
|
|
|
296
342
|
it("should import inconsistently weighted workbooks from SIF as unweighted", function () {
|
|
297
343
|
expect(
|
|
298
344
|
importController.sifToGrnsight(inconsistentlyWeightedTestSif)
|
|
299
|
-
).to.deep.equal(extend(true, {},
|
|
345
|
+
).to.deep.equal(extend(true, {}, expectedUnweightedGRNWorkbook, {
|
|
300
346
|
warnings: [
|
|
301
347
|
constants.warnings.EDGES_WITHOUT_WEIGHTS
|
|
302
348
|
]
|
|
@@ -350,7 +396,8 @@ describe("Import from SIF", function () {
|
|
|
350
396
|
negativeWeights: [],
|
|
351
397
|
sheetType: "unweighted",
|
|
352
398
|
meta: {},
|
|
353
|
-
expression:{}
|
|
399
|
+
expression:{},
|
|
400
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
354
401
|
}));
|
|
355
402
|
});
|
|
356
403
|
|
|
@@ -368,7 +415,8 @@ describe("Import from SIF", function () {
|
|
|
368
415
|
negativeWeights: [],
|
|
369
416
|
sheetType: "weighted",
|
|
370
417
|
meta: {},
|
|
371
|
-
expression:{}
|
|
418
|
+
expression:{},
|
|
419
|
+
workbookType: constants.NETWORK_GRN_MODE
|
|
372
420
|
}));
|
|
373
421
|
});
|
|
374
422
|
|
|
@@ -399,11 +447,11 @@ describe("Import from SIF syntactic checker", function () {
|
|
|
399
447
|
|
|
400
448
|
it("should produce no warnings or errors for correct data", function () {
|
|
401
449
|
expect(
|
|
402
|
-
importController.sifToGrnsight(
|
|
450
|
+
importController.sifToGrnsight(unweightedGRNTestSif).errors.length
|
|
403
451
|
).to.equal(0);
|
|
404
452
|
});
|
|
405
453
|
|
|
406
|
-
it("should throw an error for unweighted graphs with relationship types other than 'pd'", function () {
|
|
454
|
+
it("should throw an error for unweighted graphs with relationship types other than 'pd' and 'pp", function () {
|
|
407
455
|
expect(
|
|
408
456
|
importController.sifToGrnsight(unweightedTestSifWithIncorrectRelationshipType).errors.length
|
|
409
457
|
).to.equal(1);
|
|
@@ -470,7 +518,13 @@ describe("Import from SIF syntactic checker", function () {
|
|
|
470
518
|
it("should accept trivially tabbed workbooks", function () {
|
|
471
519
|
expect(
|
|
472
520
|
importController.sifToGrnsight(triviallyTabbedUnweightedWorkbook)
|
|
473
|
-
).to.deep.equal(
|
|
521
|
+
).to.deep.equal(expectedUnweightedGRNWorkbook);
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
it("should throw an error for SIF files with mixed relationship types", function () {
|
|
525
|
+
expect(
|
|
526
|
+
importController.sifToGrnsight(sifWithMixedRelationshipTypes).errors[0].errorCode
|
|
527
|
+
).to.equal("SIF_MIXED_RELATIONSHIP_TYPE_ERROR");
|
|
474
528
|
});
|
|
475
529
|
|
|
476
530
|
});
|
package/test/test.js
CHANGED
|
@@ -14,7 +14,7 @@ var exportController = require(__dirname + "/../server/controllers/export-contro
|
|
|
14
14
|
// changed network parser to preserve all network sheets instead of choosing the best and throwing awway rhe rest
|
|
15
15
|
// this helper method chooses the best network sheet, so prior implemented test behaviour doesn't crash
|
|
16
16
|
var parseNetworkSheet = (sheet) => {
|
|
17
|
-
var allNetworks = parseAllNetworkSheet(sheet);
|
|
17
|
+
var allNetworks = parseAllNetworkSheet.networks(sheet);
|
|
18
18
|
if (typeof allNetworks.networkOptimizedWeights === "object" &&
|
|
19
19
|
Object.keys(allNetworks.networkOptimizedWeights).length !== 0) {
|
|
20
20
|
return allNetworks.networkOptimizedWeights;
|
|
Binary file
|
|
Binary file
|
package/test-files/expression-data-test-sheets/expression_sheet_missing_data_ok_export_exact.xlsx
CHANGED
|
Binary file
|
|
@@ -14,24 +14,24 @@ module.exports = {
|
|
|
14
14
|
},
|
|
15
15
|
|
|
16
16
|
production: {
|
|
17
|
-
host: "grnsight.
|
|
17
|
+
host: "grnsight.lmucs.org",
|
|
18
18
|
port: 3001,
|
|
19
19
|
url: "https://" + this.host + "/client",
|
|
20
20
|
root: rootPath,
|
|
21
21
|
app: {
|
|
22
22
|
name: "GRNsight"
|
|
23
23
|
},
|
|
24
|
-
serviceRoot: "//grnsight.
|
|
24
|
+
serviceRoot: "//grnsight.lmucs.org/server"
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
beta: {
|
|
28
|
-
host: "grnsight.
|
|
28
|
+
host: "grnsight.lmucs.org",
|
|
29
29
|
port: 4001,
|
|
30
30
|
url: "https://" + this.host + "/beta/client",
|
|
31
31
|
root: rootPath,
|
|
32
32
|
app: {
|
|
33
33
|
name: "GRNsight"
|
|
34
34
|
},
|
|
35
|
-
serviceRoot: "//grnsight.
|
|
35
|
+
serviceRoot: "//grnsight.lmucs.org/beta/server"
|
|
36
36
|
}
|
|
37
37
|
};
|
|
@@ -5,7 +5,7 @@ const buildQueryURL = function (path, parameters) {
|
|
|
5
5
|
for (let p in parameters) {
|
|
6
6
|
searchParams.append(p, parameters[p]);
|
|
7
7
|
}
|
|
8
|
-
return `${path}?${searchParams
|
|
8
|
+
return `${path}?${searchParams}`;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const responseData = (database, formData, queryURL) => {
|
|
@@ -26,7 +26,7 @@ const responseData = (database, formData, queryURL) => {
|
|
|
26
26
|
.done((data) => {
|
|
27
27
|
resolve(data);
|
|
28
28
|
})
|
|
29
|
-
.error(
|
|
29
|
+
.error(() => {
|
|
30
30
|
console.log(
|
|
31
31
|
`Error in accessing ${database} database. Result may just be loading.`
|
|
32
32
|
);
|
|
@@ -48,6 +48,20 @@ const queryNetworkDatabase = (query) => {
|
|
|
48
48
|
return responseData("network", "", queryURL);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
// GRNsettings DB Access Functions
|
|
52
|
+
|
|
53
|
+
const queryDefaultDataset = (query) => {
|
|
54
|
+
const queryURL = buildQueryURL("grnsettingsdb", query);
|
|
55
|
+
return responseData("grnsettings", "", queryURL);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Protein-Protein DB Access Functions
|
|
59
|
+
|
|
60
|
+
const queryProteinProteinDatabase = (query) => {
|
|
61
|
+
const queryURL = buildQueryURL("proteindb", query);
|
|
62
|
+
return responseData("network", "", queryURL);
|
|
63
|
+
};
|
|
64
|
+
|
|
51
65
|
// Upload Custom Workbook Functions
|
|
52
66
|
|
|
53
67
|
const uploadCustomWorkbook = (workbook, grnState) => {
|
|
@@ -61,7 +75,6 @@ const constructFullUrl = (queryURL) =>
|
|
|
61
75
|
const getWorkbookFromForm = (formData, queryURL) => {
|
|
62
76
|
const fullUrl = constructFullUrl(queryURL);
|
|
63
77
|
|
|
64
|
-
|
|
65
78
|
// The presence of formData is taken to indicate a POST.
|
|
66
79
|
return formData
|
|
67
80
|
? $.ajax({
|
|
@@ -86,4 +99,6 @@ export {
|
|
|
86
99
|
uploadCustomWorkbook,
|
|
87
100
|
getWorkbookFromForm,
|
|
88
101
|
getWorkbookFromUrl,
|
|
102
|
+
queryDefaultDataset,
|
|
103
|
+
queryProteinProteinDatabase
|
|
89
104
|
};
|
|
@@ -21,28 +21,41 @@ export const SCHADE_OUTPUT_ID = ".schadeOutput";
|
|
|
21
21
|
export const SCHADE_OUTPUT_PATH = "demo/schadeOutput";
|
|
22
22
|
export const SCHADE_OUTPUT_NAME = "Demo #4: Weighted GRN (21 genes, 31 edges, Schade et al. 2004 data)";
|
|
23
23
|
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
27
|
-
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
33
|
-
export const
|
|
24
|
+
export const PPI_DEMO_ID = ".ppi";
|
|
25
|
+
export const PPI_DEMO_PATH = "demo/ppi";
|
|
26
|
+
export const PPI_DEMO_NAME = "Demo #5: PPI (18 proteins, 81 edges)";
|
|
27
|
+
|
|
28
|
+
export const EXPORT_TO_EXCEL = "#exportAsExcelWkbk";
|
|
29
|
+
export const EXPORT_TO_UNWEIGHTED_SIF = "#exportAsUnweightedSif";
|
|
30
|
+
export const EXPORT_TO_WEIGHTED_SIF = "#exportAsWeightedSif";
|
|
31
|
+
export const EXPORT_TO_UNWEIGHTED_GML = "#exportAsUnweightedGraphMl";
|
|
32
|
+
export const EXPORT_TO_UNWEIGHTED_GML_MENU = "#unweightedGraphmlContainer";
|
|
33
|
+
export const EXPORT_TO_WEIGHTED_GML = "#exportAsWeightedGraphMl";
|
|
34
|
+
export const EXPORT_TO_PNG = "#exportAsPng";
|
|
35
|
+
export const EXPORT_TO_SVG = "#exportAsSvg";
|
|
36
|
+
export const EXPORT_TO_PDF = "#exportAsPdf";
|
|
37
|
+
export const EXPORT_WEIGHTED_CLASS = ".weighted.export";
|
|
38
|
+
export const EXPRESSION_SOURCE = "#expressionSource";
|
|
39
|
+
|
|
40
|
+
export const NETWORK_MODE_GRN = "#network-mode-grn-menu";
|
|
41
|
+
export const NETWORK_MODE_PROTEIN_PHYS = "#network-mode-protein-protein-physical-interaction-menu";
|
|
42
|
+
export const NETWORK_MODE_DROPDOWN = "#networkModeDropdown";
|
|
43
|
+
export const NETWORK_MODE_CLASS = ".network-mode";
|
|
44
|
+
|
|
34
45
|
|
|
35
46
|
export const DEMO_INFORMATION = [
|
|
36
47
|
[ WEIGHTED_DEMO_ID, WEIGHTED_DEMO_PATH, WEIGHTED_DEMO_NAME ],
|
|
37
48
|
[ UNWEIGHTED_DEMO_ID, UNWEIGHTED_DEMO_PATH, UNWEIGHTED_DEMO_NAME ],
|
|
38
49
|
[ SCHADE_INPUT_ID, SCHADE_INPUT_PATH, SCHADE_INPUT_NAME ],
|
|
39
|
-
[ SCHADE_OUTPUT_ID, SCHADE_OUTPUT_PATH, SCHADE_OUTPUT_NAME ]
|
|
50
|
+
[ SCHADE_OUTPUT_ID, SCHADE_OUTPUT_PATH, SCHADE_OUTPUT_NAME ],
|
|
51
|
+
[ PPI_DEMO_ID, PPI_DEMO_PATH, PPI_DEMO_NAME ]
|
|
40
52
|
];
|
|
41
53
|
|
|
42
54
|
export const MIN_EDGE_WEIGHT_NORMALIZATION = 0.0001;
|
|
43
55
|
export const MAX_EDGE_WEIGHT_NORMALIZATION = 1000;
|
|
44
56
|
|
|
45
57
|
export const DEFAULT_ZOOM_VALUE = 100;
|
|
58
|
+
export const BOUNDARY_MARGIN = 5;
|
|
46
59
|
|
|
47
60
|
export const GREY_EDGE_THRESHOLD_MENU = "#gray-edge-threshold-menu";
|
|
48
61
|
export const GREY_EDGE_THRESHOLD_SLIDER_SIDEBAR = "#grayThresholdInput";
|
|
@@ -119,6 +132,7 @@ export const EXPRESSION_DB_LOADER_TEXT = ".expression-db-loader
|
|
|
119
132
|
export const DATA_SET_SELECT = "#data-set-select";
|
|
120
133
|
export const NODE_COLORING_MENU = ".node-coloring";
|
|
121
134
|
export const NODE_COLORING_MENU_CLASS = ".node-coloring-menu";
|
|
135
|
+
export const NODE_COLORING_NAVBAR_OPTIONS = "#node-coloring-navbar-options";
|
|
122
136
|
export const NODE_COLORING_SIDEBAR_PANEL = "#nodeColoringSidebarPanel";
|
|
123
137
|
export const NODE_COLORING_SIDEBAR_HEADER_LINK = "#nodeColoringHeaderLink";
|
|
124
138
|
export const NODE_COLORING_SIDEBAR_BODY = ".nodeColoringSidebarBody";
|
|
@@ -181,5 +195,6 @@ export const VIEWPORT_SIZE_FIT_SIDEBAR = "#boundBoxFit";
|
|
|
181
195
|
export const VIEWPORT_OPTION_CLASS = ".viewportOption";
|
|
182
196
|
export const VIEWPORT_OPTION_CLASS_SIDEBAR = ".boundBoxSize";
|
|
183
197
|
|
|
184
|
-
|
|
198
|
+
export const NETWORK_PPI_MODE = "protein-protein-physical-interaction";
|
|
199
|
+
export const NETWORK_GRN_MODE = "grn";
|
|
185
200
|
|