-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFigure S6C - Tumour PKN2KO Score.R
41 lines (29 loc) · 1.27 KB
/
Figure S6C - Tumour PKN2KO Score.R
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
# Aims:
# - Calculate the PKN2KO Signature score for the mouse pancreatic tumours to confirm signature
# - Save data for later plotting in graphpad
## Preparation ----
#Required data are loaded
#This is the normalised count data from the pancreatic tumours (Figure S5)
tumNorm <- read.csv("./Data/InVivo Tumour Normalised Count Matrix.csv", stringsAsFactors = FALSE, row.names = 1)
#This is the PKN2-KO signature from the paper (Figure 6D)
PKN2KOSig <- read.csv("./Data/PKN2KO Signature.csv", stringsAsFactors = FALSE)$mouse_ensembl_gene_id
##Calculate Zscore function ----
#A simple function to return the per-gene z-scores for a count matrix
calculateZScore <- function(reads){
#Transposes the matrix as scale likes to work on columns
reads <- t(reads)
zScores <- reads #Copies the size of the matrix
#Goes through each column and scales it separately
zScores <- apply(reads, 2, scale)
zScores <- t(zScores)
colnames(zScores) <- row.names(reads)
return(zScores)
}
##Calculating the score ----
#The important genes are extracted
tumPKN2Sig <- tumNorm[PKN2KOSig, ]
tumPKN2SigZ <- calculateZScore(tumPKN2Sig)
finalScore <- colSums(tumPKN2SigZ)
#Saving data ----
#saving the data for later plotting in graphpad
write.csv(finalScore, "./Data/InVivo Tumour PKN2KOSig Score.csv")