@sjcrh/proteinpaint-server 2.124.0 → 2.125.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Proteinpaint Server
1
+ # ProteinPaint Server
2
2
 
3
3
  The data server backend for the ProteinPaint application
4
4
 
@@ -6,26 +6,38 @@ The data server backend for the ProteinPaint application
6
6
 
7
7
  The client dependencies should be installed as a workspace, follow the README at the project root.
8
8
 
9
- You can either:
10
- - use a docker container for development, see ../build/dev/README.md
11
- - or install the [system depedencies](https://docs.google.com/document/d/1tkEHG_vYtT-OifPV-tlPeWQUMsEd3aWAKf5ExOT8G34/edit#heading=h.jy5sdrb1zkut)
12
- as listed in the [installation instructions](https://docs.google.com/document/d/1tkEHG_vYtT-OifPV-tlPeWQUMsEd3aWAKf5ExOT8G34/edit#heading=h.6nxua6c3ik9l).
9
+ You can either use a docker container for development (../build/dev/README.md), or build from source.
10
+ See https://github.com/stjude/proteinpaint/wiki.
13
11
 
14
12
 
15
- ## Develop
13
+ ## Serverconfig
14
+
15
+ `server/serverconfig.json` is used:
16
+ - when running any server or test scripts from the pp/server directory
17
+ - if `${process.cwd()/serverconfig.json` does not exist wherever `@sjcrh/proteinpaint-server` is called (if can give example of this usecase)
16
18
 
17
- From the proteinpaint/server/ directory:
19
+ If no `test:unit` code uses serverconfig, then it would have been okay to not have `server/serverconfig.json`.
20
+ However, it's safer to simply have that file available just in case any imported server code uses serverconfig
21
+ and runs as part of test:unit, and that's why `server/emitImports.js` creates one if it doesn't exist by
22
+ copying `container/ci/serverconfig.json`.
18
23
 
19
- `npm run dev` rebundles backend code
20
24
 
21
- `npm start` runs the proteinpaint server
25
+ ## Develop
22
26
 
27
+ The local development environment is usually triggered following one of these:
28
+ - follow the `Develop` section in [proteinpaint/README.md](https://github.com/stjude/proteinpaint/blob/master/README.md) (preferred)
29
+ - `npm start` from the `server` dir
23
30
 
24
31
  ## Test
25
32
 
26
- ```bash
27
- npm test
28
- ```
33
+ To run both type checks and test:unit: `npm run test`.
34
+
35
+ To run type check only: `npx tsc`.
36
+
37
+ To run unit tests only: `npm run test:unit`
38
+
39
+ To run specific test file: `npx tsx path/to/spec.ts`
40
+
29
41
 
30
42
  ## Build
31
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.124.0",
3
+ "version": "2.125.0",
4
4
  "type": "module",
5
5
  "description": "a genomics visualization tool for exploring a cohort's genotype and phenotype data",
6
6
  "main": "src/app.js",
@@ -16,8 +16,9 @@
16
16
  "scripts": {
17
17
  "dev": "npm run start",
18
18
  "prestart": "tsx emitImports.js dev > server.js",
19
- "start": "tsx watch . /start.js",
19
+ "start": "tsx watch ./start.js",
20
20
  "test:unit": "tsx emitImports.js unit > serverTests.js && c8 tsx serverTests.js && rm -rf ./cache",
21
+ "test": "tsc && npm run test:unit",
21
22
  "precombined:coverage": "tsx emitImports.js unit > serverTests.js",
22
23
  "combined:coverage": "coverageKey=test c8 --all --src=proteinpaint/server --experimental-monocart -r=v8 -r=html -r=json -r=markdown-summary -r=markdown-details -o=./.coverage tsx ./coverage.js & ",
23
24
  "postcombined:coverage": "rm -rf ./cache",
@@ -29,13 +30,7 @@
29
30
  "build": "./build.sh",
30
31
  "prepack": "npm run build",
31
32
  "postpack": "./dedupjs.sh",
32
- "dedup": "./dedupjs.sh",
33
- "//todo": "refactor or deprecate the scripts below",
34
- "pretest": "tsc && ./test/pretest.js",
35
- "pretest:type": "npm run checkers",
36
- "pretest:integration": "tsc",
37
- "test:integration": "echo 'TODO: server integration tests'",
38
- "test:tsc": "tsc --esModuleInterop --noEmit --allowImportingTsExtensions ./shared/types/test/*.type.spec.ts"
33
+ "dedup": "./dedupjs.sh"
39
34
  },
40
35
  "author": "",
41
36
  "license": "SEE LICENSE IN ./LICENSE",
@@ -67,10 +62,10 @@
67
62
  "dependencies": {
68
63
  "@sjcrh/augen": "2.121.0",
69
64
  "@sjcrh/proteinpaint-python": "2.118.0",
70
- "@sjcrh/proteinpaint-r": "2.123.0",
71
- "@sjcrh/proteinpaint-rust": "2.124.0",
65
+ "@sjcrh/proteinpaint-r": "2.125.0",
66
+ "@sjcrh/proteinpaint-rust": "2.125.0",
72
67
  "@sjcrh/proteinpaint-shared": "2.124.0",
73
- "@sjcrh/proteinpaint-types": "2.124.0",
68
+ "@sjcrh/proteinpaint-types": "2.125.0",
74
69
  "@types/express": "^5.0.0",
75
70
  "@types/express-session": "^1.18.1",
76
71
  "better-sqlite3": "^9.4.1",
package/routes/burden.js CHANGED
@@ -24,7 +24,7 @@ function init({ genomes }) {
24
24
  const q = req.query;
25
25
  const ds = genome.datasets[q.dslabel];
26
26
  if (!ds)
27
- throw `invalid q.genome=${req.query.dslabel}`;
27
+ throw `invalid q.dslabel=${req.query.dslabel}`;
28
28
  if (!ds.cohort.cumburden?.files)
29
29
  throw `missing ds.cohort.cumburden.files`;
30
30
  if (!ds.cohort?.cumburden?.db)
@@ -4,7 +4,6 @@ import path from "path";
4
4
  import serverconfig from "#src/serverconfig.js";
5
5
  import { run_python } from "@sjcrh/proteinpaint-python";
6
6
  import { mayLog } from "#src/helpers.ts";
7
- import { DeleteCacheFiles } from "#src/DeleteCacheFiles.ts";
8
7
  const api = {
9
8
  endpoint: "genesetEnrichment",
10
9
  methods: {
@@ -18,6 +17,7 @@ const api = {
18
17
  }
19
18
  }
20
19
  };
20
+ const cachedir_gsea = path.join(serverconfig.cachedir, "gsea");
21
21
  function init({ genomes }) {
22
22
  return async (req, res) => {
23
23
  try {
@@ -48,19 +48,13 @@ function init({ genomes }) {
48
48
  async function run_genesetEnrichment_analysis(q, genomes) {
49
49
  if (!genomes[q.genome].termdbs)
50
50
  throw "termdb database is not available for " + q.genome;
51
- const cache = new DeleteCacheFiles({
52
- cachedir: serverconfig.cachedir_gsea,
53
- fileExtensions: [".pkl"],
54
- maxSize: 1e6
55
- });
56
- await cache.mayResetCacheCheckTimeout(cache.checkWait);
57
51
  const genesetenrichment_input = {
58
52
  genes: q.genes,
59
53
  fold_change: q.fold_change,
60
54
  db: genomes[q.genome].termdbs.msigdb.cohort.db.connection.name,
61
55
  // For now msigdb has been added, but later databases other than msigdb may be used
62
56
  geneset_group: q.geneSetGroup,
63
- cachedir: serverconfig.cachedir_gsea,
57
+ cachedir: cachedir_gsea,
64
58
  geneset_name: q.geneset_name,
65
59
  pickle_file: q.pickle_file,
66
60
  num_permutations: q.num_permutations,
@@ -85,7 +79,7 @@ async function run_genesetEnrichment_analysis(q, genomes) {
85
79
  if (data_found)
86
80
  return result;
87
81
  if (image_found)
88
- return path.join(serverconfig.cachedir_gsea, result.image_file);
82
+ return path.join(cachedir_gsea, result.image_file);
89
83
  throw "data or image not found in gsea output; this should not happen";
90
84
  }
91
85
  export {
@@ -171,6 +171,7 @@ function addNonDictionaryQueries(c, ds, genome) {
171
171
  "cnvMaxLength",
172
172
  "cnvGainCutoff",
173
173
  "cnvLossCutoff",
174
+ "cnvCutoffsByGene",
174
175
  "absoluteValueRenderMax",
175
176
  "gainColor",
176
177
  "lossColor"