@sjcrh/proteinpaint-server 2.59.0 → 2.61.1
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 +2 -2
- package/routes/dzimages.js +64 -0
- package/routes/sampledzimages.js +50 -0
- package/routes/termdb.DE.js +129 -0
- package/routes/termdb.cluster.js +35 -27
- package/routes/termdb.config.js +15 -1
- package/routes/termdb.getTopTermsByType.js +106 -0
- package/routes/termdb.getdescrstats.js +1 -1
- package/src/app.js +1878 -818
- package/utils/edge.R +35 -16
package/utils/edge.R
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# Usage: echo <in_json> | Rscript edge.R > <out_json>
|
|
2
|
+
|
|
3
|
+
# in_json: [string] input data in JSON format. Streamed through stdin.
|
|
4
|
+
# out_json: [string] clustering results in JSON format. Streamed to stdout.
|
|
5
|
+
|
|
6
|
+
|
|
1
7
|
# json='{"case":"SJMB066856,SJMB069601,SJMB030827,SJMB030838,SJMB031131,SJMB031227,SJMB077221,SJMB077223","control":"SJMB069596,SJMB069587,SJMB074736,SJMB030488,SJMB030825,SJMB031110,SJMB032998,SJMB033002","input_file":"/Users/rpaul1/pp_data/files/hg38/sjmb12/rnaseq/geneCounts.txt"}' && time echo $json | Rscript edge.R
|
|
2
8
|
|
|
3
9
|
# json='{"case":"SJMB030827,SJMB030838,SJMB064540,SJMB064538,SJMB064520,SJMB064535,SJMB031131,SJMB031227","control":"SJMB030488,SJMB030825,SJMB064537,SJMB064510,SJMB064533,SJMB064534,SJMB031110","input_file":"/Users/rpaul1/pp_data/files/hg38/sjmb12/rnaseq/geneCounts.txt"}' && time echo $json | Rscript edge.R
|
|
@@ -28,21 +34,28 @@ suppressWarnings({
|
|
|
28
34
|
suppressPackageStartupMessages(library(dplyr))
|
|
29
35
|
})
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
con <- file("stdin", "r")
|
|
38
|
+
json <- readLines(con, warn=FALSE)
|
|
39
|
+
close(con)
|
|
40
|
+
input <- fromJSON(json)
|
|
41
|
+
#print (input)
|
|
42
|
+
#print (input$output_path)
|
|
34
43
|
cases <- unlist(strsplit(input$case, ","))
|
|
35
44
|
controls <- unlist(strsplit(input$control, ","))
|
|
36
45
|
combined <- c("geneID","geneSymbol",cases,controls)
|
|
37
46
|
#data %>% select(all_of(combined))
|
|
38
|
-
read_file_time_start <- Sys.time()
|
|
47
|
+
#read_file_time_start <- Sys.time()
|
|
48
|
+
suppressWarnings({
|
|
49
|
+
suppressMessages({
|
|
39
50
|
read_counts <- read_tsv(input$input_file, col_names = TRUE, col_select = combined)
|
|
51
|
+
})
|
|
52
|
+
})
|
|
40
53
|
geneIDs <- unlist(read_counts[1])
|
|
41
54
|
geneSymbols <- unlist(read_counts[2])
|
|
42
55
|
read_counts <- select(read_counts, -geneID)
|
|
43
56
|
read_counts <- select(read_counts, -geneSymbol)
|
|
44
|
-
read_file_time_stop <- Sys.time()
|
|
45
|
-
print (read_file_time_stop - read_file_time_start)
|
|
57
|
+
#read_file_time_stop <- Sys.time()
|
|
58
|
+
#print (read_file_time_stop - read_file_time_start)
|
|
46
59
|
|
|
47
60
|
diseased <- rep("Diseased", length(cases))
|
|
48
61
|
control <- rep("Control", length(controls))
|
|
@@ -50,16 +63,20 @@ conditions <- c(diseased, control)
|
|
|
50
63
|
tabs <- rep("\t",length(geneIDs))
|
|
51
64
|
gene_id_symbols <- paste0(geneIDs,tabs,geneSymbols)
|
|
52
65
|
y <- DGEList(counts = as.matrix(read_counts), group = conditions, genes = gene_id_symbols)
|
|
53
|
-
keep <- filterByExpr(y)
|
|
66
|
+
keep <- filterByExpr(y, min.count = input$min_count, min.total.count = input$min_total_count)
|
|
54
67
|
y <- y[keep, keep.lib.sizes = FALSE]
|
|
55
68
|
y <- calcNormFactors(y, method = "TMM")
|
|
56
69
|
#print (y)
|
|
57
|
-
calculate_DE_time_start <- Sys.time()
|
|
58
|
-
|
|
70
|
+
#calculate_DE_time_start <- Sys.time()
|
|
71
|
+
suppressWarnings({
|
|
72
|
+
suppressMessages({
|
|
73
|
+
dge <- estimateDisp(y = y)
|
|
74
|
+
})
|
|
75
|
+
})
|
|
59
76
|
et <- exactTest(object = dge)
|
|
60
77
|
calculate_DE_time_stop <- Sys.time()
|
|
61
|
-
print ("Time to calculate DE")
|
|
62
|
-
print (calculate_DE_time_stop - calculate_DE_time_start)
|
|
78
|
+
#print ("Time to calculate DE")
|
|
79
|
+
#print (calculate_DE_time_stop - calculate_DE_time_start)
|
|
63
80
|
#print (et)
|
|
64
81
|
logfc <- et$table$logFC
|
|
65
82
|
logcpm <- et$table$logCPM
|
|
@@ -76,11 +93,13 @@ names(output)[3] <- "fold_change"
|
|
|
76
93
|
names(output)[4] <- "original_p_value"
|
|
77
94
|
names(output)[5] <- "adjusted_p_value"
|
|
78
95
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
toJSON(output)
|
|
97
|
+
#output_json <- toJSON(output)
|
|
98
|
+
#print ("output_json")
|
|
99
|
+
#output_file <- paste0(input$output_path,"/r_output.txt")
|
|
100
|
+
#print (output_file)
|
|
101
|
+
#cat(output_json, file = output_file)
|
|
102
|
+
|
|
84
103
|
#top_degs = topTags(object = et, n = "Inf")
|
|
85
104
|
#print ("top_degs")
|
|
86
105
|
#print (top_degs)
|