You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/tSpace.R
+21-10Lines changed: 21 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -29,10 +29,11 @@
29
29
#' 'both' calculates pca and umap
30
30
#' @param seed an integer specifying seed for set.seed function in order to have reproducible umap
31
31
#' @param core_no and integer specifying number of cores for parallelization, check how many cores your machine has and adjust accordingly
32
-
#' @return tSpace returns a list of objects: 1. ts_file: a data frame of pca and/or umap embbedings of trajectory space matrix and input data,
33
-
#' 2. pca_tspace and/or umap_tspace: pca and/or UMAP objects. pca object contians all the outputs of pca analysis,
32
+
#' @return tSpace returns a list of objects: 1. **ts_file**: a data frame of pca and/or umap embbedings of trajectory space matrix and input data,
33
+
#' 2. pca_tspace and/or **umap_tspace**: pca and/or UMAP objects. pca object contians all the outputs of pca analysis,
34
34
#' umap contians all the outputs of the umap analysis, see \code{\link[umap:umap]{umap}}
35
-
#' 3. tspace_matrix: trajectory space matrix with calculated distances
35
+
#' 3. **tspace_matrix**: trajectory space matrix with calculated distances. In case negative distances are calculated during knn graph computation, these will be aproximated to zero
36
+
#' for trajectory inference completion, and reported in an object **negative_distances**, and a message will be reported in console.
@@ -103,10 +104,8 @@ tSpace <- function(df, K = 20, L = NULL, D = 'pearson_correlation', graph = 5,
103
104
# In addition user can see which cells are involved in negative values pairs and can examine them.
104
105
105
106
if(min(knn) <0){
106
-
warning(paste0("\nSome cell-cell pairs have negative distances. \nIn order for this analysis to proceed, these distances will be aproximated to zero. \nIf substantial number of cells exhibit negative distances\nplease check the original data and examine which cells are causing the issue. \nSome of these cells may be just noise and should be removed"))
107
-
knn[which(knn[,3] <0), ]
108
-
}
109
-
if(min(knn) <0){
107
+
cat(paste0("\nSome cell-cell pairs have negative distances. \nIn order for this analysis to proceed, these distances will be aproximated to zero. \nIf substantial number of cells exhibit negative distances\nplease check the original data and examine which cells are causing the issue. \nSome of these cells may be just noise and should be removed"))
108
+
negative.distance<-knn[which(knn[,3] <0), ]
110
109
knn[which(knn[,3] <0), 3] <-0
111
110
}
112
111
@@ -176,7 +175,11 @@ tSpace <- function(df, K = 20, L = NULL, D = 'pearson_correlation', graph = 5,
0 commit comments