Learn R Programming

W4MRUtils

  • VERSION: 1.0.0

W4MRUtils is a R packages provided by W4M to ease galaxy tools writing. It contains some utility functions that will help you in common tasks.

Parameters

  • Parsing parameters with parse_args (easier)
  • Parsing parameters with optparse_parameters (better)
  • Enforce checking on parameters with check_param_type_n_length

R script chores

  • Silently load a package with shy_lib
  • Sourcing relative file with source_local

Galaxy

  • Am I in a galaxy env? see in_galaxy_env
  • Show log headers with show_galaxy_header
  • Show log footer with show_galaxy_footer
  • Execute a function with run_galaxy_processing
  • Restore parameters names, modified by galaxy with unmangle_galaxy_param

Logfiles

  • What is a logger? - See logging section what-is-a-logger)
  • How to create a logger? - See logging section how-to-create-a-logger)
  • How to create a log file? - See logging section how-to-create-a-log-file)

TODO

Do the documentation and the referencing of the documentation for:

  • stock_id
  • reproduce_id
  • check_err
  • match2
  • match3
  • import2
  • import3
  • df_is
  • df_force_numeric
  • df_read_table

Installation

You can install the development version of W4MRUtils like so:

$ git clone https://github.com/workflow4metabolomics/W4MRUtils
$ cd W4MRUtils

then

$ make install

or

> rmarkdown::render("README.Rmd")
> devtools::document(".")
> roxygen2::roxygenize(".")
> devtools::test(".")
> devtools::install(".", dependencies = FALSE, repos = NULL, type = "source")

or

$ R -q -e "install.packages('W4MRUtils', repos='https://cran.irsn.fr');"

Uninstallation

You can uninstall the version of W4MRUtils you installed with:

$ make remove_package

or

> remove.packages("W4MRUtils")

XML Wrapper

Please follow the guidelines during the redaction of the xml wrapper.

Read the doc in case of problems.

Copy Link

Version

Install

install.packages('W4MRUtils')

Monthly Downloads

54

Version

1.0.0

License

AGPL (>= 3)

Maintainer

Lain Pavot

Last Published

September 8th, 2023

Functions in W4MRUtils (1.0.0)

check_err

Check Errors
W4MLogger_set_warning

W4MLogger$set_warning
check_one_character

check_one_character
check_one_complex

check_one_complex
check_parameter_type

check_parameter_type - validate parameter's type
check_parameter_length

check_parameter_length - validate parameter's length
get_logger

Instantiate a Logger
get_base_dir

get_base_dir - to get... the base directory
df_force_numeric

Convert data frame to numeric.
convert_parameters

Convert Parameters
check_one_logical

check_one_logical
collapse

collapse - to paste strings with collapse = ""
optparse_list

optparse_list - define a command parameter as a list of objects
match2

Table match check functions
check_one_integer

check_one_integer
collapse_lines

collapse_lines - to paste strings with collapse = "\n"
optparse_numeric

optparse_numeric - define a command parameter as an numeric
in_galaxy_env

in_galaxy_env - check if the script has been run by galaxy
import3

Import the three W4M tables
check_one_numeric

check_one_numeric
check_param_type_n_length

check_param_type_n_length - to check parameters
df_is

Test type of a data frame.
df_read_table

Data frame loading from a file.
reproduce_id

Reproduce ID
printp

printp - to format a string and print it
parse_args

Parse Command arguments
printfp

printfp - to paste, format and print a string
printf

printf - to format a string and print it
get_r_env

get_r_env - provides env vars begining with R_*
optparse_parameters

optparse_parameters - parse easily the command line parameters
mini_tools

Mini tools for Galaxy scripting
unmangle_galaxy_param

unmangle_galaxy_param - revert effects of galaxy manglings.
optparse_character

optparse_character - define a command parameter as string
show_sys

show_sys - prints env variables related to R
match3

match3
shy_lib

Shy Lib
stopf

stopf - to stop and format message
show_galaxy_footer

show_galaxy_footer - shows the footer for glaxy tools
source_local

source_local - source file, from absolute or relative path
import2

Import two W4M tables
stock_id

Stock ID
optparse_flag

optparse_flag - define a command parameter as a trigger
run_galaxy_function

run_galaxy_function - automate running functions in galaxy
optparse_integer

optparse_integer - define a command parameter as an integer
run_galaxy_processing

run_galaxy_processing - automate running code in galaxy
show_galaxy_header

show_galaxy_header - shows the header for glaxy tools
stopaste

stopaste - to paste string to a message and stop
unmangle_galaxy_string

unmangle_galaxy_string - revert effects of galaxy mangling
stopaste0

stopaste0 - to paste string to a message and stop
W4MLogger

The W4MLogger Class
W4MLogger_set_verbose

W4MLogger$set_verbose
W4MLogger_add_out_paths

Adds a file where logs are duplicated
W4MLogger_set_debug

W4MLogger$set_debug
W4MLogger_set_out_paths

Defines in which file logs are duplicated
W4MLogger_finalize

W4MLogger_finalize
W4MLogger_.message__

W4MLogger_.message__
W4MLogger_set_error

W4MLogger$set_error
W4MLogger_set_info

W4MLogger$set_info
W4MLogger_[info,warning,error,debug,verbose]

Log info/warning/error/debug/verbose messages