@sjcrh/proteinpaint-server 2.24.1 → 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/utils/cuminc.R CHANGED
@@ -13,13 +13,15 @@
13
13
 
14
14
  # Input JSON:
15
15
  # {
16
- # chartId: [
17
- # {
18
- # time: time to event
19
- # event: event code (0 = censored, 1 = event, 2 = competing risk event)
20
- # series: series ID
21
- # }
22
- # ]
16
+ # data:
17
+ # chartId: [
18
+ # {
19
+ # time: time to event
20
+ # event: event code (0 = censored, 1 = event, 2 = competing risk event)
21
+ # series: series ID
22
+ # }
23
+ # ],
24
+ # startTime: custom start time of cuminc curve
23
25
  # }
24
26
  #
25
27
  # Output JSON:
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(input$matrix, method = "euclidean") # Transposing the matrix
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(input$matrix), method = "euclidean") # Transposing the matrix
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 <- input$matrix[RowDend$order, ColumnDend$order]
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