diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index d5561cd9..9afed5ef 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -48,7 +48,7 @@ jobs: needs: check - name: Build CMTK - if: ${{matrix.config.os != 'windows-latest'}} + if: ${{matrix.config.os == 'macos-latest'}} run: sh ./build-cmtk.sh env: CC: clang diff --git a/NAMESPACE b/NAMESPACE index bd32d4cf..d31831a3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -402,8 +402,6 @@ importFrom(igraph,"V<-") importFrom(igraph,E) importFrom(igraph,V) importFrom(igraph,add_edges) -importFrom(igraph,as.directed) -importFrom(igraph,as.undirected) importFrom(igraph,as_edgelist) importFrom(igraph,bfs) importFrom(igraph,decompose) diff --git a/R/alphashape3d.R b/R/alphashape3d.R index bdd67ec2..5ba2d7c0 100644 --- a/R/alphashape3d.R +++ b/R/alphashape3d.R @@ -15,7 +15,7 @@ #' \code{triang} entry in \bold{Value} section of #' \code{\link[alphashape3d]{ashape3d}} docs for details.) #' @return a \code{\link[rgl]{mesh3d}} object which can be plotted and -#' manipulated using \code{\link{rgl}} and \code{nat} packages. +#' manipulated using \code{rgl} and \code{nat} packages. #' @export #' #' @name as.mesh3d diff --git a/R/cmtk-reformat.R b/R/cmtk-reformat.R index 95a0e640..fd058441 100644 --- a/R/cmtk-reformat.R +++ b/R/cmtk-reformat.R @@ -87,7 +87,7 @@ cmtk.targetvolume.default <- function(target, ...) { } #' Reformat an image with a CMTK registration using the reformatx tool -#' +#' #' @details Note that if you are reformatting a mask then you will need to #' change the interpolation to "nn", since interpolating between e.g. mask #' levels 72 and 74 with 73 may have unintended consequences. Presently we @@ -97,37 +97,38 @@ cmtk.targetvolume.default <- function(target, ...) { #' @param registrations One or more CMTK format registrations on disk #' @param output The path to the output image (defaults to #' \code{"_.nrrd"}) -#' @param mask Whether to treat target as a binary mask (only reformatting +#' @param mask Whether to treat target as a binary mask (only reformatting #' positive voxels) -#' @param interpolation What interpolation scheme to use for output image +#' @param interpolation What interpolation scheme to use for output image #' (defaults to linear - see details) #' @param dryrun Just print command #' @param Verbose Whether to show cmtk status messages and be verbose about file #' update checks. Sets command line \code{--verbose} option. -#' @param MakeLock Whether to use a lock file to allow simple parallelisation -#' (see \code{makelock}) -#' @param OverWrite Whether to OverWrite an existing output file. One of -#' c("no","update","yes"). When OverWrite='update' -#' \code{\link{RunCmdForNewerInput}} is used to determine if the output is -#' older than any of the input files. -#' @param filesToIgnoreModTimes Input files whose modification time should not +#' @param MakeLock Whether to use a lock file to allow simple parallelisation +#' (see \code{\link[nat.utils]{makelock}}) +#' @param OverWrite Whether to OverWrite an existing output file. One of +#' c("no","update","yes"). When OverWrite='update' +#' \code{\link[nat.utils]{RunCmdForNewerInput}} is used to determine if the +#' output is older than any of the input files. +#' @param filesToIgnoreModTimes Input files whose modification time should not #' be checked when determining if new output is required. -#' @param ... additional arguments passed to CMTK \code{reformatx} after +#' @param ... additional arguments passed to CMTK \code{reformatx} after #' processing by \code{\link{cmtk.call}}. #' @inheritParams cmtk.targetvolume #' @inheritParams xformimage.cmtkreg #' @importFrom nat.utils makelock removelock RunCmdForNewerInput -#' @seealso \code{\link{cmtk.bindir}, \link{cmtk.call}, \link{makelock}, -#' \link{RunCmdForNewerInput}} +#' @seealso \code{\link{cmtk.bindir}}, \code{\link{cmtk.call}}, +#' \code{\link[nat.utils]{makelock}}, +#' \code{\link[nat.utils]{RunCmdForNewerInput}} #' @export -#' @return the path to the output image (whether or not it was re-created afresh) -#' or \code{NA_character_} if no output was possible. +#' @return the path to the output image (whether or not it was re-created +#' afresh) or \code{NA_character_} if no output was possible. #' @examples #' \dontrun{ #' cmtk.reformatx('myimage.nrrd', target='template.nrrd', #' registrations='template_myimage.list') -#' -#' # get full listing of command line options +#' +#' # get full listing of command line options #' system(cmtk.call('reformatx', help=TRUE)) #' } cmtk.reformatx<-function(floating, registrations, output, target, mask=FALSE, diff --git a/R/graph-nodes.R b/R/graph-nodes.R index b9d56cfc..b2c89ced 100644 --- a/R/graph-nodes.R +++ b/R/graph-nodes.R @@ -4,10 +4,10 @@ #' friends. It is conceived of as slightly lower level and end users would #' normally use the \code{rootpoints} methods. #' -#' \code{graph.nodes} should work for any \code{\link{igraph}} object +#' \code{graph.nodes} should work for any \code{\link[igraph]{igraph}} object #' (including \code{\link{ngraph}} objects, which inherit from \code{igraph}). #' However the graph must be directed in order to return a root point -#' @param x An \code{\link{ngraph}} or raw \code{\link{igraph}} object +#' @param x An \code{\link{ngraph}} or raw \code{\link[igraph]{igraph}} object #' @param type one of root, end (which includes root) or branch #' @param original.ids Use named attribute to return original vertex ids (when #' available). Set to FALSE when this is not desired. diff --git a/R/im3d.R b/R/im3d.R index caa9524b..44b0b674 100644 --- a/R/im3d.R +++ b/R/im3d.R @@ -419,7 +419,7 @@ boundingbox.character<-function(x, ...) { #' \code{\link{xyzmatrix}} method is defined including \code{matrix} or #' \code{data.frame} objects describing 3D points as well as specialised #' classes such as \code{\link{neuron}}, \code{\link{neuronlist}}, \code{rgl} -#' \code{\link{mesh3d}} objects. +#' \code{\link[rgl]{mesh3d}} objects. #' #' @export #' @rdname boundingbox diff --git a/R/interactive.R b/R/interactive.R index 7dbdfff4..5431703b 100644 --- a/R/interactive.R +++ b/R/interactive.R @@ -100,20 +100,26 @@ correct_root <- function(someneuronlist, brain = NULL){ #' @description Generate a mesh3d model based on points contained in a #' neuronlist or neuron object, or another object that consists of 3D points. #' -#' @param x a neuronlist or neuron object, or another object that consists of 3D points +#' @param x a neuronlist or neuron object, or another object that consists of 3D +#' points #' @param substrate whether to make the model based on the 3D location of -#' connectors, neuron cable or both. Connectors are pre-synapse locations, -#' e.g. the pre-synapses of a \code{catmaidneuron} from the R package \code{catmaid}) +#' connectors, neuron cable or both. Connectors are pre-synapse locations, +#' e.g. the pre-synapses of a \code{catmaidneuron} from the R package +#' \code{catmaid}) #' @param alpha a single value or vector of values for alpha, fed to #' \code{alphashape3d::ashape3d}. Selection is subsequently interactive. -#' @param auto.selection logical, whether or not to try and remove points based on interactively -#' choosing simple values for clustering. -#' @details Interactive function that allows a users to select points in 3D space from neuronlist/neuron objects, -#' or another object that is coercible in 3D points using \code{\link{xyzmatrix}}. Points can first be automatically chosen, by -#' selecting an integer number of nearest neighbours to find for each point using \code{nabor::\link{knn}}, and then a -#' maximum distance at which nodes can be part of a cluster. Next, \code{\link{select_points}} is used to manually pick desired 3D -#' points. Lastly, \code{alphashape3d::ashape3d} is used to create an alphashape around these points. The user can trial different values for -#' alpha until they get their desired result. +#' @param auto.selection logical, whether or not to try and remove points based +#' on interactively choosing simple values for clustering. +#' @details Interactive function that allows a users to select points in 3D +#' space from neuronlist/neuron objects, or another object that is coercible +#' in 3D points using \code{\link{xyzmatrix}}. Points can first be +#' automatically chosen, by selecting an integer number of nearest neighbours +#' to find for each point using \code{nabor::\link[nabor]{knn}}, and then a +#' maximum distance at which nodes can be part of a cluster. Next, +#' \code{\link{select_points}} is used to manually pick desired 3D points. +#' Lastly, \code{alphashape3d::ashape3d} is used to create an alphashape +#' around these points. The user can trial different values for alpha until +#' they get their desired result. #' @examples #' \dontrun{ #' # Make a model based off of fly olfactory projection neuron arbours diff --git a/R/nat-package.R b/R/nat-package.R index 53b89ada..d125530c 100644 --- a/R/nat-package.R +++ b/R/nat-package.R @@ -24,7 +24,7 @@ #' #' \code{neuron} objects containing connected trees can be converted to #' \code{\link{ngraph}} objects, a lightweight wrapper around the -#' \code{\link{igraph}} library's \code{\link[igraph]{graph}} class that +#' \code{\link[igraph]{igraph}} library's \code{\link[igraph]{graph}} class that #' preserves 3D coordinate information. This allows neurons to be manipulated #' based on their graph structure, e.g. by finding all nodes upstream (closer #' to the root) or downstream of a given node. The \code{\link{as.neuron}} @@ -47,7 +47,7 @@ #' \code{\link{plot3d.neuronlist}} and \code{\link{subset.neuronlist}}). #' Interactive 3D selection of neurons in a neuronlist is also possible using #' \code{\link{find.neuron}} (which makes use of \code{rgl}'s -#' \code{\link{select3d}} function. +#' \code{\link[rgl]{select3d}} function. #' #' \code{neuronlist} objects also provide additional functionality to #' streamline arithmetic (e.g. scaling all the points in all neurons see @@ -165,7 +165,7 @@ #' @seealso \code{\link{neuron}}, \code{\link{dotprops}}, #' \code{\link{neuronlist}}, \code{\link{nlapply}}, \code{\link[nat]{plot3d}}, #' \code{\link{xform}}, \code{\link{im3d}}, \code{\link{read.hxsurf}}, -#' \code{\link{rgl}} which is used for visualisation, +#' \code{\link[rgl]{rgl}} which is used for visualisation, #' \code{\link{fileformats}}, \code{\link{read.neurons}}, \code{\link{cmtk}}. #' @keywords package #' @import rgl graphics grDevices utils diff --git a/R/ndigest.R b/R/ndigest.R index 21ee01b3..d51c80bd 100644 --- a/R/ndigest.R +++ b/R/ndigest.R @@ -7,12 +7,12 @@ #' machine on which the digest is being computed. #' @param x Object for which a normalised digest will be computed. #' @param ... Additional arguments passed to methods and then on to -#' \code{\link{digest}} +#' \code{\link[digest]{digest}} #' @return A character string containing the digest of the supplied object -#' computed by \code{\link{digest}}. +#' computed by \code{\link[digest]{digest}}. #' @export #' @importFrom digest digest -#' @seealso \code{\link{digest}} +#' @seealso \code{\link[digest]{digest}} ndigest<-function(x, ...) UseMethod('ndigest') #' @details \code{ndigest.neuronlistfh} only considers the \code{keyfilemap} and diff --git a/R/neuron-io-amira.R b/R/neuron-io-amira.R index c49a705c..8e395f29 100644 --- a/R/neuron-io-amira.R +++ b/R/neuron-io-amira.R @@ -1,5 +1,4 @@ # read neurons in the format produced by Amira skeletonize plugin -#' @importFrom igraph as.undirected read.neuron.hxskel<-function(file, ...){ ndata=read.amiramesh(file) required_fields=c("Coordinates", "NeighbourCount", "Radii", "NeighbourList") @@ -40,7 +39,7 @@ read.neuron.hxskel<-function(file, ...){ doubleg=ngraph(el, d$PointNo, directed=TRUE) # TODO see if we can make appropriate directed graph rather than converting # to undirected. - ug=as.undirected(doubleg, mode='collapse') + ug=as_undirected_nat(doubleg, mode='collapse') if(!inherits(ug,'ngraph')) class(ug)=c("ngraph",class(ug)) n=as.neuron(ug, vertexData=d, origin=Origin, InputFileName=file, ... ) n diff --git a/R/neuron-plot.R b/R/neuron-plot.R index a32a428c..12c8121d 100644 --- a/R/neuron-plot.R +++ b/R/neuron-plot.R @@ -254,11 +254,12 @@ NULL #' Note that sometimes (parts of) objects seem to disappear after panning and #' zooming. See help for \code{\link{pan3d}}. #' -#' \code{\link{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have quite +#' \code{\link[rgl]{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have quite #' different models for how to handle the active plot. \code{nopen3d} and #' \code{\link{nclear3d}} allow you to treat them more similarly. Use them -#' wherever you use the rgl \code{clear3d} and \code{open3d} commands and your -#' could she be able to run with both \bold{plotly} or \bold{rgl} as the +#' wherever you use the rgl \code{\link[rgl]{clear3d}} and +#' \code{\link[rgl]{open3d}} commands and your +#' code should be able to run with both \bold{plotly} or \bold{rgl} as the #' \code{plotengine}. #' #' @param bgcol background colour @@ -266,7 +267,7 @@ NULL #' @param ... additional options passed to open3d #' @return current rgl device #' @export -#' @seealso \code{\link{open3d},\link{pan3d}}, \code{\link{nclear3d}} +#' @seealso \code{\link[rgl]{open3d}, \link{pan3d}}, \code{\link{nclear3d}} nopen3d<- function(bgcol='white', FOV=0, ...){ res=open3d(mouseMode=c("trackball", "user", "zoom", "pull"), FOV=FOV, ...) bg3d(col=bgcol) @@ -282,7 +283,7 @@ nopen3d<- function(bgcol='white', FOV=0, ...){ #' @param extramat An optional extra transformation matrix to be applied after #' the one implied by the viewpoint argument. #' @param ... additional arguments passed to \code{\link[rgl]{par3d}} -#' @seealso \code{\link{nopen3d}}, \code{\link{view3d}} +#' @seealso \code{\link{nopen3d}}, \code{\link[rgl]{view3d}} #' @export #' @importFrom rgl rotationMatrix scaleMatrix par3d #' @examples @@ -319,17 +320,17 @@ nview3d <- function(viewpoint=c("frontal", "anterior", "dorsal", "ventral", } #' Some useful extensions / changes to rgl defaults -#' +#' #' Set up pan call back for current rgl device -#' +#' #' Copied verbatim from ?rgl.setMouseCallbacks for rgl version 0.92.892 Mouse #' button 2 is right and button 3 is middle (accessed by Meta/Alt key) -#' -#' Note that sometimes (parts of) objects seem to disappear after panning and -#' zooming. The example in \code{\link{rgl.setMouseCallbacks}} from which this -#' is copied includes a note that "this doesn't play well with rescaling" +#' +#' Note that sometimes (parts of) objects seem to disappear after panning and +#' zooming. The example in \code{\link[rgl]{rgl.setMouseCallbacks}} from which +#' this is copied includes a note that "this doesn't play well with rescaling" #' @param button Integer from 1 to 3 indicating mouse button -#' @seealso \code{\link{rgl.setMouseCallbacks}} +#' @seealso \code{\link[rgl]{rgl.setMouseCallbacks}} #' @author Duncan Murdoch #' @export #' @examples @@ -599,7 +600,7 @@ plot3d.boundingbox <- function(x, col='black', #' Clear the rgl or plotly 3D scene #' -#' @details \code{\link{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have +#' @details \code{\link[rgl]{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have #' quite different models for how to handle the active plot. \code{nclear3d} #' and \code{\link{nopen3d}} allow you to treat them more similarly. Use them #' wherever you use the rgl \code{clear3d} and \code{open3d} commands and your @@ -649,12 +650,11 @@ check_plotengine <- function(plotengine) { #' Plot 3d representation of neuron (ngraph) with directed edges #' #' @param x A \code{\link{ngraph}} object -#' @param type They type of arrows (lines by default, see \code{\link{arrow3d}} -#' for details). +#' @param type They type of arrows (lines by default, see +#' \code{\link[rgl]{arrow3d}} for details). #' @param soma radius of soma (or \code{FALSE} to suppress plotting) -#' @param labels Whether to label nodes/all points with their raw index (not -#' id) -#' @param ... Additional arguments passed to \code{\link{arrow3d}} +#' @param labels Whether to label nodes/all points with their raw index (not id) +#' @param ... Additional arguments passed to \code{\link[rgl]{arrow3d}} #' #' @export #' diff --git a/R/neuron.R b/R/neuron.R index 0324183f..add792e9 100644 --- a/R/neuron.R +++ b/R/neuron.R @@ -73,7 +73,8 @@ #' plot(as.neuron(gstem)) #' #' # but if you had an undirected graph -#' ug=igraph::as.undirected(gstem) +#' if(utils::packageVersion('igraph')>='2.1.0') { +#' ug=igraph::as_undirected(gstem) #' # you get a warning because there is no explicit origin for the graph #' as.neuron(ug) #' @@ -81,6 +82,7 @@ #' gstem2=as.ngraph(ug, root = 10) #' plot(gstem2) #' plot(as.neuron(gstem2)) +#' } neuron<-function(d, NumPoints=nrow(d), StartPoint, BranchPoints=integer(), EndPoints, SegList, SubTrees=NULL, InputFileName=NULL, NeuronName=NULL, ..., MD5=TRUE){get @@ -208,7 +210,7 @@ normalise_swc<-function(x, requiredColumns=c('PointNo','Label','X','Y','Z','W',' #' @export #' @importFrom igraph V V<- vcount decompose #' @rdname neuron -#' @seealso \code{\link{dfs}, \link{as.seglist}} +#' @seealso \code{\link[igraph]{dfs}, \link{as.seglist}} as.neuron.ngraph<-function(x, vertexData=NULL, origin=NULL, Verbose=FALSE, ...){ # translate origin into raw vertex id if necessary if(length(origin)){ diff --git a/R/neuronlist.R b/R/neuronlist.R index c7644c8f..6ca3f012 100644 --- a/R/neuronlist.R +++ b/R/neuronlist.R @@ -396,13 +396,14 @@ as.data.frame.neuronlist<-function(x, row.names = names(x), optional = FALSE, .. #' overridden for the current session by setting the value of #' \code{options(nat.progressbar)} (see examples). Values of \code{T} and #' \code{F} are aliases for 'text' and 'none', respectively. -#' +#' #' @section Progress bar: There are currently two supported approaches to #' defining progress bars for \code{nlapply}. The default (when #' \code{progress="auto"}) now uses a progress bar built using -#' \code{\link{progress_bar}} from the progress package, which can be highly -#' customised. The alternative is to use the progress bars distributed -#' directly with the \code{plyr} package such as \code{\link{progress_text}}. +#' \code{\link[progress]{progress_bar}} from the progress package, which can +#' be highly customised. The alternative is to use the progress bars +#' distributed directly with the \code{plyr} package such as +#' \code{\link[plyr]{progress_text}}. #' #' In either case the value of the \code{.progress} argument must be a #' character vector which names a function. According to \code{plyr}'s @@ -526,7 +527,7 @@ nlapply<-function (X, FUN, ..., subset=NULL, OmitFailures=NA, #' @export #' @rdname nlapply #' @description \code{progress_natprogress} provides a progress bar compatible -#' with the \code{progress::\link{progress_bar}}. +#' with the \code{progress::\link[progress]{progress_bar}}. progress_natprogress <- function(...) { pb <- NULL list( diff --git a/R/neuronlist_interactive_3d.R b/R/neuronlist_interactive_3d.R index be1488ec..bd6166e1 100644 --- a/R/neuronlist_interactive_3d.R +++ b/R/neuronlist_interactive_3d.R @@ -1,21 +1,22 @@ #' Find neurons within a 3D selection box (usually drawn in rgl window) -#' -#' @details Uses \code{\link{subset.neuronlist}}, so can work on dotprops or +#' +#' @details Uses \code{\link{subset.neuronlist}}, so can work on dotprops or #' neuron lists. -#' @param sel3dfun A \code{\link{select3d}} style function to indicate if points -#' are within region +#' @param sel3dfun A \code{\link[rgl]{select3d}} style function to indicate if +#' points are within region #' @param indices Names of neurons to search (defaults to all neurons in list) -#' @param db \code{neuronlist} to search. Can also be a character vector naming +#' @param db \code{neuronlist} to search. Can also be a character vector naming #' the neuronlist. Defaults to \code{options('nat.default.neuronlist')}. #' @param threshold More than this many points must be present in region -#' @param invert Whether to return neurons outside the selection box (default +#' @param invert Whether to return neurons outside the selection box (default #' \code{FALSE}) #' @param rval What to return (character vector, default='names') -#' -#' @return Character vector of names of selected neurons, neuronlist, or +#' +#' @return Character vector of names of selected neurons, neuronlist, or #' data.frame of attached metadata according to the value of \code{rval}. #' @export -#' @seealso \code{\link{select3d}, \link{find.soma}, \link{subset.neuronlist}} +#' @seealso \code{\link[rgl]{select3d}, \link{find.soma}, +#' \link{subset.neuronlist}} #' @examples #' \dontrun{ #' plot3d(kcs20) @@ -25,7 +26,7 @@ #' # make a standalone selection function #' vertical_lobe=select3d() #' find.neuron(vertical_lobe, db=kcs20) -#' # use base::Negate function to invert the selection function +#' # use base::Negate function to invert the selection function #' # i.e. choose neurons that do not overlap the selection region #' find.neuron(Negate(vertical_lobe), db=kcs20) #' } @@ -49,14 +50,15 @@ find.neuron<-function(sel3dfun=select3d(), indices=names(db), } #' Find neurons with soma inside 3D selection box (usually drawn in rgl window) -#' -#' @details Can work on \code{neuronlist}s containing \code{neuron} objects -#' \emph{or} \code{neuronlist}s whose attached data.frame contains soma +#' +#' @details Can work on \code{neuronlist}s containing \code{neuron} objects +#' \emph{or} \code{neuronlist}s whose attached data.frame contains soma #' positions specified in columns called X,Y,Z . #' @inheritParams find.neuron #' @return Character vector of names of selected neurons #' @export -#' @seealso \code{\link{select3d}, \link{subset.neuronlist}, \link{find.neuron}} +#' @seealso \code{\link[rgl]{select3d}, \link{subset.neuronlist}, +#' \link{find.neuron}} find.soma <- function (sel3dfun = select3d(), indices = names(db), db = getOption("nat.default.neuronlist"), invert=FALSE, diff --git a/R/neuronlistfh.R b/R/neuronlistfh.R index fc1e955f..cdf671c9 100644 --- a/R/neuronlistfh.R +++ b/R/neuronlistfh.R @@ -117,7 +117,7 @@ #' occupying only a few GB) on NFS network file systems or Google Drive, #' neither of which are keen on having many files especially in the same #' folder. It does not allow updates from a remote location. See -#' \code{\link{filehashDB1-class}} for more details. +#' \code{\link[filehash]{filehashDB1-class}} for more details. #' #' Note that objects are stored in a filehash, which by definition does not #' have any ordering of its elements. However neuronlist objects (like lists) diff --git a/R/ngraph.R b/R/ngraph.R index 4e856d77..ab9d3805 100644 --- a/R/ngraph.R +++ b/R/ngraph.R @@ -1,3 +1,19 @@ +# local functions to handle deprecated functions in igraph >= 2.1.0 +make_graph_nat <- function(...) { + pvi <- packageVersion('igraph') + if(pvi>='2.1.0') igraph::make_graph(...) else igraph::graph(...) +} + +as_directed_nat <- function(...) { + pvi <- packageVersion('igraph') + if(pvi>='2.1.0') igraph::as_directed(...) else igraph::as.directed(...) +} + +as_undirected_nat <- function(...) { + pvi <- packageVersion('igraph') + if(pvi>='2.1.0') igraph::as_undirected(...) else igraph::as.undirected(...) +} + #' ngraph: a graph to encode a neuron's connectivity #' #' @description the \code{ngraph} class contains a (completely general) graph @@ -55,7 +71,7 @@ #' vertex for each entry in vertexnames, each vertex having a \code{label} #' attribute. All vertices are included whether connected or not. #' @family neuron -#' @seealso \code{\link{igraph}}, \code{\link[igraph]{set_vertex_attr}}, +#' @seealso \code{\link[igraph]{igraph}}, \code{\link[igraph]{set_vertex_attr}}, #' \code{\link{subset.neuron}} for example of graph-based manipulation of a #' neuron, \code{\link{plot3d.ngraph}} #' @export @@ -97,7 +113,7 @@ ngraph<-function(el, vertexnames, xyz=NULL, diam=NULL, directed=TRUE, vecs=xyz[stops, , drop=FALSE] - xyz[starts, , drop=FALSE] weights=sqrt(rowSums(vecs*vecs)) } - g=igraph::graph(rawel, n=length(vertexnames), directed=directed) + g=make_graph_nat(rawel, n=length(vertexnames), directed=directed) igraph::V(g)$name=vertexnames if(is.numeric(weights)) igraph::E(g)$weight=weights @@ -155,13 +171,12 @@ as.ngraph.neuron<-function(x, directed=TRUE, method=c('swc','seglist'), ...){ } } -#' @importFrom igraph as.undirected as.directed #' @export as.ngraph.igraph<-function(x, directed=TRUE, root, mode=c('out','in'), ...){ if(inherits(x,'ngraph')) if(igraph::is_directed(x)==directed) return(x) - if(igraph::is_directed(x) && !directed) x=as.undirected(x, ...) + if(igraph::is_directed(x) && !directed) x=as_undirected_nat(x, ...) else if(!igraph::is_directed(x) && directed) x=as.directed.usingroot(x, root, mode=mode, ...) if(!inherits(x,'ngraph')){ @@ -174,7 +189,7 @@ as.directed.usingroot<-function(g, root, mode=c('out','in')){ mode=match.arg(mode) # make a directed graph _keeping any attributes_ if(!igraph::is_directed(g)) - dg=igraph::as.directed(g, mode='arbitrary') + dg=as_directed_nat(g, mode='arbitrary') else dg=g dfs=igraph::dfs(dg, root, unreachable=FALSE, dist=TRUE, mode='all') el=igraph::as_edgelist(dg) diff --git a/R/seglist.R b/R/seglist.R index a07bb33a..c6d2eaf8 100644 --- a/R/seglist.R +++ b/R/seglist.R @@ -90,7 +90,7 @@ as.seglist.default<-function(x, ...) stop("Not yet implemented!") #' @param origin The origin of the tree (see details) #' @param Verbose Whether to print progress updates to console (default FALSE) #' @return a \code{list} with one entry for each unbranched segment. -#' @seealso \code{\link{ngraph},\link{igraph}} +#' @seealso \code{\link{ngraph},\link[igraph]{igraph}} #' @export #' @importFrom igraph is_directed is_connected dfs degree #' @rdname seglist diff --git a/inst/WORDLIST b/inst/WORDLIST index f9ca653b..0eae04c2 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -6,6 +6,7 @@ AxisDirections BoundingBox BranchPoints CATMAID +CMD CMTK CMTK's Cachero @@ -72,6 +73,7 @@ Nx Ny Nz OO +ORCID Obermayer OmitFailures OuterRegion @@ -87,13 +89,12 @@ RLE RStudio RegionChoice RegionChoices -RegionColourList -RegionList Reroot Rmd Rohlfing Rtools Rvcg +SNT SWC SWCData SWCs @@ -129,7 +130,6 @@ amiramesh arg args ashape -attr autonames bindir boundingbox @@ -142,7 +142,6 @@ cmtkreg color colors colpal -com commandline connectomics coord @@ -159,9 +158,7 @@ devtools df dfc dfs -dir dof -doi donttest dotprops dplyr @@ -185,7 +182,6 @@ filetype flybrain flybrains flycircuit -fninf frulhns getformatreader getformatwriter @@ -240,7 +236,6 @@ ndigest neurite neurodebian neuroglancer -neuroimage neuroml neuronformats neuronlist @@ -249,10 +244,8 @@ neuronlistfh neuronlists ngraph nhdr -nitrc nl nlapply -nlevels nlscan nmapply nn @@ -266,7 +259,6 @@ nrrds nvertices nview obj -org outfile params plotengine @@ -286,6 +278,7 @@ reglist reglists regs remotesync +rerooting rgl rgl's rm @@ -316,7 +309,6 @@ subarray subdir subdirs subgraphs -sumsegment swc targetvolume tarmat @@ -345,7 +337,6 @@ warpfile webGL webgl winbuilder -www xform xform's xformimage @@ -359,5 +350,4 @@ xyzmatrix xyzpos yml zenodo -zlim µm diff --git a/man/as.mesh3d.Rd b/man/as.mesh3d.Rd index a2c7871d..916a0303 100644 --- a/man/as.mesh3d.Rd +++ b/man/as.mesh3d.Rd @@ -31,7 +31,7 @@ object} } \value{ a \code{\link[rgl]{mesh3d}} object which can be plotted and - manipulated using \code{\link{rgl}} and \code{nat} packages. + manipulated using \code{rgl} and \code{nat} packages. } \description{ \code{as.mesh3d.ashape3d} converts an diff --git a/man/boundingbox.Rd b/man/boundingbox.Rd index 850899ff..d274e39e 100644 --- a/man/boundingbox.Rd +++ b/man/boundingbox.Rd @@ -71,7 +71,7 @@ The bounding box is defined as the position of the voxels at the two \code{\link{xyzmatrix}} method is defined including \code{matrix} or \code{data.frame} objects describing 3D points as well as specialised classes such as \code{\link{neuron}}, \code{\link{neuronlist}}, \code{rgl} - \code{\link{mesh3d}} objects. + \code{\link[rgl]{mesh3d}} objects. } \examples{ # bounding box for a neuron diff --git a/man/cmtk.reformatx.Rd b/man/cmtk.reformatx.Rd index b4e6f80b..bb881842 100644 --- a/man/cmtk.reformatx.Rd +++ b/man/cmtk.reformatx.Rd @@ -32,14 +32,14 @@ cmtk.reformatx( \code{im3d} object (or an object that can be coerced to im3d) or a 6-or 9-vector defining a grid in the form Nx,Ny,Nz,dX,dY,dZ,[Ox,Oy,Oz].} -\item{mask}{Whether to treat target as a binary mask (only reformatting +\item{mask}{Whether to treat target as a binary mask (only reformatting positive voxels)} \item{direction}{Whether to transform image from sample space to reference space (called \strong{forward} by CMTK) or from reference to sample space (called \strong{inverse} by CMTK). Default (when \code{NULL} is forward).} -\item{interpolation}{What interpolation scheme to use for output image +\item{interpolation}{What interpolation scheme to use for output image (defaults to linear - see details)} \item{dryrun}{Just print command} @@ -47,23 +47,23 @@ space (called \strong{forward} by CMTK) or from reference to sample space \item{Verbose}{Whether to show cmtk status messages and be verbose about file update checks. Sets command line \code{--verbose} option.} -\item{MakeLock}{Whether to use a lock file to allow simple parallelisation -(see \code{makelock})} +\item{MakeLock}{Whether to use a lock file to allow simple parallelisation +(see \code{\link[nat.utils]{makelock}})} -\item{OverWrite}{Whether to OverWrite an existing output file. One of -c("no","update","yes"). When OverWrite='update' -\code{\link{RunCmdForNewerInput}} is used to determine if the output is -older than any of the input files.} +\item{OverWrite}{Whether to OverWrite an existing output file. One of +c("no","update","yes"). When OverWrite='update' +\code{\link[nat.utils]{RunCmdForNewerInput}} is used to determine if the +output is older than any of the input files.} -\item{filesToIgnoreModTimes}{Input files whose modification time should not +\item{filesToIgnoreModTimes}{Input files whose modification time should not be checked when determining if new output is required.} -\item{...}{additional arguments passed to CMTK \code{reformatx} after +\item{...}{additional arguments passed to CMTK \code{reformatx} after processing by \code{\link{cmtk.call}}.} } \value{ -the path to the output image (whether or not it was re-created afresh) - or \code{NA_character_} if no output was possible. +the path to the output image (whether or not it was re-created + afresh) or \code{NA_character_} if no output was possible. } \description{ Reformat an image with a CMTK registration using the reformatx tool @@ -80,11 +80,12 @@ Note that if you are reformatting a mask then you will need to cmtk.reformatx('myimage.nrrd', target='template.nrrd', registrations='template_myimage.list') -# get full listing of command line options +# get full listing of command line options system(cmtk.call('reformatx', help=TRUE)) } } \seealso{ -\code{\link{cmtk.bindir}, \link{cmtk.call}, \link{makelock}, - \link{RunCmdForNewerInput}} +\code{\link{cmtk.bindir}}, \code{\link{cmtk.call}}, + \code{\link[nat.utils]{makelock}}, + \code{\link[nat.utils]{RunCmdForNewerInput}} } diff --git a/man/find.neuron.Rd b/man/find.neuron.Rd index 65b4e508..72517cbb 100644 --- a/man/find.neuron.Rd +++ b/man/find.neuron.Rd @@ -14,30 +14,30 @@ find.neuron( ) } \arguments{ -\item{sel3dfun}{A \code{\link{select3d}} style function to indicate if points -are within region} +\item{sel3dfun}{A \code{\link[rgl]{select3d}} style function to indicate if +points are within region} \item{indices}{Names of neurons to search (defaults to all neurons in list)} -\item{db}{\code{neuronlist} to search. Can also be a character vector naming +\item{db}{\code{neuronlist} to search. Can also be a character vector naming the neuronlist. Defaults to \code{options('nat.default.neuronlist')}.} \item{threshold}{More than this many points must be present in region} -\item{invert}{Whether to return neurons outside the selection box (default +\item{invert}{Whether to return neurons outside the selection box (default \code{FALSE})} \item{rval}{What to return (character vector, default='names')} } \value{ -Character vector of names of selected neurons, neuronlist, or +Character vector of names of selected neurons, neuronlist, or data.frame of attached metadata according to the value of \code{rval}. } \description{ Find neurons within a 3D selection box (usually drawn in rgl window) } \details{ -Uses \code{\link{subset.neuronlist}}, so can work on dotprops or +Uses \code{\link{subset.neuronlist}}, so can work on dotprops or neuron lists. } \examples{ @@ -49,11 +49,12 @@ find.neuron(db=kcs20) # make a standalone selection function vertical_lobe=select3d() find.neuron(vertical_lobe, db=kcs20) -# use base::Negate function to invert the selection function +# use base::Negate function to invert the selection function # i.e. choose neurons that do not overlap the selection region find.neuron(Negate(vertical_lobe), db=kcs20) } } \seealso{ -\code{\link{select3d}, \link{find.soma}, \link{subset.neuronlist}} +\code{\link[rgl]{select3d}, \link{find.soma}, + \link{subset.neuronlist}} } diff --git a/man/find.soma.Rd b/man/find.soma.Rd index 5adaf776..8480b821 100644 --- a/man/find.soma.Rd +++ b/man/find.soma.Rd @@ -13,15 +13,15 @@ find.soma( ) } \arguments{ -\item{sel3dfun}{A \code{\link{select3d}} style function to indicate if points -are within region} +\item{sel3dfun}{A \code{\link[rgl]{select3d}} style function to indicate if +points are within region} \item{indices}{Names of neurons to search (defaults to all neurons in list)} -\item{db}{\code{neuronlist} to search. Can also be a character vector naming +\item{db}{\code{neuronlist} to search. Can also be a character vector naming the neuronlist. Defaults to \code{options('nat.default.neuronlist')}.} -\item{invert}{Whether to return neurons outside the selection box (default +\item{invert}{Whether to return neurons outside the selection box (default \code{FALSE})} \item{rval}{What to return (character vector, default='names')} @@ -33,10 +33,11 @@ Character vector of names of selected neurons Find neurons with soma inside 3D selection box (usually drawn in rgl window) } \details{ -Can work on \code{neuronlist}s containing \code{neuron} objects - \emph{or} \code{neuronlist}s whose attached data.frame contains soma +Can work on \code{neuronlist}s containing \code{neuron} objects + \emph{or} \code{neuronlist}s whose attached data.frame contains soma positions specified in columns called X,Y,Z . } \seealso{ -\code{\link{select3d}, \link{subset.neuronlist}, \link{find.neuron}} +\code{\link[rgl]{select3d}, \link{subset.neuronlist}, + \link{find.neuron}} } diff --git a/man/graph.nodes.Rd b/man/graph.nodes.Rd index 024c1111..47bc255b 100644 --- a/man/graph.nodes.Rd +++ b/man/graph.nodes.Rd @@ -12,7 +12,7 @@ graph.nodes( ) } \arguments{ -\item{x}{An \code{\link{ngraph}} or raw \code{\link{igraph}} object} +\item{x}{An \code{\link{ngraph}} or raw \code{\link[igraph]{igraph}} object} \item{type}{one of root, end (which includes root) or branch} @@ -30,7 +30,7 @@ This function underlies \code{\link{rootpoints.igraph}} methods and friends. It is conceived of as slightly lower level and end users would normally use the \code{rootpoints} methods. - \code{graph.nodes} should work for any \code{\link{igraph}} object + \code{graph.nodes} should work for any \code{\link[igraph]{igraph}} object (including \code{\link{ngraph}} objects, which inherit from \code{igraph}). However the graph must be directed in order to return a root point } diff --git a/man/make_model.Rd b/man/make_model.Rd index 9208eb80..c988021f 100644 --- a/man/make_model.Rd +++ b/man/make_model.Rd @@ -12,17 +12,19 @@ make_model( ) } \arguments{ -\item{x}{a neuronlist or neuron object, or another object that consists of 3D points} +\item{x}{a neuronlist or neuron object, or another object that consists of 3D +points} \item{substrate}{whether to make the model based on the 3D location of -connectors, neuron cable or both. Connectors are pre-synapse locations, -e.g. the pre-synapses of a \code{catmaidneuron} from the R package \code{catmaid})} +connectors, neuron cable or both. Connectors are pre-synapse locations, +e.g. the pre-synapses of a \code{catmaidneuron} from the R package +\code{catmaid})} \item{alpha}{a single value or vector of values for alpha, fed to \code{alphashape3d::ashape3d}. Selection is subsequently interactive.} -\item{auto.selection}{logical, whether or not to try and remove points based on interactively -choosing simple values for clustering.} +\item{auto.selection}{logical, whether or not to try and remove points based +on interactively choosing simple values for clustering.} } \value{ A mesh3d object @@ -32,12 +34,16 @@ Generate a mesh3d model based on points contained in a neuronlist or neuron object, or another object that consists of 3D points. } \details{ -Interactive function that allows a users to select points in 3D space from neuronlist/neuron objects, -or another object that is coercible in 3D points using \code{\link{xyzmatrix}}. Points can first be automatically chosen, by -selecting an integer number of nearest neighbours to find for each point using \code{nabor::\link{knn}}, and then a -maximum distance at which nodes can be part of a cluster. Next, \code{\link{select_points}} is used to manually pick desired 3D -points. Lastly, \code{alphashape3d::ashape3d} is used to create an alphashape around these points. The user can trial different values for -alpha until they get their desired result. +Interactive function that allows a users to select points in 3D + space from neuronlist/neuron objects, or another object that is coercible + in 3D points using \code{\link{xyzmatrix}}. Points can first be + automatically chosen, by selecting an integer number of nearest neighbours + to find for each point using \code{nabor::\link[nabor]{knn}}, and then a + maximum distance at which nodes can be part of a cluster. Next, + \code{\link{select_points}} is used to manually pick desired 3D points. + Lastly, \code{alphashape3d::ashape3d} is used to create an alphashape + around these points. The user can trial different values for alpha until + they get their desired result. } \examples{ \dontrun{ diff --git a/man/nat-package.Rd b/man/nat-package.Rd index e9581d0a..795f6ddb 100644 --- a/man/nat-package.Rd +++ b/man/nat-package.Rd @@ -32,7 +32,7 @@ neuroanatomical data, especially representations of neurons. \code{neuron} objects containing connected trees can be converted to \code{\link{ngraph}} objects, a lightweight wrapper around the - \code{\link{igraph}} library's \code{\link[igraph]{graph}} class that + \code{\link[igraph]{igraph}} library's \code{\link[igraph]{graph}} class that preserves 3D coordinate information. This allows neurons to be manipulated based on their graph structure, e.g. by finding all nodes upstream (closer to the root) or downstream of a given node. The \code{\link{as.neuron}} @@ -57,7 +57,7 @@ neuroanatomical data, especially representations of neurons. \code{\link{plot3d.neuronlist}} and \code{\link{subset.neuronlist}}). Interactive 3D selection of neurons in a neuronlist is also possible using \code{\link{find.neuron}} (which makes use of \code{rgl}'s - \code{\link{select3d}} function. + \code{\link[rgl]{select3d}} function. \code{neuronlist} objects also provide additional functionality to streamline arithmetic (e.g. scaling all the points in all neurons see @@ -190,7 +190,7 @@ neuroanatomical data, especially representations of neurons. \code{\link{neuron}}, \code{\link{dotprops}}, \code{\link{neuronlist}}, \code{\link{nlapply}}, \code{\link[nat]{plot3d}}, \code{\link{xform}}, \code{\link{im3d}}, \code{\link{read.hxsurf}}, - \code{\link{rgl}} which is used for visualisation, + \code{\link[rgl]{rgl}} which is used for visualisation, \code{\link{fileformats}}, \code{\link{read.neurons}}, \code{\link{cmtk}}. } \author{ diff --git a/man/nclear3d.Rd b/man/nclear3d.Rd index d108ff9d..b779b7c0 100644 --- a/man/nclear3d.Rd +++ b/man/nclear3d.Rd @@ -17,7 +17,7 @@ nclear3d(..., plotengine = getOption("nat.plotengine")) Clear the rgl or plotly 3D scene } \details{ -\code{\link{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have +\code{\link[rgl]{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have quite different models for how to handle the active plot. \code{nclear3d} and \code{\link{nopen3d}} allow you to treat them more similarly. Use them wherever you use the rgl \code{clear3d} and \code{open3d} commands and your diff --git a/man/ndigest.Rd b/man/ndigest.Rd index 4ccd148e..3a5817bb 100644 --- a/man/ndigest.Rd +++ b/man/ndigest.Rd @@ -24,7 +24,7 @@ ndigest(x, ...) \item{x}{Object for which a normalised digest will be computed.} \item{...}{Additional arguments passed to methods and then on to -\code{\link{digest}}} +\code{\link[digest]{digest}}} \item{absoluteVectors}{Whether to check only the absolute value of eigenvectors for equality (default TRUE, see details)} @@ -33,7 +33,7 @@ eigenvectors for equality (default TRUE, see details)} } \value{ A character string containing the digest of the supplied object - computed by \code{\link{digest}}. + computed by \code{\link[digest]{digest}}. } \description{ The \emph{normalised} digest should exclude any fields or @@ -74,7 +74,7 @@ The \emph{normalised} digest should exclude any fields or stopifnot(all.equal(ndigest(kcs20[[1]]), "4c045b0343938259cd9986494fc1c2b0")) } \seealso{ -\code{\link{digest}} +\code{\link[digest]{digest}} \code{\link{all.equal.dotprops}} diff --git a/man/neuron.Rd b/man/neuron.Rd index 7b6af9b9..6babeeb5 100644 --- a/man/neuron.Rd +++ b/man/neuron.Rd @@ -166,7 +166,8 @@ plot(gstem) plot(as.neuron(gstem)) # but if you had an undirected graph -ug=igraph::as.undirected(gstem) +if(utils::packageVersion('igraph')>='2.1.0') { +ug=igraph::as_undirected(gstem) # you get a warning because there is no explicit origin for the graph as.neuron(ug) @@ -175,10 +176,11 @@ gstem2=as.ngraph(ug, root = 10) plot(gstem2) plot(as.neuron(gstem2)) } +} \seealso{ \code{\link{neuronlist}} -\code{\link{dfs}, \link{as.seglist}} +\code{\link[igraph]{dfs}, \link{as.seglist}} Other neuron: \code{\link{ngraph}()}, diff --git a/man/neuronlistfh.Rd b/man/neuronlistfh.Rd index b96af11c..a578f353 100644 --- a/man/neuronlistfh.Rd +++ b/man/neuronlistfh.Rd @@ -199,7 +199,7 @@ a \code{neuronlistfh} object which is a character \code{vector} with occupying only a few GB) on NFS network file systems or Google Drive, neither of which are keen on having many files especially in the same folder. It does not allow updates from a remote location. See - \code{\link{filehashDB1-class}} for more details. + \code{\link[filehash]{filehashDB1-class}} for more details. Note that objects are stored in a filehash, which by definition does not have any ordering of its elements. However neuronlist objects (like lists) diff --git a/man/ngraph.Rd b/man/ngraph.Rd index be9772c4..f568634b 100644 --- a/man/ngraph.Rd +++ b/man/ngraph.Rd @@ -135,7 +135,7 @@ plot(gw_spine, col='red', boundingbox=boundingbox(n)) plot(gw_antispine, col='blue', add=TRUE) } \seealso{ -\code{\link{igraph}}, \code{\link[igraph]{set_vertex_attr}}, +\code{\link[igraph]{igraph}}, \code{\link[igraph]{set_vertex_attr}}, \code{\link{subset.neuron}} for example of graph-based manipulation of a neuron, \code{\link{plot3d.ngraph}} diff --git a/man/nlapply.Rd b/man/nlapply.Rd index 9339702c..9e5524d9 100644 --- a/man/nlapply.Rd +++ b/man/nlapply.Rd @@ -72,7 +72,7 @@ Versions of lapply and mapply that look after the class and bars and simple parallelisation (see plyr section and examples). \code{progress_natprogress} provides a progress bar compatible - with the \code{progress::\link{progress_bar}}. + with the \code{progress::\link[progress]{progress_bar}}. } \details{ When \code{OmitFailures} is not \code{NA}, \code{FUN} will be @@ -118,9 +118,10 @@ When \code{OmitFailures} is not \code{NA}, \code{FUN} will be There are currently two supported approaches to defining progress bars for \code{nlapply}. The default (when \code{progress="auto"}) now uses a progress bar built using - \code{\link{progress_bar}} from the progress package, which can be highly - customised. The alternative is to use the progress bars distributed - directly with the \code{plyr} package such as \code{\link{progress_text}}. + \code{\link[progress]{progress_bar}} from the progress package, which can + be highly customised. The alternative is to use the progress bars + distributed directly with the \code{plyr} package such as + \code{\link[plyr]{progress_text}}. In either case the value of the \code{.progress} argument must be a character vector which names a function. According to \code{plyr}'s diff --git a/man/nopen3d.Rd b/man/nopen3d.Rd index 3cca95c6..bd731612 100644 --- a/man/nopen3d.Rd +++ b/man/nopen3d.Rd @@ -28,13 +28,14 @@ Pan with right button (Ctrl+click), zoom with middle Note that sometimes (parts of) objects seem to disappear after panning and zooming. See help for \code{\link{pan3d}}. - \code{\link{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have quite + \code{\link[rgl]{rgl}} and \code{\link[plotly:plot_ly]{plotly}} have quite different models for how to handle the active plot. \code{nopen3d} and \code{\link{nclear3d}} allow you to treat them more similarly. Use them - wherever you use the rgl \code{clear3d} and \code{open3d} commands and your - could she be able to run with both \bold{plotly} or \bold{rgl} as the + wherever you use the rgl \code{\link[rgl]{clear3d}} and + \code{\link[rgl]{open3d}} commands and your + code should be able to run with both \bold{plotly} or \bold{rgl} as the \code{plotengine}. } \seealso{ -\code{\link{open3d},\link{pan3d}}, \code{\link{nclear3d}} +\code{\link[rgl]{open3d}, \link{pan3d}}, \code{\link{nclear3d}} } diff --git a/man/nview3d.Rd b/man/nview3d.Rd index ea61f970..4b3a78ca 100644 --- a/man/nview3d.Rd +++ b/man/nview3d.Rd @@ -39,5 +39,5 @@ nview3d('frontal', extramat=rotationMatrix(pi/10, 1, 1, 0)) } } \seealso{ -\code{\link{nopen3d}}, \code{\link{view3d}} +\code{\link{nopen3d}}, \code{\link[rgl]{view3d}} } diff --git a/man/pan3d.Rd b/man/pan3d.Rd index 71d86f6e..26ba0ca5 100644 --- a/man/pan3d.Rd +++ b/man/pan3d.Rd @@ -16,9 +16,9 @@ Set up pan call back for current rgl device Copied verbatim from ?rgl.setMouseCallbacks for rgl version 0.92.892 Mouse button 2 is right and button 3 is middle (accessed by Meta/Alt key) -Note that sometimes (parts of) objects seem to disappear after panning and -zooming. The example in \code{\link{rgl.setMouseCallbacks}} from which this -is copied includes a note that "this doesn't play well with rescaling" +Note that sometimes (parts of) objects seem to disappear after panning and +zooming. The example in \code{\link[rgl]{rgl.setMouseCallbacks}} from which +this is copied includes a note that "this doesn't play well with rescaling" } \examples{ \dontrun{ @@ -27,7 +27,7 @@ is copied includes a note that "this doesn't play well with rescaling" } } \seealso{ -\code{\link{rgl.setMouseCallbacks}} +\code{\link[rgl]{rgl.setMouseCallbacks}} } \author{ Duncan Murdoch diff --git a/man/plot3d.ngraph.Rd b/man/plot3d.ngraph.Rd index e1660daa..8ce137cd 100644 --- a/man/plot3d.ngraph.Rd +++ b/man/plot3d.ngraph.Rd @@ -9,15 +9,14 @@ \arguments{ \item{x}{A \code{\link{ngraph}} object} -\item{type}{They type of arrows (lines by default, see \code{\link{arrow3d}} -for details).} +\item{type}{They type of arrows (lines by default, see +\code{\link[rgl]{arrow3d}} for details).} \item{soma}{radius of soma (or \code{FALSE} to suppress plotting)} -\item{labels}{Whether to label nodes/all points with their raw index (not -id)} +\item{labels}{Whether to label nodes/all points with their raw index (not id)} -\item{...}{Additional arguments passed to \code{\link{arrow3d}}} +\item{...}{Additional arguments passed to \code{\link[rgl]{arrow3d}}} } \description{ Plot 3d representation of neuron (ngraph) with directed edges diff --git a/man/seglist.Rd b/man/seglist.Rd index c0600d74..dce33dd1 100644 --- a/man/seglist.Rd +++ b/man/seglist.Rd @@ -66,5 +66,5 @@ sl=seglist(c(1:2),c(2:6)) \seealso{ \code{\link{neuron}} -\code{\link{ngraph},\link{igraph}} +\code{\link{ngraph},\link[igraph]{igraph}} } diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R new file mode 100644 index 00000000..f6643203 --- /dev/null +++ b/tests/testthat/setup.R @@ -0,0 +1,6 @@ +setup({ + ff=dir(test_path('testdata'), pattern = '\\.swc\\.txt$', + recursive = T, full.names = T) + ffnew=sub("\\.txt$","",ff) + file.copy(ff, ffnew) +}) diff --git a/tests/testthat/teardown.R b/tests/testthat/teardown.R index fd8ca8d5..28155c28 100644 --- a/tests/testthat/teardown.R +++ b/tests/testthat/teardown.R @@ -3,3 +3,9 @@ pdf_path = test_path('Rplots.pdf') # check for write permission if(isTRUE(file.access(pdf_path, mode = 2)==0)) file.remove(pdf_path) + +ffnew=dir(test_path('testdata'), pattern = '\\.swc$', recursive = T, + full.names = T) +if(isTRUE(all(file.access(ffnew, mode = 2)==0))) { + file.remove(ffnew) +} diff --git a/tests/testthat/test-neuroml-io.R b/tests/testthat/test-neuroml-io.R index 12ff2087..43baeda9 100644 --- a/tests/testthat/test-neuroml-io.R +++ b/tests/testthat/test-neuroml-io.R @@ -46,7 +46,9 @@ test_that("parse neuroml files", { }) test_that("is.neuroml", { - ff=dir(c("testdata/neuroml","testdata/neuroml2"), full.names = T, recursive = T) + ff=dir(c("testdata/neuroml","testdata/neuroml2"), + full.names = T, recursive = T, pattern = '\\.(swc|xml)$') + notswc=tools::file_ext(ff)!="swc" expect_equivalent(is.neuroml(ff), notswc) }) diff --git a/tests/testthat/test-neuron-mesh.R b/tests/testthat/test-neuron-mesh.R index ef0829bf..6161bb65 100644 --- a/tests/testthat/test-neuron-mesh.R +++ b/tests/testthat/test-neuron-mesh.R @@ -7,7 +7,7 @@ setup(dir.create(td)) teardown(unlink(td, recursive = TRUE)) test_that("read/write works", { - expect_silent(ff1 <- write.neurons(bl, dir=td, format='ply')) + ff1 <- write.neurons(bl, dir=td, format='ply') md5.1=tools::md5sum(ff1) expect_warning(ff2 <- write.neurons(bl, dir=td, Force=TRUE), regexp = 'ply') md5.2=tools::md5sum(ff2) @@ -35,7 +35,7 @@ setup(dir.create(td2)) teardown(unlink(td2, recursive = TRUE)) test_that("read/write works with obj files", { - expect_silent(ff1 <- write.neurons(bl, dir=td2, format='obj')) + ff1 <- write.neurons(bl, dir=td2, format='obj') expect_is(bl2 <- read.neurons(td2), 'neuronlist') expect_equal(summary(bl), summary(bl2)) expect_error(write.neurons(Cell07PNs[1:3], format = 'obj')) diff --git a/tests/testthat/test-ngraph.R b/tests/testthat/test-ngraph.R index 1806e585..a441e9ce 100644 --- a/tests/testthat/test-ngraph.R +++ b/tests/testthat/test-ngraph.R @@ -175,7 +175,7 @@ test_that("we can find the segmentgraph of a neuron",{ testn=as.neuron(testd) expect_is(sg<-segmentgraph(testn), 'igraph') - baseline=graph(c(1,2,2,3,2,4), directed=TRUE) + baseline=make_graph_nat(c(1,2,2,3,2,4), directed=TRUE) expect_true(graph.isomorphic(sg, baseline)) expect_equal(E(sg)$weight, c(2, 2, 1)) @@ -202,7 +202,7 @@ test_that("we can find the segmentgraph of a neuron",{ test_that("as.ngraph can convert undirected graph into an ngraph object",{ g1=as.ngraph(testd) - expect_is(g2<-as.ngraph(as.undirected(g1), root = rootpoints(g1)), 'ngraph') + expect_is(g2<-as.ngraph(as_undirected_nat(g1), root = rootpoints(g1)), 'ngraph') expect_true(graph.isomorphic(g1,g2)) }) diff --git a/tests/testthat/test-seglist.R b/tests/testthat/test-seglist.R index a8d51a73..db71a029 100644 --- a/tests/testthat/test-seglist.R +++ b/tests/testthat/test-seglist.R @@ -7,7 +7,7 @@ test_that("make a seglist directly",{ test_that("convert graph to seglist",{ # simple linear graph - g=graph(c(1, 2, 2, 3)) + g=make_graph_nat(c(1, 2, 2, 3)) sl=seglist(c(1, 2, 3)) expect_is(sl,'seglist') expect_equal(as.seglist(g), sl) @@ -59,7 +59,7 @@ test_that("convert graph to seglist",{ sl=seglist(c(1,2),c(2,3),c(2,4),c(2,5,6,7)) expect_equal(as.seglist(g),sl) # undirected equivalent - nb origin must be specified - expect_equal(as.seglist(as.undirected(g),origin=1),sl) + expect_equal(as.seglist(as_undirected_nat(g),origin=1),sl) # rapid branching g=graph(c(1,2, 2,3, 2,4, 4,5, 4,6)) diff --git a/tests/testthat/testdata/neuroml/level1/CablesIncluded.swc b/tests/testthat/testdata/neuroml/level1/CablesIncluded.swc.txt similarity index 100% rename from tests/testthat/testdata/neuroml/level1/CablesIncluded.swc rename to tests/testthat/testdata/neuroml/level1/CablesIncluded.swc.txt diff --git a/tests/testthat/testdata/neuroml/level1/Simple.morph.swc b/tests/testthat/testdata/neuroml/level1/Simple.morph.swc.txt similarity index 100% rename from tests/testthat/testdata/neuroml/level1/Simple.morph.swc rename to tests/testthat/testdata/neuroml/level1/Simple.morph.swc.txt diff --git a/tests/testthat/testdata/neuron/EBT7R.CNG.swc b/tests/testthat/testdata/neuron/EBT7R.CNG.swc.txt old mode 100755 new mode 100644 similarity index 100% rename from tests/testthat/testdata/neuron/EBT7R.CNG.swc rename to tests/testthat/testdata/neuron/EBT7R.CNG.swc.txt diff --git a/tests/testthat/testdata/neuron/EBT7R.am b/tests/testthat/testdata/neuron/EBT7R.am old mode 100755 new mode 100644 diff --git a/tests/testthat/testdata/neuron/XT6L2.CNG.swc b/tests/testthat/testdata/neuron/XT6L2.CNG.swc.txt old mode 100755 new mode 100644 similarity index 100% rename from tests/testthat/testdata/neuron/XT6L2.CNG.swc rename to tests/testthat/testdata/neuron/XT6L2.CNG.swc.txt diff --git a/tests/testthat/testdata/neuron/unfitted.swc b/tests/testthat/testdata/neuron/unfitted.swc.txt similarity index 100% rename from tests/testthat/testdata/neuron/unfitted.swc rename to tests/testthat/testdata/neuron/unfitted.swc.txt