Learn R Programming

W4MRUtils

  • VERSION: 1.2.1

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

161

Version

1.2.1

License

AGPL (>= 3)

Maintainer

Melanie Petera

Last Published

October 30th, 2025

Functions in W4MRUtils (1.2.1)

W4MLogger_set_verbose

W4MLogger$set_verbose
check_param_type_n_length

check_param_type_n_length - to check parameters
check_one_numeric

check_one_numeric
check_one_integer

check_one_integer
check_one_logical

check_one_logical
get_base_dir

get_base_dir - to get... the base directory
collapse_lines

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

Import two W4M tables
get_r_env

get_r_env - provides env vars begining with R_*
generic_filter

Filtering a data set following the 3-tables format
df_read_table

Data frame loading from a file.
in_galaxy_env

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

Import the three W4M tables
check_parameter_length

check_parameter_length - validate parameter's length
convert_parameters

Convert Parameters
intens_check

Checking intensities of a data set following the W4M 3-tables format
match3

match3
intensity_checks

Intensity checking tools for Galaxy scripting
parse_args

Parse Command arguments
optparse_character

optparse_character - define a command parameter as string
optparse_flag

optparse_flag - define a command parameter as a trigger
get_logger

Instantiate a Logger
printf

printf - to format a string and print it
match2

Table match check functions
optparse_list

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

optparse_integer - define a command parameter as an integer
show_galaxy_header

show_galaxy_header - shows the header for glaxy tools
reproduce_id

Reproduce ID
stock_id

Stock ID
stopaste0

stopaste0 - to paste string to a message and stop
show_sys

show_sys - prints env variables related to R
df_force_numeric

Convert data frame to numeric.
stopf

stopf - to stop and format message
stopaste

stopaste - to paste string to a message and stop
run_galaxy_processing

run_galaxy_processing - automate running code in galaxy
show_galaxy_footer

show_galaxy_footer - shows the footer for glaxy tools
printfp

printfp - to paste, format and print a string
run_galaxy_function

run_galaxy_function - automate running functions in galaxy
printp

printp - to format a string and print it
df_is

Test type of a data frame.
unmangle_galaxy_param

unmangle_galaxy_param - revert effects of galaxy manglings.
metab_merge

Merging a dataMatrix with a metadata file
mini_tools

Mini tools for Galaxy scripting
collapse

collapse - to paste strings with collapse = ""
check_parameter_type

check_parameter_type - validate parameter's type
unmangle_galaxy_string

unmangle_galaxy_string - revert effects of galaxy mangling
optparse_parameters

optparse_parameters - parse easily the command line parameters
shy_lib

Shy Lib
optparse_numeric

optparse_numeric - define a command parameter as an numeric
source_local

source_local - source file, from absolute or relative path
W4MLogger_set_error

W4MLogger$set_error
W4MLogger_set_debug

W4MLogger$set_debug
W4MLogger_set_info

W4MLogger$set_info
W4MLogger_finalize

W4MLogger_finalize
W4MLogger

The W4MLogger Class
Filtering_datasets

Filtering tools for Galaxy scripting
W4MLogger_add_out_paths

Adds a file where logs are duplicated
W4MLogger_set_out_paths

Defines in which file logs are duplicated
W4MLogger_[info,warning,error,debug,verbose]

Log info/warning/error/debug/verbose messages
W4MLogger_.message__

W4MLogger_.message__
check_err

Check Errors
check_one_character

check_one_character
check_one_complex

check_one_complex
W4MLogger_set_warning

W4MLogger$set_warning