Use Tool to get tool data. If no additional arguments are provided, will return a vector with the names of tools in the object.

Tool(object, ...)

Tool(object, ...) <- value

# S3 method for Seurat
Tool(object, slot = NULL, ...)

# S3 method for Seurat
Tool(object, ...) <- value

Arguments

object

An object

...

Arguments passed to other methods

value

Information to be added to tool list

slot

Name of tool to pull

Value

If no additional arguments, returns the names of the tools in the object; otherwise returns the data placed by the tool requested

Note

For developers: set tool data using Tool<-. Tool<- will automatically set the name of the tool to the function that called Tool<-, so each function gets one entry in the tools list and cannot overwrite another function's entry. The automatic naming will also remove any method identifiers (eg. RunPCA.Seurat will become RunPCA); please plan accordingly

Examples

# Example function that adds unstructured data to tools
MyTool <- function(object) {
  sample.tool.output <- matrix(rnorm(n = 16), nrow = 4)
  # Note: `Tool<-` must be called from within a function
  # and the name of the tool will be generated from the function name
  Tool(object) <- sample.tool.output
  return(object)
}

# Run our tool
set.seed(42L)
pbmc_small <- MyTool(pbmc_small)

# Get a list of tools run
Tool(pbmc_small)
#> [1] "MyTool"

# Access specific tool data
Tool(pbmc_small, slot = "MyTool")
#>            [,1]        [,2]       [,3]       [,4]
#> [1,]  1.3709584  0.40426832  2.0184237 -1.3888607
#> [2,] -0.5646982 -0.10612452 -0.0627141 -0.2787888
#> [3,]  0.3631284  1.51152200  1.3048697 -0.1333213
#> [4,]  0.6328626 -0.09465904  2.2866454  0.6359504