BiocProject: Portable Encapsulated Project (PEP) for biological...

View source: R/functions.R

BiocProjectR Documentation

Portable Encapsulated Project (PEP) for biological applications

Description

This function creates a Project-class object, and executes the user provided function with the created object as a first argument.

If the custom data processing function returns an object of class other than Annotated-class, the output will be packaged in a List-class with a metadata slot populated with the Project-class.

Usage

BiocProject(
  file,
  amendments = NULL,
  autoLoad = TRUE,
  func = NULL,
  funcArgs = NULL
)

Arguments

file

a character vector with a path to the PEP config file

amendments

a character vector with a name of the amendments to be activated

autoLoad

a logical indicating whether the data should be loaded automatically. See Details for more information.

func

a anonymous function that reads and/or processes the data, it must take the Project-class as an argument. See Details for more information

funcArgs

a named list with arguments you want to pass to the func. The PEP will be passed automatically, but if provided regardless, the constructor will disregard it. You can also pass the arguments in a funcArgs section within the bioconductor section in the config file.

Details

This BiocProject function provides some degree of flexibility in your custom data processing function usage and implementation. Consider the possibilities listed below:

  • use a function loaded into the R environment and specified in the config slot in Project-class (specifically: config(project)$bioconductor$readFunName).

  • use a function not loaded into the R environment and specified in the config slot in Project (specifically: config(project)$bioconductor$readFunPath).

  • use a function from other R package not loaded into the R environment and specified in the config slot in Project (specifically: config(project)$bioconductor$readFunName), like: pkgName::functionName

  • use a function implemented in the BiocProject call (passed to the func argument - anonymous function). This option is given the top priority and overrides other arguments if provided.

The custom data processing function must take the Project-class as an argument since this object will be passed to the function by default. However, if the function requires additional arguments, ones can be provided with the funcArgs argument in the BiocProject function call. Besides, the func argument with the anonymous function may serve similar possibility.

If the autoLoad is set to FALSE the data will not be loaded and empty Project-class object will be returned.

Value

an object of Annotated-class that is returned by the user provided function with the Project-class object inserted into the first element of the list in its medatada slot

Further reading

Browse the BiocProject package vignettes for more detailed explanation with examples.

Note

The bioconductor section can be read from the project config file or pipeline interface. The former is given the priority

See Also

https://pepkit.github.io/

Examples

projectConfig = system.file("extdata", "example_peps-master",
"example_BiocProject", "project_config.yaml", package="BiocProject")
bp=BiocProject(projectConfig)

bp

metadata(bp)


pepkit/BiocProject documentation built on July 28, 2023, 2:49 p.m.