Skip to contents

To load data recipe(s) into R environment.

Usage

recipeLoad(
  rcp = c(),
  cachePath = "ReUseDataRecipe",
  env = .GlobalEnv,
  return = TRUE
)

Arguments

rcp

The (vector of) character string of recipe name or file path (recipeNames() or mcols()$fpath column of the recipeHub object returned from recipeSearch).

cachePath

A character string for the recipe cache. Must match the one specified in recipeUpdate(). Default is "ReUseDataRecipe".

env

The R environment to export to. Default is .GlobalEnv.

return

Whether to return the recipe to a user-assigned R object. Default is TRUE, where user need to assign a variable name to the recipe. e.g., rcp1 <- recipeLoad(). If FALSE, it loads the recipe and uses its original name, and user doesn't need to assign a new name. e.g., recipeLoad(return=TRUE). If multiple recipes are to be loaded, return=FALSE must be used.

Value

A data recipe of cwlProcess S4 class, which is ready to be evaluated in R.

Examples

########################
## Load single recipe
########################

library(Rcwl)
#> Loading required package: yaml
#> Loading required package: S4Vectors
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> 
#> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:stats’:
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’:
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#>     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#>     pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
#>     tapply, union, unique, unsplit, which.max, which.min
#> 
#> Attaching package: ‘S4Vectors’
#> The following object is masked from ‘package:utils’:
#> 
#>     findMatches
#> The following objects are masked from ‘package:base’:
#> 
#>     I, expand.grid, unname
recipeUpdate()
#> Updating recipes...
#> 
#> recipeHub with 15 records
#> cache path:  /home/qhu/.cache/R/ReUseDataRecipe 
#> # recipeSearch() to query specific recipes using multipe keywords
#> # recipeUpdate() to update the local recipe cache
#> 
#>            name               
#>   BFC466 | bowtie2_index      
#>   BFC467 | echo_out           
#>   BFC468 | ensembl_liftover   
#>   BFC469 | gcp_broad_gatk_hg19
#>   BFC470 | gcp_broad_gatk_hg38
#>   ...      ...                
#>   BFC476 | hisat2_index       
#>   BFC477 | reference_genome   
#>   BFC478 | salmon_index       
#>   BFC479 | STAR_index         
#>   BFC480 | ucsc_database      
recipeSearch("liftover")
#> recipeHub with 1 records
#> cache path:  /home/qhu/.cache/R/ReUseDataRecipe 
#> # recipeSearch() to query specific recipes using multipe keywords
#> # recipeUpdate() to update the local recipe cache
#> 
#>            name            
#>   BFC468 | ensembl_liftover
rcp <- recipeLoad("ensembl_liftover")
#> Note: you need to assign a name for the recipe: rcpName <- recipeLoad('xx')
#> Data recipe loaded!
#> Use inputs() to check required input parameters before evaluation.
#> Check here: https://rcwl.org/dataRecipes/ensembl_liftover.html
#> for user instructions (e.g., eligible input values, data source, etc.)
Rcwl::inputs(rcp)
#> inputs:
#>   species (species)  (string):  
#>   from (from)  (string):  
#>   to (to)  (string):  
rm(rcp)

gencode_annotation <- recipeLoad("gencode_annotation")
#> Note: you need to assign a name for the recipe: rcpName <- recipeLoad('xx')
#> Data recipe loaded!
#> Use inputs() to check required input parameters before evaluation.
#> Check here: https://rcwl.org/dataRecipes/gencode_annotation.html
#> for user instructions (e.g., eligible input values, data source, etc.)
inputs(gencode_annotation)
#> inputs:
#>   species (species)  (string):  
#>   version (version)  (string):  
rm(gencode_annotation)

#########################
## Load multiple recipes
#########################

rcphub <- recipeSearch("gencode")
recipeNames(rcphub)
#> [1] "gencode_annotation"    "gencode_genome_grch38" "gencode_transcripts"  
recipeLoad(recipeNames(rcphub), return=FALSE)
#> Data recipe loaded!
#> Use inputs(gencode_annotation) to check required input parameters before evaluation.
#> Check here: https://rcwl.org/dataRecipes/gencode_annotation.html
#> for user instructions (e.g., eligible input values, data source, etc.)
#> Data recipe loaded!
#> Use inputs(gencode_genome_grch38) to check required input parameters before evaluation.
#> Check here: https://rcwl.org/dataRecipes/gencode_genome_grch38.html
#> for user instructions (e.g., eligible input values, data source, etc.)
#> Data recipe loaded!
#> Use inputs(gencode_transcripts) to check required input parameters before evaluation.
#> Check here: https://rcwl.org/dataRecipes/gencode_transcripts.html
#> for user instructions (e.g., eligible input values, data source, etc.)
inputs(gencode_transcripts)
#> inputs:
#>   species (species)  (string):  
#>   version (version)  (string):