@sjcrh/proteinpaint-server 2.152.0 → 2.152.1-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.152.0",
3
+ "version": "2.152.1-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",
@@ -62,13 +62,13 @@
62
62
  "dependencies": {
63
63
  "@sjcrh/augen": "2.143.0",
64
64
  "@sjcrh/proteinpaint-python": "2.151.0",
65
- "@sjcrh/proteinpaint-r": "2.149.0",
66
- "@sjcrh/proteinpaint-rust": "2.150.0",
65
+ "@sjcrh/proteinpaint-r": "2.152.1-0",
66
+ "@sjcrh/proteinpaint-rust": "2.152.1-0",
67
67
  "@sjcrh/proteinpaint-shared": "2.152.0",
68
- "@sjcrh/proteinpaint-types": "2.152.0",
68
+ "@sjcrh/proteinpaint-types": "2.152.1-0",
69
69
  "@types/express": "^5.0.0",
70
70
  "@types/express-session": "^1.18.1",
71
- "better-sqlite3": "^9.4.1",
71
+ "better-sqlite3": "^12.4.1",
72
72
  "body-parser": "^1.15.2",
73
73
  "canvas": "~3.1.0",
74
74
  "compression": "^1.6.2",
@@ -1,5 +1,5 @@
1
1
  import { aiProjectAdminPayload } from "#types/checkers";
2
- import { getDbConnection } from "#src/aiHistoDBConnection.js";
2
+ import { getDbConnection } from "#src/aiHistoDBConnection.ts";
3
3
  import { runMultiStmtSQL, runSQL } from "#src/runSQLHelpers.ts";
4
4
  const api = {
5
5
  endpoint: "aiProjectAdmin",
@@ -165,5 +165,6 @@ function addProject(connection, project) {
165
165
  runMultiStmtSQL(connection, [{ sql: classSql, params: classParams }], "add");
166
166
  }
167
167
  export {
168
- api
168
+ api,
169
+ getImages
169
170
  };
@@ -1,6 +1,8 @@
1
1
  import { aiProjectTrainModelPayload } from "#types/checkers";
2
2
  import { TileServerSessionsHandler } from "#src/wsisessions/TileServerSessionsHandler.ts";
3
3
  import SessionManager from "#src/wsisessions/SessionManager.ts";
4
+ import { getDbConnection } from "#src/aiHistoDBConnection.js";
5
+ import { getImages } from "#routes/aiProjectAdmin.js";
4
6
  const api = {
5
7
  endpoint: "aiProjectTrainModel",
6
8
  methods: {
@@ -18,13 +20,17 @@ function init({ genomes }) {
18
20
  return async function(req, res) {
19
21
  try {
20
22
  const query = req.query;
21
- console.log(query);
22
23
  const g = genomes[query.genome];
23
24
  if (!g) throw "invalid genome name";
24
25
  const ds = g.datasets[query.dslabel];
25
26
  if (!ds) throw "invalid dataset name";
26
27
  if (typeof ds.queries.WSImages.retrainModel == "function") {
27
- await ds.queries.WSImages.retrainModel(query.projectId);
28
+ const connection = getDbConnection(ds);
29
+ const project = {
30
+ id: query.projectId
31
+ };
32
+ const wsimages = getImages(connection, project);
33
+ await ds.queries.WSImages.retrainModel(query.projectId, wsimages);
28
34
  try {
29
35
  const handler = new TileServerSessionsHandler();
30
36
  const sessionMgr = SessionManager.getInstance();
@@ -1,5 +1,5 @@
1
1
  import { ProfileFormScoresPayload } from "#types/checkers";
2
- import { getScoresData } from "./termdb.profileScores.js";
2
+ import { getScoresData } from "./termdb.profileScores.ts";
3
3
  const api = {
4
4
  endpoint: "termdb/profileFormScores",
5
5
  methods: {
@@ -1,5 +1,5 @@
1
1
  import { violinPayload } from "#types/checkers";
2
- import { scaleLinear, scaleLog, extent } from "d3";
2
+ import { scaleLinear, scaleLog } from "d3";
3
3
  import { run_rust } from "@sjcrh/proteinpaint-rust";
4
4
  import { getData } from "../src/termdb.matrix.js";
5
5
  import { createCanvas } from "canvas";
@@ -181,7 +181,7 @@ async function createCanvasImg(q, result, ds) {
181
181
  const chart = result.charts[k];
182
182
  const plot2Values = {};
183
183
  for (const plot of chart.plots) plot2Values[plot.label] = plot.values;
184
- const densities = await getDensities(plot2Values, result.min, result.max);
184
+ const densities = await getDensities(plot2Values);
185
185
  let axisScale;
186
186
  const useLog = q.unit == "log";
187
187
  if (useLog) {
@@ -229,12 +229,11 @@ async function createCanvasImg(q, result, ds) {
229
229
  }
230
230
  }
231
231
  async function getDensity(values) {
232
- const [min, max] = extent(values);
233
- const result = await getDensities({ plot: values }, min, max);
232
+ const result = await getDensities({ plot: values });
234
233
  return result.plot;
235
234
  }
236
- async function getDensities(plot2Values, min, max) {
237
- const plot2Density = JSON.parse(await run_R("density.R", JSON.stringify({ plot2Values, min, max })));
235
+ async function getDensities(plot2Values) {
236
+ const plot2Density = JSON.parse(await run_R("density.R", JSON.stringify({ plot2Values })));
238
237
  const densities = {};
239
238
  for (const plot in plot2Density) {
240
239
  const result = plot2Density[plot];