summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Lan <lanhui@zjnu.edu.cn>2022-11-20 20:53:44 +0800
committerHui Lan <lanhui@zjnu.edu.cn>2022-11-20 20:53:44 +0800
commitd42ed749e13ce6e9c6a1dd67bc7c6569b34ce35b (patch)
treea143c35d0255e38003619e10fbb104002566a19c
parentfc7c809c2d0bc3de120c3836d2800b271f9be607 (diff)
Fix the following errors while running create_edges0B.py
~/brain/Code$ python3 update_rnaseq_info_json.py Error in library(Rtsne) : there is no package called ‘Rtsne’ ~/brain/Code$ Rscript correlation_per_tissue.R Error in quantile.default(sd.1) : missing values and NaN's not allowed if 'na.rm' is FALSE
-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)