Skip to content

Commit

Permalink
Merge branch 'develop' into feat/check_nn.name
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaveazure committed Mar 4, 2021
2 parents 2d41550 + 29e5018 commit 4fdde35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 11 additions & 3 deletions R/clustering.R
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ FindNeighbors.default <- function(
message("Computing nearest neighbors")
} else {
message("Computing nearest neighbor graph")
}
}
}
nn.ranked <- NNHelper(
data = object,
Expand Down Expand Up @@ -713,6 +713,11 @@ FindNeighbors.dist <- function(
#' @param do.plot Plot SNN graph on tSNE coordinates
#' @param graph.name Optional naming parameter for stored (S)NN graph
#' (or Neighbor object, if return.neighbor = TRUE). Default is assay.name_(s)nn.
#' To store both the neighbor graph and the shared nearest neighbor (SNN) graph,
#' you must supply a vector containing two names to the \code{graph.name}
#' parameter. The first element in the vector will be used to store the nearest
#' neighbor (NN) graph, and the second element used to store the SNN graph. If
#' only one name is supplied, only the NN graph is stored.
#'
#' @importFrom igraph graph.adjacency plot.igraph E
#'
Expand Down Expand Up @@ -791,12 +796,15 @@ FindNeighbors.Seurat <- function(
if (length(x = neighbor.graphs) == 1) {
neighbor.graphs <- list(nn = neighbor.graphs)
}
graph.name <- graph.name %||%
if (return.neighbor) {
graph.name <- graph.name %||%
if (return.neighbor) {
paste0(assay, ".", names(x = neighbor.graphs))
} else {
paste0(assay, "_", names(x = neighbor.graphs))
}
if (length(x = graph.name) == 1) {
message("Only one graph name supplied, storing nearest-neighbor graph only")
}
for (ii in 1:length(x = graph.name)) {
if (inherits(x = neighbor.graphs[[ii]], what = "Graph")) {
DefaultAssay(object = neighbor.graphs[[ii]]) <- assay
Expand Down
7 changes: 6 additions & 1 deletion man/FindNeighbors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4fdde35

Please sign in to comment.