-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathReportPostAnalysis.1.Rmd
139 lines (99 loc) · 2.94 KB
/
ReportPostAnalysis.1.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
title: "PostAnalysis.specialPlots.Rmd"
author: "Bernd Jagla"
date: "11/28/2018"
output: html_document
code_folding: hide
---
```{r, echo=TRUE}
cat(file = stderr(), getwd())
require(shiny)
require(plotly)
require(shinythemes)
require(ggplot2)
require(DT)
require(pheatmap)
require(threejs)
require(sm)
require(RColorBrewer)
require(mclust)
require(reshape)
# require(cellrangerRkit)
# require(SCORPIUS)
require(ggplot2)
require(knitr)
require(kableExtra)
require(shinyWidgets)
require(scater)
source("serverFunctions.R")
source("reactives.R", local = TRUE)
```
```{r loadRDS, include=FALSE}
projectPath = "~/Desktop/"
```
```{r}
load(file = paste0(projectPath, "/sessionData.RData"))
input = myparams
```
```{r}
heatmapFile = 'hucellsenescence.png'
genesin <- c("h2afx,cdkn2a,cdkn1a")
```
```{r heatmap}
sampCol = sampleCols$colPal
ccols <- clusterCols$colPal
scEx_matrix <- as.matrix(assays(scEx_log)[[1]])
# genesin <- c("h2afx,cdkn2a,cdkn1a")
genesin2 <- geneName2Index(genesin, featuredata)
genesin = (paste0(featuredata[genesin2[which (genesin2 %in% rownames(scEx_matrix) )],"symbol"], collapse =",", sep=""))
heatmapData <- coE_heatmapFunc(
featureData = featuredata, scEx_matrix = scEx_matrix,
projections = projections, genesin = genesin, cells = colnames(scEx_matrix),
sampCol = sampCol, ccols = ccols
)
addColNames <- input$"coExpHeatmapModule-ColNames"
orderColNames <- input$"coExpHeatmapModule-orderNames"
moreOptions <- input$"coExpHeatmapModule-moreOptions"
addColNames = "sampleNames"
orderColNames = "sampleNames"
moreOptions = TRUE
proje <- projections
heatmapData$filename <- paste0(projectPath,"/", heatmapFile)
if (is.null(moreOptions)) moreOptions <- FALSE
if (length(addColNames) > 0 & moreOptions) {
heatmapData$annotation_col <- proje[rownames(heatmapData$annotation_col), addColNames, drop = FALSE]
}
if (sum(orderColNames %in% colnames(proje)) > 0 & moreOptions) {
heatmapData$cluster_cols <- FALSE
heatmapData$mat <- heatmapData$mat[, rownames(psych::dfOrder(proje, orderColNames)), drop = FALSE]
}
do.call(pheatmap, heatmapData)
```
```{r violinPlot}
featureData <- featuredata
# geneListStr <- input$coE_geneGrpVioIds
geneListStr = genesin
projectionVar <- input$coE_dimension_xVioiGrp
minExpr <- input$coEminExpr
sampCol = sampleCols$colPal
ccols <- clusterCols$colPal
retVal <- coE_geneGrp_vioFunc(
genesin = geneListStr,
projections = proje,
scEx = scEx_log,
featureData = featureData,
minExpr = minExpr,
dbCluster = projectionVar,
sampCol = sampCol,
ccols = ccols
)
retVal
genesin = geneListStr
genesin <- toupper(genesin)
genesin <- gsub(" ", "", genesin, fixed = TRUE)
genesin <- strsplit(genesin, ",")
map <-
rownames(featureData[which(featureData$symbol %in% genesin[[1]]), ])
expression <- Matrix::colSums(assays(scEx_log)[[1]][map, ] >= minExpr)
ttt=t(as.matrix(assays(scEx_log)[[1]][map, ]))
```