-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchk_input.R
executable file
·59 lines (39 loc) · 1.19 KB
/
chk_input.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Date: March 2nd 2020
# Author: Vijender Chaitankar
# Contributors: Vijender Chaitankar
# Technical Summary: Check input for:
# 1. Genes with low or no expression are filtered
# 2. Log transformation
# Reference: Fehrmann, Rudolf SN, et al. "Gene expression analysis identifies
# global gene dosage sensitivity in cancer." Nature genetics 47.2 (2015): 115.
# Input: Log transformed gene expression matrix filtered for low-expression
# Output: FGM profiles which is a pair-wise correlation matrix of genes
chk_input <- function (expr.data) {
ckh.input <- FALSE
max.val <- max(expr.data)
gene.means <- rowMeans(expr.data)
num.means.zero <- length(which(gene.means == 0))
if (num.means.zero > 0) {
ckh.input <- FALSE
} else {
ckh.input <- TRUE
}
num.means.low <- length(which(gene.means < 1))
ratio.num.means.low <- length(num.means.low)/length(gene.means)
if (ratio.num.means.low > 0.05) {
ckh.input <- FALSE
} else {
ckh.input <- TRUE
}
if (num.means.zero > 0) {
ckh.input <- FALSE
} else {
ckh.input <- TRUE
}
if (max.val <= 20) {
ckh.input <- TRUE
} else {
ckh.input <- FALSE
}
return(ckh.input)
}