diff --git a/R/transformation.R b/R/transformation.R index 1761628..0dedc78 100644 --- a/R/transformation.R +++ b/R/transformation.R @@ -175,19 +175,23 @@ allreg_dataframe<-function(regdirs=getOption('nat.templatebrains.regdirs')) { #' @param reciprocal Sets the weight of reciprocal edges in the graph (and #' thereby whether inverse registrations will be considered). #' @inheritParams allreg_dataframe -#' @seealso \code{\link{allreg_dataframe}} +#' @seealso \code{\link{allreg_dataframe}}, \code{\link{xform_brain}} #' @export #' @importFrom igraph E E<- graph.edgelist #' @examples #' \dontrun{ +#' plot(bridging_graph(), vertex.size=25, edge.arrow.size=0.5) +#' # with reciprocal edges #' plot(bridging_graph(reciprocal=3), vertex.size=25) -#' # the same including -#' plot(bridging_graph(), vertex.size=25) #' } bridging_graph <- function(regdirs=getOption('nat.templatebrains.regdirs'), reciprocal=NA) { df=allreg_dataframe(regdirs) if(nrow(df)==0) return(NULL) # just keep the bridging registrations + + if(!is.na(reciprocal) && (!is.numeric(reciprocal) || !is.finite(reciprocal))) + stop("reciprocal must be NA or specify the weight for reverse edges!") + df=df[df$bridge & !df$dup,] el=as.matrix(df[,c("sample","reference")]) if(is.na(reciprocal)){ diff --git a/man/shortest_bridging_seq.Rd b/man/shortest_bridging_seq.Rd index fe908ae..17a54f9 100644 --- a/man/shortest_bridging_seq.Rd +++ b/man/shortest_bridging_seq.Rd @@ -62,9 +62,9 @@ When \code{reciprocal != NA} we create a graph where each forward } \examples{ \dontrun{ +plot(bridging_graph(), vertex.size=25, edge.arrow.size=0.5) +# with reciprocal edges plot(bridging_graph(reciprocal=3), vertex.size=25) -# the same including -plot(bridging_graph(), vertex.size=25) } \dontrun{ shortest_bridging_seq(FCWB, IS2) @@ -73,5 +73,5 @@ shortest_bridging_seq('FCWB', 'IS2') } } \seealso{ -\code{\link{allreg_dataframe}} +\code{\link{allreg_dataframe}}, \code{\link{xform_brain}} }