summaryrefslogtreecommitdiff
path: root/Code
diff options
context:
space:
mode:
Diffstat (limited to 'Code')
-rw-r--r--Code/correlation_per_tissue.R2
-rw-r--r--Code/knn_classify.R1
2 files changed, 2 insertions, 1 deletions
diff --git a/Code/correlation_per_tissue.R b/Code/correlation_per_tissue.R
index d9aadf9..0a16d4f 100644
--- a/Code/correlation_per_tissue.R
+++ b/Code/correlation_per_tissue.R
@@ -77,7 +77,7 @@ for (ul in unique.label) {
X <- as.matrix(X0[, index.rnaseq])
sd.1 <- apply(X, 1, sd) # sd of each row
s0 <- apply(X, 1, function(c) sum(c==0)) # number of zeros in each row
- sd.tau <- (quantile(sd.1)[1] + quantile(sd.1)[2]) / 2.0 # min SD
+ sd.tau <- (quantile(sd.1, na.rm=TRUE)[1] + quantile(sd.1, na.rm=TRUE)[2]) / 2.0 # min SD
good <- sd.1 > max(sd.tau, 0.05)
tf_good <- which( good & (all_genes %in% tfs) == T )
target_good <- which( good & (all_genes %in% targets) == T )
diff --git a/Code/knn_classify.R b/Code/knn_classify.R
index 46df992..995ae7b 100644
--- a/Code/knn_classify.R
+++ b/Code/knn_classify.R
@@ -39,6 +39,7 @@ rowsum.tau <- dim(X)[2] # the gene's TPM value is at least 1 on average
sd.val <- apply(X, 1, sd)
sd.tau <- summary(sd.val)[3] # genes whose gene expression varies least are to be filtered
index <- rowSums(X) > rowsum.tau & sd.val > 10
+index[is.na(index)] <- FALSE
n.train <- dim(X)[2]
X.3 <- log(cbind(X[index,], X.2[index,]) + 1)