@sjcrh/proteinpaint-server 2.25.0 → 2.26.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/dataset/clinvar.hg19.js +3 -3
- package/dataset/clinvar.hg38.js +20 -3
- package/genome/cgc.js +7 -0
- package/genome/hg19.js +2 -0
- package/genome/hg38.js +9 -2
- package/package.json +8 -8
- package/routes/genelookup.ts +58 -0
- package/routes/healthcheck.ts +72 -0
- package/server.js +1 -1
- package/utils/fastclust.R +8 -6
- package/src/routes/healthcheck.ts +0 -92
package/utils/fastclust.R
CHANGED
|
@@ -42,9 +42,9 @@ args <- commandArgs(trailingOnly = T)
|
|
|
42
42
|
if (length(args) != 1) stop("Usage: Rscript test.R in.json > results")
|
|
43
43
|
infile <- args[1]
|
|
44
44
|
input <- fromJSON(infile)
|
|
45
|
-
|
|
45
|
+
normalized_matrix <- t(scale(t(input$matrix))) # Applying z-score normalization
|
|
46
46
|
# For columns (i.e samples)
|
|
47
|
-
RowDist <- dist(
|
|
47
|
+
RowDist <- dist(normalized_matrix, method = "euclidean") # Transposing the matrix
|
|
48
48
|
|
|
49
49
|
# Hierarchical clustering
|
|
50
50
|
print (input$cluster_method)
|
|
@@ -76,7 +76,7 @@ print ("RowCoordinates")
|
|
|
76
76
|
print (row_node_coordinates)
|
|
77
77
|
|
|
78
78
|
# For columns (i.e samples)
|
|
79
|
-
ColumnDist <- dist(t(
|
|
79
|
+
ColumnDist <- dist(t(normalized_matrix), method = "euclidean") # Transposing the matrix
|
|
80
80
|
|
|
81
81
|
# Hierarchical clustering
|
|
82
82
|
|
|
@@ -95,7 +95,7 @@ print (col_node_coordinates)
|
|
|
95
95
|
print ("Done")
|
|
96
96
|
# Sorting the matrix
|
|
97
97
|
|
|
98
|
-
SortedMatrix <-
|
|
98
|
+
SortedMatrix <- normalized_matrix[RowDend$order, ColumnDend$order]
|
|
99
99
|
SortedRowNames <- input$row_names[RowDend$order]
|
|
100
100
|
SortedColumnNames <- input$col_names[ColumnDend$order]
|
|
101
101
|
|
|
@@ -104,9 +104,11 @@ colnames(m) <- SortedColumnNames
|
|
|
104
104
|
rownames(m) <- SortedRowNames
|
|
105
105
|
cat("rownames",RowDend$order,"\n",sep="\t")
|
|
106
106
|
cat("colnames",ColumnDend$order,"\n",sep="\t")
|
|
107
|
+
cat ("OutputMatrix",normalized_matrix,"\n",sep="\t") # This outputs the 2D array in 1D column-wise. This is later converted to 2D array in nodejs.
|
|
108
|
+
|
|
107
109
|
|
|
108
|
-
df <- melt(m)
|
|
109
|
-
colnames(df) <- c("Genes", "Samples", "value")
|
|
110
|
+
#df <- melt(m)
|
|
111
|
+
#colnames(df) <- c("Genes", "Samples", "value")
|
|
110
112
|
|
|
111
113
|
#ggplot(df, aes(x = Genes, y = Samples, fill = value)) + geom_tile() + scale_fill_gradient(low="blue", high="red") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
|
|
112
114
|
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import serverconfig from '../serverconfig'
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import child_process from 'child_process'
|
|
4
|
-
import util from 'util'
|
|
5
|
-
import pkg from '../../package.json'
|
|
6
|
-
import { VersionInfo, GenomeBuildInfo, HealthCheckResponse } from '../../shared/types/healthcheck'
|
|
7
|
-
|
|
8
|
-
const execPromise = util.promisify(child_process.exec)
|
|
9
|
-
//const docs = require('../shared/doc')
|
|
10
|
-
|
|
11
|
-
export function setRoute(app: any, genomes: any, basepath) {
|
|
12
|
-
app.get(basepath + '/healthcheck', async (req, res): Promise<void> => {
|
|
13
|
-
try {
|
|
14
|
-
const health = await getStat(genomes)
|
|
15
|
-
res.send(health)
|
|
16
|
-
} catch (e: any) {
|
|
17
|
-
res.send({ status: 'error', error: e.message || e })
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function getStat(genomes: any): Promise<HealthCheckResponse> {
|
|
23
|
-
const health = {
|
|
24
|
-
status: 'ok',
|
|
25
|
-
genomes: {},
|
|
26
|
-
versionInfo
|
|
27
|
-
} as HealthCheckResponse
|
|
28
|
-
|
|
29
|
-
const keys = serverconfig.features.healthcheck_keys || []
|
|
30
|
-
|
|
31
|
-
if (keys.includes('w')) {
|
|
32
|
-
const { stdout, stderr } = await execPromise('w | head -n1')
|
|
33
|
-
if (stderr) throw stderr
|
|
34
|
-
health.w = stdout
|
|
35
|
-
.toString()
|
|
36
|
-
.trim()
|
|
37
|
-
.split(' ')
|
|
38
|
-
.slice(-3)
|
|
39
|
-
.map(d => (d.endsWith(',') ? +d.slice(0, -1) : +d))
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (keys.includes('rs')) {
|
|
43
|
-
const { stdout, stderr } = await execPromise('ps aux | grep rsync -w')
|
|
44
|
-
if (stderr) throw stderr
|
|
45
|
-
health.rs = stdout.toString().trim().split('\n').length - 1
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// report status of every genome
|
|
49
|
-
for (const gn in genomes) {
|
|
50
|
-
const genome = genomes[gn] //; console.log(genome.genedb)
|
|
51
|
-
const dbInfo = {} as GenomeBuildInfo // object to store status of this genome
|
|
52
|
-
|
|
53
|
-
if (genome.genedb) {
|
|
54
|
-
// genedb status
|
|
55
|
-
dbInfo.genedb = {
|
|
56
|
-
buildDate: genome.genedb.get_buildDate?.get().date || 'unknown',
|
|
57
|
-
tables: genome.genedb.tableSize
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (genome.termdbs) {
|
|
62
|
-
// genome-level termdb status e.g. msigdb
|
|
63
|
-
dbInfo.termdbs = {}
|
|
64
|
-
for (const key in genome.termdbs) {
|
|
65
|
-
const db = genome.termdbs[key]
|
|
66
|
-
dbInfo.termdbs[key] = {
|
|
67
|
-
buildDate: db.cohort.termdb.q.get_buildDate?.get().date || 'unknown'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (Object.keys(dbInfo).length && health.genomes) health.genomes[gn] = dbInfo
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return health
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const versionInfo: VersionInfo = {
|
|
79
|
-
pkgver: pkg.version,
|
|
80
|
-
codedate: get_codedate(),
|
|
81
|
-
launchdate: new Date(Date.now()).toString().split(' ').slice(0, 5).join(' ')
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function get_codedate() {
|
|
85
|
-
const date1 =
|
|
86
|
-
(fs.existsSync('public/bin/proteinpaint.js') && fs.statSync(serverconfig.binpath + '/server.js').mtime) ||
|
|
87
|
-
new Date(0)
|
|
88
|
-
const date2 =
|
|
89
|
-
(fs.existsSync('public/bin/proteinpaint.js') && fs.statSync('public/bin/proteinpaint.js').mtime) || new Date(0)
|
|
90
|
-
const date = date1 > date2 ? date1 : date2
|
|
91
|
-
return date.toDateString()
|
|
92
|
-
}
|